mirror of
https://github.com/marcominerva/SqlDatabaseVectorSearch.git
synced 2026-06-20 12:23:10 +00:00
8c6cc3c969
Updated README.md for clarity and additional setup instructions: - Refined repository description to highlight native Vector type. - Rephrased note on Vector Support feature for readability. - Removed mention of EFCore.SqlServer.VectorSearch library. - Added instructions for updating VECTOR column size and setting Dimension property. Added comment in Scripts.sql to guide vector size setting in Embedding column. Cleaned up VectorSearchService.cs by removing unused and commented-out SQL command execution code.
33 lines
983 B
Transact-SQL
33 lines
983 B
Transact-SQL
CREATE TABLE [dbo].[Documents](
|
|
[Id] [uniqueidentifier] NOT NULL,
|
|
[Name] [nvarchar](255) NOT NULL,
|
|
[CreationDate] [datetimeoffset](7) NOT NULL,
|
|
CONSTRAINT [PK_Documents] PRIMARY KEY CLUSTERED
|
|
(
|
|
[Id] ASC
|
|
))
|
|
GO
|
|
|
|
CREATE TABLE [dbo].[DocumentChunks](
|
|
[Id] [uniqueidentifier] NOT NULL,
|
|
[DocumentId] [uniqueidentifier] NOT NULL,
|
|
[Index] [int] NOT NULL,
|
|
[Content] [nvarchar](max) NOT NULL,
|
|
-- Set the size of the vector to the same size of the your embedding model.
|
|
[Embedding] [vector](1536) NOT NULL,
|
|
CONSTRAINT [PK_DocumentChunks] PRIMARY KEY CLUSTERED
|
|
(
|
|
[Id] ASC
|
|
))
|
|
GO
|
|
|
|
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].[Documents] ADD CONSTRAINT [DF_Documents_Id] DEFAULT (newsequentialid()) FOR [Id]
|
|
GO
|
|
|
|
ALTER TABLE [dbo].[DocumentChunks] ADD CONSTRAINT [DF_DocumentChunks_Id] DEFAULT (newsequentialid()) FOR [Id]
|
|
GO |