1
0
mirror of https://github.com/bitwarden/server synced 2025-12-20 10:13:39 +00:00

Use a header to track seeded data. This has benefits client side in simplicity and allows us to track entities added during a test, as long as they include the play id header.

This commit is contained in:
Matt Gibson
2025-11-10 18:17:41 -08:00
parent 0b22af53da
commit f2116734a2
20 changed files with 125 additions and 148 deletions

View File

@@ -1,10 +0,0 @@
IF OBJECT_ID('dbo.SeededData') IS NULL
BEGIN
CREATE TABLE [dbo].[SeededData] (
[Id] UNIQUEIDENTIFIER NOT NULL,
[RecipeName] NVARCHAR (MAX) NOT NULL,
[Data] NVARCHAR (MAX) NULL,
[CreationDate] DATETIME2 (7) NOT NULL,
);
END
GO

View File

@@ -8,8 +8,8 @@ BEGIN
[OrganizationId] UNIQUEIDENTIFIER NULL,
[CreationDate] DATETIME2 (7) NOT NULL,
CONSTRAINT [PK_PlayData] PRIMARY KEY CLUSTERED ([Id] ASC),
CONSTRAINT [FK_PlayData_User] FOREIGN KEY ([UserId]) REFERENCES [dbo].[User] ([Id]),
CONSTRAINT [FK_PlayData_Organization] FOREIGN KEY ([OrganizationId]) REFERENCES [dbo].[Organization] ([Id]),
CONSTRAINT [FK_PlayData_User] FOREIGN KEY ([UserId]) REFERENCES [dbo].[User] ([Id]) ON DELETE CASCADE,
CONSTRAINT [FK_PlayData_Organization] FOREIGN KEY ([OrganizationId]) REFERENCES [dbo].[Organization] ([Id]) ON DELETE CASCADE,
CONSTRAINT [CK_PlayData_UserOrOrganization] CHECK (([UserId] IS NOT NULL AND [OrganizationId] IS NULL) OR ([UserId] IS NULL AND [OrganizationId] IS NOT NULL))
);