mirror of
https://github.com/marcominerva/SqlDatabaseVectorSearch.git
synced 2026-06-20 12:23:10 +00:00
Refactor DB operations, rename tables, add Dapper
Refactored `VectorSearchService.cs` to use Dapper for DB operations, replacing raw ADO.NET commands. Updated methods for inserting, retrieving, and deleting documents and chunks. Modified vector search query to use Dapper's `QueryAsync`. Updated `SqlDatabaseVectorSearch.csproj` to include Dapper package reference, version `2.1.35`.
This commit is contained in:
+15
-15
@@ -1,4 +1,14 @@
|
||||
CREATE TABLE [dbo].[DocumentChunks2](
|
||||
CREATE TABLE [dbo].[Documents](
|
||||
[Id] [uniqueidentifier] NOT NULL,
|
||||
[Name] [nvarchar](255) NOT NULL,
|
||||
[CreationDate] [datetimeoffset](7) NOT NULL,
|
||||
CONSTRAINT [PK_Documents2] PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[Id] ASC
|
||||
))
|
||||
GO
|
||||
|
||||
CREATE TABLE [dbo].[DocumentChunks](
|
||||
[Id] [uniqueidentifier] NOT NULL,
|
||||
[DocumentId] [uniqueidentifier] NOT NULL,
|
||||
[Index] [int] NOT NULL,
|
||||
@@ -10,23 +20,13 @@ CREATE TABLE [dbo].[DocumentChunks2](
|
||||
))
|
||||
GO
|
||||
|
||||
CREATE TABLE [dbo].[Documents2](
|
||||
[Id] [uniqueidentifier] NOT NULL,
|
||||
[Name] [nvarchar](255) NOT NULL,
|
||||
[CreationDate] [datetimeoffset](7) NOT NULL,
|
||||
CONSTRAINT [PK_Documents2] PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[Id] ASC
|
||||
))
|
||||
GO
|
||||
|
||||
ALTER TABLE [dbo].[DocumentChunks2] WITH CHECK ADD CONSTRAINT [FK_DocumentChunks2_Documents2] FOREIGN KEY([DocumentId])
|
||||
REFERENCES [dbo].[Documents2] ([Id])
|
||||
ALTER TABLE [dbo].[DocumentChunks] WITH CHECK ADD CONSTRAINT [FK_DocumentChunks_Documents] FOREIGN KEY([DocumentId])
|
||||
REFERENCES [dbo].[Documents] ([Id])
|
||||
ON DELETE CASCADE
|
||||
GO
|
||||
|
||||
ALTER TABLE [dbo].[Documents2] ADD CONSTRAINT [DF_Documents2_Id] DEFAULT (newsequentialid()) FOR [Id]
|
||||
ALTER TABLE [dbo].[Documents] ADD CONSTRAINT [DF_Documents_Id] DEFAULT (newsequentialid()) FOR [Id]
|
||||
GO
|
||||
|
||||
ALTER TABLE [dbo].[DocumentChunks2] ADD CONSTRAINT [DF_DocumentChunks2_Id] DEFAULT (newsequentialid()) FOR [Id]
|
||||
ALTER TABLE [dbo].[DocumentChunks] ADD CONSTRAINT [DF_DocumentChunks_Id] DEFAULT (newsequentialid()) FOR [Id]
|
||||
GO
|
||||
Reference in New Issue
Block a user