1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-28 13:15:12 +01:00
bitwarden-server/util/Migrator/DbScripts/2024-02-16_00_AddSecretAccessPolicies.sql

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

15 lines
512 B
MySQL
Raw Normal View History

IF COL_LENGTH('[dbo].[AccessPolicy]', 'GrantedSecretId') IS NULL
BEGIN
ALTER TABLE [dbo].[AccessPolicy] ADD [GrantedSecretId] [uniqueidentifier] NULL
CONSTRAINT [FK_AccessPolicy_Secret_GrantedSecretId] FOREIGN KEY ([GrantedSecretId]) REFERENCES [Secret] ([Id]) ON DELETE CASCADE
END
GO
IF NOT EXISTS(SELECT name
FROM sys.indexes
WHERE name = 'IX_AccessPolicy_GrantedSecretId')
BEGIN
CREATE NONCLUSTERED INDEX [IX_AccessPolicy_GrantedSecretId] ON [dbo].[AccessPolicy] ([GrantedSecretId] ASC);
END
GO