mirror of
https://github.com/marcominerva/SqlDatabaseVectorSearch.git
synced 2026-06-20 12:23:10 +00:00
Refactor to use the native VECTOR type
This commit is contained in:
+13
-7
@@ -1,26 +1,32 @@
|
||||
CREATE TABLE [dbo].[DocumentChunks](
|
||||
CREATE TABLE [dbo].[DocumentChunks2](
|
||||
[Id] [uniqueidentifier] NOT NULL,
|
||||
[DocumentId] [uniqueidentifier] NOT NULL,
|
||||
[Index] [int] NOT NULL,
|
||||
[Content] [nvarchar](max) NOT NULL,
|
||||
[Embedding] [varbinary](8000) NOT NULL,
|
||||
CONSTRAINT [PK_DocumentChunks] PRIMARY KEY CLUSTERED
|
||||
[Embedding] [vector](1536) NOT NULL,
|
||||
CONSTRAINT [PK_DocumentChunks2] PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[Id] ASC
|
||||
))
|
||||
GO
|
||||
|
||||
CREATE TABLE [dbo].[Documents](
|
||||
CREATE TABLE [dbo].[Documents2](
|
||||
[Id] [uniqueidentifier] NOT NULL,
|
||||
[Name] [nvarchar](255) NOT NULL,
|
||||
[CreationDate] [datetimeoffset](7) NOT NULL,
|
||||
CONSTRAINT [PK_Documents] PRIMARY KEY CLUSTERED
|
||||
CONSTRAINT [PK_Documents2] PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[Id] ASC
|
||||
))
|
||||
GO
|
||||
|
||||
ALTER TABLE [dbo].[DocumentChunks] WITH CHECK ADD CONSTRAINT [FK_DocumentChunks_Documents] FOREIGN KEY([DocumentId])
|
||||
REFERENCES [dbo].[Documents] ([Id])
|
||||
ALTER TABLE [dbo].[DocumentChunks2] WITH CHECK ADD CONSTRAINT [FK_DocumentChunks2_Documents2] FOREIGN KEY([DocumentId])
|
||||
REFERENCES [dbo].[Documents2] ([Id])
|
||||
ON DELETE CASCADE
|
||||
GO
|
||||
|
||||
ALTER TABLE [dbo].[Documents2] ADD CONSTRAINT [DF_Documents2_Id] DEFAULT (newsequentialid()) FOR [Id]
|
||||
GO
|
||||
|
||||
ALTER TABLE [dbo].[DocumentChunks2] ADD CONSTRAINT [DF_DocumentChunks2_Id] DEFAULT (newsequentialid()) FOR [Id]
|
||||
GO
|
||||
Reference in New Issue
Block a user