mirror of
https://github.com/bitwarden/server
synced 2026-02-28 02:13:19 +00:00
First pass at semaphore
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
-- Create DefaultCollectionSemaphore table
|
||||
-- Cascade behavior: Organization -> OrganizationUser (CASCADE) -> DefaultCollectionSemaphore (CASCADE)
|
||||
-- OrganizationId FK has NO ACTION to avoid competing cascade paths
|
||||
IF OBJECT_ID('[dbo].[DefaultCollectionSemaphore]') IS NULL
|
||||
BEGIN
|
||||
CREATE TABLE [dbo].[DefaultCollectionSemaphore]
|
||||
(
|
||||
[OrganizationId] UNIQUEIDENTIFIER NOT NULL,
|
||||
[OrganizationUserId] UNIQUEIDENTIFIER NOT NULL,
|
||||
[CreationDate] DATETIME2(7) NOT NULL,
|
||||
CONSTRAINT [PK_DefaultCollectionSemaphore] PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[OrganizationId] ASC,
|
||||
[OrganizationUserId] ASC
|
||||
),
|
||||
CONSTRAINT [FK_DefaultCollectionSemaphore_Organization] FOREIGN KEY ([OrganizationId])
|
||||
REFERENCES [dbo].[Organization] ([Id]), -- NO ACTION to avoid competing cascades
|
||||
CONSTRAINT [FK_DefaultCollectionSemaphore_OrganizationUser] FOREIGN KEY ([OrganizationUserId])
|
||||
REFERENCES [dbo].[OrganizationUser] ([Id])
|
||||
ON DELETE CASCADE -- Cascades from OrganizationUser deletion
|
||||
);
|
||||
END
|
||||
GO
|
||||
Reference in New Issue
Block a user