Data access optimizations

This commit is contained in:
Marco Minerva
2024-09-02 10:42:30 +02:00
parent e4570008e0
commit b6a09d0926
4 changed files with 23 additions and 32 deletions
+4 -9
View File
@@ -1,7 +1,7 @@
CREATE TABLE [dbo].[DocumentChunks](
[Id] [uniqueidentifier] NOT NULL,
[DocumentId] [uniqueidentifier] NOT NULL,
[Index] INT NOT NULL,
[Index] [int] NOT NULL,
[Content] [nvarchar](max) NOT NULL,
[Embedding] [varbinary](8000) NOT NULL,
CONSTRAINT [PK_DocumentChunks] PRIMARY KEY CLUSTERED
@@ -17,15 +17,10 @@ CREATE TABLE [dbo].[Documents](
CONSTRAINT [PK_Documents] PRIMARY KEY CLUSTERED
(
[Id] ASC
))
GO
ALTER TABLE [dbo].[DocumentChunks] ADD CONSTRAINT [DF_DocumentChunks_Id] DEFAULT (newid()) FOR [Id]
GO
ALTER TABLE [dbo].[Documents] ADD CONSTRAINT [DF_Documents_Id] DEFAULT (newid()) FOR [Id]
))
GO
ALTER TABLE [dbo].[DocumentChunks] WITH CHECK ADD CONSTRAINT [FK_DocumentChunks_Documents] FOREIGN KEY([DocumentId])
REFERENCES [dbo].[Documents] ([Id])
GO
ON DELETE CASCADE
GO