1
0
mirror of https://github.com/bitwarden/server synced 2026-01-16 07:23:15 +00:00

Create PlayData table and services

Shift from seeded data tracking that is all server-side to play ids and x-play-id headers that are appended from the clients to track entities added by tests.
This commit is contained in:
Matt Gibson
2025-11-04 16:26:06 -08:00
parent 3f22adcbf2
commit e96e70cc22
31 changed files with 11448 additions and 9 deletions

View File

@@ -0,0 +1,23 @@
CREATE TABLE [dbo].[PlayData] (
[Id] UNIQUEIDENTIFIER NOT NULL,
[PlayId] NVARCHAR (256) NOT NULL,
[UserId] UNIQUEIDENTIFIER NULL,
[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 [CK_PlayData_UserOrOrganization] CHECK (([UserId] IS NOT NULL AND [OrganizationId] IS NULL) OR ([UserId] IS NULL AND [OrganizationId] IS NOT NULL))
);
GO
CREATE NONCLUSTERED INDEX [IX_PlayData_PlayId]
ON [dbo].[PlayData]([PlayId] ASC);
GO
CREATE NONCLUSTERED INDEX [IX_PlayData_UserId]
ON [dbo].[PlayData]([UserId] ASC);
GO
CREATE NONCLUSTERED INDEX [IX_PlayData_OrganizationId]
ON [dbo].[PlayData]([OrganizationId] ASC);