mirror of
https://github.com/bitwarden/server.git
synced 2025-07-19 08:30:59 -05:00
Merge branch 'main' into jmccannon/ac/pm-16811-scim-invite-optimization
# Conflicts: # src/Core/Constants.cs
This commit is contained in:
@ -0,0 +1,101 @@
|
||||
-- OrganizationIntegration
|
||||
|
||||
-- Table
|
||||
IF OBJECT_ID('[dbo].[OrganizationIntegration]') IS NULL
|
||||
BEGIN
|
||||
CREATE TABLE [dbo].[OrganizationIntegration]
|
||||
(
|
||||
[Id] UNIQUEIDENTIFIER NOT NULL,
|
||||
[OrganizationId] UNIQUEIDENTIFIER NOT NULL,
|
||||
[Type] SMALLINT NOT NULL,
|
||||
[Configuration] VARCHAR (MAX) NULL,
|
||||
[CreationDate] DATETIME2 (7) NOT NULL,
|
||||
[RevisionDate] DATETIME2 (7) NOT NULL,
|
||||
CONSTRAINT [PK_OrganizationIntegration] PRIMARY KEY CLUSTERED ([Id] ASC),
|
||||
CONSTRAINT [FK_OrganizationIntegration_Organization] FOREIGN KEY ([OrganizationId]) REFERENCES [dbo].[Organization] ([Id])
|
||||
);
|
||||
|
||||
CREATE NONCLUSTERED INDEX [IX_OrganizationIntegration_OrganizationId]
|
||||
ON [dbo].[OrganizationIntegration]([OrganizationId] ASC);
|
||||
|
||||
CREATE UNIQUE INDEX [IX_OrganizationIntegration_Organization_Type]
|
||||
ON [dbo].[OrganizationIntegration]([OrganizationId], [Type]);
|
||||
END
|
||||
GO
|
||||
|
||||
-- View
|
||||
IF EXISTS(SELECT *
|
||||
FROM sys.views
|
||||
WHERE [Name] = 'OrganizationIntegrationView')
|
||||
BEGIN
|
||||
DROP VIEW [dbo].[OrganizationIntegrationView];
|
||||
END
|
||||
GO
|
||||
|
||||
CREATE VIEW [dbo].[OrganizationIntegrationView]
|
||||
AS
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
[dbo].[OrganizationIntegration]
|
||||
GO
|
||||
|
||||
-- OrganizationIntegrationConfiguration
|
||||
|
||||
-- Table
|
||||
IF OBJECT_ID('[dbo].[OrganizationIntegrationConfiguration]') IS NULL
|
||||
BEGIN
|
||||
CREATE TABLE [dbo].[OrganizationIntegrationConfiguration]
|
||||
(
|
||||
[Id] UNIQUEIDENTIFIER NOT NULL,
|
||||
[OrganizationIntegrationId] UNIQUEIDENTIFIER NOT NULL,
|
||||
[EventType] SMALLINT NOT NULL,
|
||||
[Configuration] VARCHAR (MAX) NULL,
|
||||
[Template] VARCHAR (MAX) NULL,
|
||||
[CreationDate] DATETIME2 (7) NOT NULL,
|
||||
[RevisionDate] DATETIME2 (7) NOT NULL,
|
||||
CONSTRAINT [PK_OrganizationIntegrationConfiguration] PRIMARY KEY CLUSTERED ([Id] ASC),
|
||||
CONSTRAINT [FK_OrganizationIntegrationConfiguration_OrganizationIntegration] FOREIGN KEY ([OrganizationIntegrationId]) REFERENCES [dbo].[OrganizationIntegration] ([Id])
|
||||
);
|
||||
END
|
||||
GO
|
||||
|
||||
-- View
|
||||
IF EXISTS(SELECT *
|
||||
FROM sys.views
|
||||
WHERE [Name] = 'OrganizationIntegrationConfigurationView')
|
||||
BEGIN
|
||||
DROP VIEW [dbo].[OrganizationIntegrationConfigurationView];
|
||||
END
|
||||
GO
|
||||
|
||||
CREATE VIEW [dbo].[OrganizationIntegrationConfigurationView]
|
||||
AS
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
[dbo].[OrganizationIntegrationConfiguration]
|
||||
GO
|
||||
|
||||
CREATE OR ALTER PROCEDURE [dbo].[OrganizationIntegrationConfiguration_ReadManyByEventTypeOrganizationIdIntegrationType]
|
||||
@EventType SMALLINT,
|
||||
@OrganizationId UNIQUEIDENTIFIER,
|
||||
@IntegrationType SMALLINT
|
||||
AS
|
||||
BEGIN
|
||||
SET NOCOUNT ON
|
||||
|
||||
SELECT
|
||||
oic.*
|
||||
FROM
|
||||
[dbo].[OrganizationIntegrationConfigurationView] oic
|
||||
INNER JOIN
|
||||
[dbo].[OrganizationIntegration] oi ON oi.[Id] = oic.[OrganizationIntegrationId]
|
||||
WHERE
|
||||
oic.[EventType] = @EventType
|
||||
AND
|
||||
oi.[OrganizationId] = @OrganizationId
|
||||
AND
|
||||
oi.[Type] = @IntegrationType
|
||||
END
|
||||
GO
|
@ -0,0 +1,49 @@
|
||||
IF EXISTS(SELECT *
|
||||
FROM sys.views
|
||||
WHERE [Name] = 'OrganizationIntegrationConfigurationDetailsView')
|
||||
BEGIN
|
||||
DROP VIEW [dbo].[OrganizationIntegrationConfigurationDetailsView];
|
||||
END
|
||||
GO
|
||||
|
||||
CREATE VIEW [dbo].[OrganizationIntegrationConfigurationDetailsView]
|
||||
AS
|
||||
SELECT
|
||||
oi.[OrganizationId],
|
||||
oi.[Type] AS [IntegrationType],
|
||||
oic.[EventType],
|
||||
oic.[Configuration],
|
||||
oi.[Configuration] AS [IntegrationConfiguration],
|
||||
oic.[Template]
|
||||
FROM
|
||||
[dbo].[OrganizationIntegrationConfiguration] oic
|
||||
INNER JOIN
|
||||
[dbo].[OrganizationIntegration] oi ON oi.[Id] = oic.[OrganizationIntegrationId]
|
||||
GO
|
||||
|
||||
IF OBJECT_ID('[dbo].[OrganizationIntegrationConfiguration_ReadManyByEventTypeOrganizationIdIntegrationType]') IS NOT NULL
|
||||
BEGIN
|
||||
DROP PROCEDURE [dbo].[OrganizationIntegrationConfiguration_ReadManyByEventTypeOrganizationIdIntegrationType]
|
||||
END
|
||||
GO
|
||||
|
||||
CREATE OR ALTER PROCEDURE [dbo].[OrganizationIntegrationConfigurationDetails_ReadManyByEventTypeOrganizationIdIntegrationType]
|
||||
@EventType SMALLINT,
|
||||
@OrganizationId UNIQUEIDENTIFIER,
|
||||
@IntegrationType SMALLINT
|
||||
AS
|
||||
BEGIN
|
||||
SET NOCOUNT ON
|
||||
|
||||
SELECT
|
||||
oic.*
|
||||
FROM
|
||||
[dbo].[OrganizationIntegrationConfigurationDetailsView] oic
|
||||
WHERE
|
||||
oic.[EventType] = @EventType
|
||||
AND
|
||||
oic.[OrganizationId] = @OrganizationId
|
||||
AND
|
||||
oic.[IntegrationType] = @IntegrationType
|
||||
END
|
||||
GO
|
Reference in New Issue
Block a user