diff --git a/docker-unified/Dockerfile b/docker-unified/Dockerfile index 9d15f7eea03c..ce9bd5aa874f 100644 --- a/docker-unified/Dockerfile +++ b/docker-unified/Dockerfile @@ -75,6 +75,7 @@ COPY util/MySqlMigrations/*.csproj ./util/MySqlMigrations/ COPY util/PostgresMigrations/*.csproj ./util/PostgresMigrations/ COPY util/SqliteMigrations/*.csproj ./util/SqliteMigrations/ COPY bitwarden_license/src/Commercial.Core/*.csproj ./bitwarden_license/src/Commercial.Core/ +COPY bitwarden_license/src/Commercial.Infrastructure.EntityFramework/*.csproj ./bitwarden_license/src/Commercial.Infrastructure.EntityFramework/ COPY Directory.Build.props . # Restore Admin project dependencies and tools @@ -129,6 +130,7 @@ COPY util/PostgresMigrations/. ./util/PostgresMigrations/ COPY util/SqliteMigrations/. ./util/SqliteMigrations/ COPY util/EfShared/. ./util/EfShared/ COPY bitwarden_license/src/Commercial.Core/. ./bitwarden_license/src/Commercial.Core/ +COPY bitwarden_license/src/Commercial.Infrastructure.EntityFramework/. ./bitwarden_license/src/Commercial.Infrastructure.EntityFramework/ COPY .git/. ./.git/ # Build Admin app diff --git a/src/Api/Api.csproj b/src/Api/Api.csproj index f574247511e6..613dba05af30 100644 --- a/src/Api/Api.csproj +++ b/src/Api/Api.csproj @@ -18,13 +18,13 @@ - + diff --git a/src/Sql/Sql.sqlproj b/src/Sql/Sql.sqlproj index 70c5d7718817..3e26fd58a245 100644 --- a/src/Sql/Sql.sqlproj +++ b/src/Sql/Sql.sqlproj @@ -74,7 +74,6 @@ - diff --git a/src/Sql/dbo/Stored Procedures/ApiKey/ApiKey_ReadById.sql b/src/Sql/dbo/Stored Procedures/ApiKey/ApiKey_ReadById.sql deleted file mode 100644 index fafa45d0abac..000000000000 --- a/src/Sql/dbo/Stored Procedures/ApiKey/ApiKey_ReadById.sql +++ /dev/null @@ -1,13 +0,0 @@ -CREATE PROCEDURE [dbo].[ApiKey_ReadById] - @Id UNIQUEIDENTIFIER -AS -BEGIN - SET NOCOUNT ON - - SELECT - * - FROM - [dbo].[ApiKeyView] - WHERE - [Id] = @Id -END diff --git a/src/Sql/dbo/Stored Procedures/Organization_DeleteById.sql b/src/Sql/dbo/Stored Procedures/Organization_DeleteById.sql index 3f900203be63..c54a08c0296b 100644 --- a/src/Sql/dbo/Stored Procedures/Organization_DeleteById.sql +++ b/src/Sql/dbo/Stored Procedures/Organization_DeleteById.sql @@ -73,6 +73,20 @@ BEGIN WHERE [OrganizationId] = @Id + DELETE AK + FROM + [dbo].[ApiKey] AK + INNER JOIN + [dbo].[ServiceAccount] SA ON [AK].[ServiceAccountId] = [SA].[Id] + WHERE + [SA].[OrganizationId] = @Id + + DELETE + FROM + [dbo].[ServiceAccount] + WHERE + [OrganizationId] = @Id + DELETE FROM [dbo].[Organization] diff --git a/src/Sql/dbo/Stored Procedures/User_DeleteById.sql b/src/Sql/dbo/Stored Procedures/User_DeleteById.sql index 726b7cb58ddc..ce32f2f24a42 100644 --- a/src/Sql/dbo/Stored Procedures/User_DeleteById.sql +++ b/src/Sql/dbo/Stored Procedures/User_DeleteById.sql @@ -58,6 +58,16 @@ BEGIN WHERE OU.[UserId] = @Id + -- Delete AccessPolicy + DELETE + AP + FROM + [dbo].[AccessPolicy] AP + INNER JOIN + [dbo].[OrganizationUser] OU ON OU.[Id] = AP.[OrganizationUserId] + WHERE + [UserId] = @Id + -- Delete organization users DELETE FROM diff --git a/src/Sql/dbo/Tables/ProjectSecret.sql b/src/Sql/dbo/Tables/ProjectSecret.sql index 73a2c8b0e354..6162dc7288c8 100644 --- a/src/Sql/dbo/Tables/ProjectSecret.sql +++ b/src/Sql/dbo/Tables/ProjectSecret.sql @@ -7,4 +7,4 @@ ); GO -CREATE INDEX [IX_ProjectSecret_SecretsId] ON [ProjectSecret] ([SecretsId]); +CREATE NONCLUSTERED INDEX [IX_ProjectSecret_SecretsId] ON [ProjectSecret] ([SecretsId]); diff --git a/src/Sql/dbo/Views/OrganizationUserOrganizationDetailsView.sql b/src/Sql/dbo/Views/OrganizationUserOrganizationDetailsView.sql index 18f21ad81f6b..5c93a181b557 100644 --- a/src/Sql/dbo/Views/OrganizationUserOrganizationDetailsView.sql +++ b/src/Sql/dbo/Views/OrganizationUserOrganizationDetailsView.sql @@ -17,10 +17,10 @@ SELECT O.[Use2fa], O.[UseApi], O.[UseResetPassword], - O.[UseSecretsManager], O.[SelfHost], O.[UsersGetPremium], O.[UseCustomPermissions], + O.[UseSecretsManager], O.[Seats], O.[MaxCollections], O.[MaxStorageGb], diff --git a/util/Migrator/DbScripts/2022-07-20_00_CreateSecretTable.sql b/util/Migrator/DbScripts/2022-07-20_00_CreateSecretTable.sql deleted file mode 100644 index bd9dd66f8b32..000000000000 --- a/util/Migrator/DbScripts/2022-07-20_00_CreateSecretTable.sql +++ /dev/null @@ -1,20 +0,0 @@ -IF OBJECT_ID('[dbo].[Secret]') IS NULL -BEGIN - CREATE TABLE [dbo].[Secret] ( - [Id] UNIQUEIDENTIFIER NOT NULL, - [OrganizationId] UNIQUEIDENTIFIER NOT NULL, - [Key] NVARCHAR(MAX) NULL, - [Value] NVARCHAR(MAX) NULL, - [Note] NVARCHAR(MAX) NULL, - [CreationDate] DATETIME2(7) NOT NULL, - [RevisionDate] DATETIME2(7) NOT NULL, - [DeletedDate] DATETIME2(7) NULL, - CONSTRAINT [PK_Secret] PRIMARY KEY CLUSTERED ([Id] ASC), - CONSTRAINT [FK_Secret_OrganizationId] FOREIGN KEY ([OrganizationId]) REFERENCES [dbo].[Organization]([Id]) ON DELETE CASCADE - ); - - CREATE NONCLUSTERED INDEX [IX_Secret_OrganizationId] ON [dbo].[Secret] ([OrganizationId] ASC); - - CREATE NONCLUSTERED INDEX [IX_Secret_DeletedDate] ON [dbo].[Secret] ([DeletedDate] ASC); -END -GO diff --git a/util/Migrator/DbScripts/2022-08-10_00_Project.sql b/util/Migrator/DbScripts/2022-08-10_00_Project.sql deleted file mode 100644 index 247aa2dd8fe4..000000000000 --- a/util/Migrator/DbScripts/2022-08-10_00_Project.sql +++ /dev/null @@ -1,20 +0,0 @@ -IF OBJECT_ID('[dbo].[Project]') IS NULL -BEGIN -CREATE TABLE [dbo].[Project] ( - [Id] UNIQUEIDENTIFIER NOT NULL, - [OrganizationId] UNIQUEIDENTIFIER NOT NULL, - [Name] NVARCHAR(MAX) NULL, - [CreationDate] DATETIME2 (7), - [RevisionDate] DATETIME2 (7), - [DeletedDate] DATETIME2 (7) NULL, - CONSTRAINT [PK_Project] PRIMARY KEY CLUSTERED ([Id] ASC), - CONSTRAINT [FK_Project_Organization] FOREIGN KEY ([OrganizationId]) REFERENCES [dbo].[Organization] ([Id]) ON DELETE CASCADE, -); - -CREATE NONCLUSTERED INDEX [IX_Project_OrganizationId] ON [dbo].[Project] ([OrganizationId] ASC); - -CREATE NONCLUSTERED INDEX [IX_Project_DeletedDate] ON [dbo].[Project] ([DeletedDate] ASC); - -END - -GO diff --git a/util/Migrator/DbScripts/2022-09-19_00_ProjectSecret.sql b/util/Migrator/DbScripts/2022-09-19_00_ProjectSecret.sql deleted file mode 100644 index 84443b7cc6d0..000000000000 --- a/util/Migrator/DbScripts/2022-09-19_00_ProjectSecret.sql +++ /dev/null @@ -1,120 +0,0 @@ -CREATE OR ALTER PROCEDURE [dbo].[Organization_DeleteById] - @Id UNIQUEIDENTIFIER -AS -BEGIN - SET NOCOUNT ON - - EXEC [dbo].[User_BumpAccountRevisionDateByOrganizationId] @Id - - DECLARE @BatchSize INT = 100 - WHILE @BatchSize > 0 - BEGIN - BEGIN TRANSACTION Organization_DeleteById_Ciphers - - DELETE TOP(@BatchSize) - FROM - [dbo].[Cipher] - WHERE - [UserId] IS NULL - AND [OrganizationId] = @Id - - SET @BatchSize = @@ROWCOUNT - - COMMIT TRANSACTION Organization_DeleteById_Ciphers - END - - BEGIN TRANSACTION Organization_DeleteById - - DELETE - FROM - [dbo].[SsoUser] - WHERE - [OrganizationId] = @Id - - DELETE - FROM - [dbo].[SsoConfig] - WHERE - [OrganizationId] = @Id - - DELETE CU - FROM - [dbo].[CollectionUser] CU - INNER JOIN - [dbo].[OrganizationUser] OU ON [CU].[OrganizationUserId] = [OU].[Id] - WHERE - [OU].[OrganizationId] = @Id - - DELETE - FROM - [dbo].[OrganizationUser] - WHERE - [OrganizationId] = @Id - - DELETE - FROM - [dbo].[ProviderOrganization] - WHERE - [OrganizationId] = @Id - - EXEC [dbo].[OrganizationApiKey_OrganizationDeleted] @Id - EXEC [dbo].[OrganizationConnection_OrganizationDeleted] @Id - EXEC [dbo].[OrganizationSponsorship_OrganizationDeleted] @Id - - DELETE - FROM - [dbo].[Project] - WHERE - [OrganizationId] = @Id - - DELETE - FROM - [dbo].[Secret] - WHERE - [OrganizationId] = @Id - - DELETE - FROM - [dbo].[Organization] - WHERE - [Id] = @Id - - COMMIT TRANSACTION Organization_DeleteById -END -GO - --- Update project and secret table to NOT on delete cascade anymore -IF EXISTS (SELECT name - FROM sys.foreign_keys - WHERE name = 'FK_Project_Organization') -BEGIN - ALTER TABLE [Project] DROP CONSTRAINT FK_Project_Organization; -END - -ALTER TABLE [Project] ADD CONSTRAINT [FK_Project_Organization] FOREIGN KEY ([OrganizationId]) REFERENCES [dbo].[Organization] ([Id]); - -IF EXISTS (SELECT name - FROM sys.foreign_keys - WHERE name = 'FK_Secret_OrganizationId') -BEGIN - ALTER TABLE [Secret] DROP CONSTRAINT FK_Secret_OrganizationId; -END - -ALTER TABLE [Secret] ADD CONSTRAINT [FK_Secret_OrganizationId] FOREIGN KEY ([OrganizationId]) REFERENCES [dbo].[Organization] ([Id]); - -IF OBJECT_ID('[dbo].[ProjectSecret]') IS NULL -BEGIN - CREATE TABLE [ProjectSecret] ( - [ProjectsId] UNIQUEIDENTIFIER NOT NULL, - [SecretsId] UNIQUEIDENTIFIER NOT NULL, - CONSTRAINT [PK_ProjectSecret] PRIMARY KEY ([ProjectsId], [SecretsId]), - CONSTRAINT [FK_ProjectSecret_Project_ProjectsId] FOREIGN KEY ([ProjectsId]) REFERENCES [Project] ([Id]) ON DELETE CASCADE, - CONSTRAINT [FK_ProjectSecret_Secret_SecretsId] FOREIGN KEY ([SecretsId]) REFERENCES [Secret] ([Id]) ON DELETE CASCADE - ); - - CREATE INDEX [IX_ProjectSecret_SecretsId] ON [ProjectSecret] ([SecretsId]); - -END - -GO - diff --git a/util/Migrator/DbScripts/2022-09-26_00_SmServiceAccount.sql b/util/Migrator/DbScripts/2022-09-26_00_SmServiceAccount.sql deleted file mode 100644 index fc8953917d38..000000000000 --- a/util/Migrator/DbScripts/2022-09-26_00_SmServiceAccount.sql +++ /dev/null @@ -1,16 +0,0 @@ -IF OBJECT_ID('[dbo].[ServiceAccount]') IS NULL -BEGIN -CREATE TABLE [dbo].[ServiceAccount] -( - [Id] UNIQUEIDENTIFIER NOT NULL, - [OrganizationId] UNIQUEIDENTIFIER NOT NULL, - [Name] NVARCHAR(MAX) NULL, - [CreationDate] DATETIME2(7) NOT NULL, - [RevisionDate] DATETIME2(7) NOT NULL, - CONSTRAINT [PK_ServiceAccount] PRIMARY KEY CLUSTERED ([Id] ASC), - CONSTRAINT [FK_ServiceAccount_OrganizationId] FOREIGN KEY ([OrganizationId]) REFERENCES [dbo].[Organization]([Id]) ON DELETE CASCADE -); - -CREATE NONCLUSTERED INDEX [IX_ServiceAccount_OrganizationId] ON [dbo].[ServiceAccount] ([OrganizationId] ASC); -END -GO diff --git a/util/Migrator/DbScripts/2022-09-27_00_ApiKey.sql b/util/Migrator/DbScripts/2022-09-27_00_ApiKey.sql deleted file mode 100644 index c219a274ca3e..000000000000 --- a/util/Migrator/DbScripts/2022-09-27_00_ApiKey.sql +++ /dev/null @@ -1,43 +0,0 @@ -IF OBJECT_ID('[dbo].[ApiKey]') IS NULL -BEGIN - CREATE TABLE [dbo].[ApiKey] ( - [Id] UNIQUEIDENTIFIER, - [ServiceAccountId] UNIQUEIDENTIFIER NULL, - [Name] VARCHAR(200) NOT NULL, - [ClientSecret] VARCHAR(30) NOT NULL, - [Scope] NVARCHAR (4000) NOT NULL, - [EncryptedPayload] NVARCHAR (4000) NOT NULL, - [Key] VARCHAR (MAX) NOT NULL, - [ExpireAt] DATETIME2(7) NOT NULL, - [CreationDate] DATETIME2(7) NOT NULL, - [RevisionDate] DATETIME2(7) NOT NULL, - CONSTRAINT [PK_ApiKey] PRIMARY KEY CLUSTERED ([Id] ASC), - CONSTRAINT [FK_ApiKey_ServiceAccountId] FOREIGN KEY ([ServiceAccountId]) REFERENCES [dbo].[ServiceAccount] ([Id]) - ); - - CREATE NONCLUSTERED INDEX [IX_ApiKey_ServiceAccountId] - ON [dbo].[ApiKey]([ServiceAccountId] ASC); -END -GO - -CREATE OR ALTER VIEW [dbo].[ApiKeyView] -AS -SELECT - * -FROM - [dbo].[ApiKey] -GO - -CREATE OR ALTER PROCEDURE [dbo].[ApiKey_ReadById] - @Id UNIQUEIDENTIFIER -AS -BEGIN - SET NOCOUNT ON - - SELECT - * - FROM - [dbo].[ApiKeyView] - WHERE - [Id] = @Id -END diff --git a/util/Migrator/DbScripts/2022-10-25_00_AccessPolicy.sql b/util/Migrator/DbScripts/2022-10-25_00_AccessPolicy.sql deleted file mode 100644 index 1bf9f770fd30..000000000000 --- a/util/Migrator/DbScripts/2022-10-25_00_AccessPolicy.sql +++ /dev/null @@ -1,93 +0,0 @@ --- Remove ON DELETE for service accounts -IF EXISTS (SELECT name FROM sys.foreign_keys WHERE name = 'FK_ServiceAccount_OrganizationId') -BEGIN - ALTER TABLE [ServiceAccount] DROP CONSTRAINT [FK_ServiceAccount_OrganizationId]; -END - -ALTER TABLE [ServiceAccount] ADD CONSTRAINT [FK_ServiceAccount_OrganizationId] FOREIGN KEY ([OrganizationId]) REFERENCES [dbo].[Organization] ([Id]); -GO - -IF OBJECT_ID('[dbo].[AccessPolicy]') IS NULL -BEGIN - CREATE TABLE [AccessPolicy] ( - [Id] UNIQUEIDENTIFIER NOT NULL, - [Discriminator] NVARCHAR(50) NOT NULL, - [OrganizationUserId] UNIQUEIDENTIFIER NULL, - [GroupId] UNIQUEIDENTIFIER NULL, - [ServiceAccountId] UNIQUEIDENTIFIER NULL, - [GrantedProjectId] UNIQUEIDENTIFIER NULL, - [GrantedServiceAccountId] UNIQUEIDENTIFIER NULL, - [Read] BIT NOT NULL, - [Write] BIT NOT NULL, - [CreationDate] DATETIME2 NOT NULL, - [RevisionDate] DATETIME2 NOT NULL, - CONSTRAINT [PK_AccessPolicy] PRIMARY KEY CLUSTERED ([Id]), - CONSTRAINT [FK_AccessPolicy_Group_GroupId] FOREIGN KEY ([GroupId]) REFERENCES [Group] ([Id]) ON DELETE CASCADE, - CONSTRAINT [FK_AccessPolicy_OrganizationUser_OrganizationUserId] FOREIGN KEY ([OrganizationUserId]) REFERENCES [OrganizationUser] ([Id]), - CONSTRAINT [FK_AccessPolicy_Project_GrantedProjectId] FOREIGN KEY ([GrantedProjectId]) REFERENCES [Project] ([Id]) ON DELETE CASCADE, - CONSTRAINT [FK_AccessPolicy_ServiceAccount_GrantedServiceAccountId] FOREIGN KEY ([GrantedServiceAccountId]) REFERENCES [ServiceAccount] ([Id]), - CONSTRAINT [FK_AccessPolicy_ServiceAccount_ServiceAccountId] FOREIGN KEY ([ServiceAccountId]) REFERENCES [ServiceAccount] ([Id]) - ); - - CREATE NONCLUSTERED INDEX [IX_AccessPolicy_GroupId] ON [AccessPolicy] ([GroupId]); - - CREATE NONCLUSTERED INDEX [IX_AccessPolicy_OrganizationUserId] ON [AccessPolicy] ([OrganizationUserId]); - - CREATE NONCLUSTERED INDEX [IX_AccessPolicy_GrantedProjectId] ON [AccessPolicy] ([GrantedProjectId]); - - CREATE NONCLUSTERED INDEX [IX_AccessPolicy_ServiceAccountId] ON [AccessPolicy] ([ServiceAccountId]); - - CREATE NONCLUSTERED INDEX [IX_AccessPolicy_GrantedServiceAccountId] ON [AccessPolicy] ([GrantedServiceAccountId]); -END -GO - -CREATE OR ALTER PROCEDURE [dbo].[OrganizationUser_DeleteById] - @Id UNIQUEIDENTIFIER -AS -BEGIN - SET NOCOUNT ON - - EXEC [dbo].[User_BumpAccountRevisionDateByOrganizationUserId] @Id - - DECLARE @OrganizationId UNIQUEIDENTIFIER - DECLARE @UserId UNIQUEIDENTIFIER - - SELECT - @OrganizationId = [OrganizationId], - @UserId = [UserId] - FROM - [dbo].[OrganizationUser] - WHERE - [Id] = @Id - - IF @OrganizationId IS NOT NULL AND @UserId IS NOT NULL - BEGIN - EXEC [dbo].[SsoUser_Delete] @UserId, @OrganizationId - END - - DELETE - FROM - [dbo].[CollectionUser] - WHERE - [OrganizationUserId] = @Id - - DELETE - FROM - [dbo].[GroupUser] - WHERE - [OrganizationUserId] = @Id - - DELETE - FROM - [dbo].[AccessPolicy] - WHERE - [OrganizationUserId] = @Id - - EXEC [dbo].[OrganizationSponsorship_OrganizationUserDeleted] @Id - - DELETE - FROM - [dbo].[OrganizationUser] - WHERE - [Id] = @Id -END diff --git a/util/Migrator/DbScripts/2022-11-01_00_ApiKeyUi.sql b/util/Migrator/DbScripts/2022-11-01_00_ApiKeyUi.sql deleted file mode 100644 index f6316fb44239..000000000000 --- a/util/Migrator/DbScripts/2022-11-01_00_ApiKeyUi.sql +++ /dev/null @@ -1,13 +0,0 @@ -CREATE OR ALTER PROCEDURE [dbo].[ApiKey_ReadByServiceAccountId] - @ServiceAccountId UNIQUEIDENTIFIER -AS -BEGIN - SET NOCOUNT ON - - SELECT - * - FROM - [dbo].[ApiKeyView] - WHERE - [ServiceAccountId] = @ServiceAccountId -END diff --git a/util/Migrator/DbScripts/2022-11-03_00_ApiKeyDetails.sql b/util/Migrator/DbScripts/2022-11-03_00_ApiKeyDetails.sql deleted file mode 100644 index 6ab0e3200610..000000000000 --- a/util/Migrator/DbScripts/2022-11-03_00_ApiKeyDetails.sql +++ /dev/null @@ -1,24 +0,0 @@ -CREATE OR ALTER VIEW [dbo].[ApiKeyDetailsView] -AS -SELECT - AK.*, - SA.[OrganizationId] ServiceAccountOrganizationId -FROM - [dbo].[ApiKey] AS AK -LEFT JOIN - [dbo].[ServiceAccount] SA ON SA.[Id] = AK.[ServiceAccountId] -GO - -CREATE OR ALTER PROCEDURE [dbo].[ApiKeyDetails_ReadById] - @Id UNIQUEIDENTIFIER -AS -BEGIN - SET NOCOUNT ON - - SELECT - * - FROM - [dbo].[ApiKeyDetailsView] - WHERE - [Id] = @Id -END diff --git a/util/Migrator/DbScripts/2022-11-14_00_ApiKey_Create.sql b/util/Migrator/DbScripts/2022-11-14_00_ApiKey_Create.sql deleted file mode 100644 index 6c54e2fdc973..000000000000 --- a/util/Migrator/DbScripts/2022-11-14_00_ApiKey_Create.sql +++ /dev/null @@ -1,42 +0,0 @@ -CREATE OR ALTER PROCEDURE [dbo].[ApiKey_Create] - @Id UNIQUEIDENTIFIER OUTPUT, - @ServiceAccountId UNIQUEIDENTIFIER, - @Name VARCHAR(200), - @ClientSecret VARCHAR(30), - @Scope NVARCHAR(4000), - @EncryptedPayload NVARCHAR(4000), - @Key VARCHAR(MAX), - @ExpireAt DATETIME2(7), - @CreationDate DATETIME2(7), - @RevisionDate DATETIME2(7) -AS -BEGIN - SET NOCOUNT ON - - INSERT INTO [dbo].[ApiKey] - ( - [Id], - [ServiceAccountId], - [Name], - [ClientSecret], - [Scope], - [EncryptedPayload], - [Key], - [ExpireAt], - [CreationDate], - [RevisionDate] - ) - VALUES - ( - @Id, - @ServiceAccountId, - @Name, - @ClientSecret, - @Scope, - @EncryptedPayload, - @Key, - @ExpireAt, - @CreationDate, - @RevisionDate - ) -END diff --git a/util/Migrator/DbScripts/2022-11-15_00_SecretsManagerFlag.sql b/util/Migrator/DbScripts/2022-11-15_00_SecretsManagerFlag.sql deleted file mode 100644 index 792b57f856dc..000000000000 --- a/util/Migrator/DbScripts/2022-11-15_00_SecretsManagerFlag.sql +++ /dev/null @@ -1,316 +0,0 @@ -IF COL_LENGTH('[dbo].[Organization]', 'UseSecretsManager') IS NULL - BEGIN - ALTER TABLE - [dbo].[Organization] - ADD - [UseSecretsManager] BIT NOT NULL CONSTRAINT [DF_Organization_UseSecretsManager] DEFAULT (0) - END -GO - -CREATE OR ALTER PROCEDURE [dbo].[Organization_Create] - @Id UNIQUEIDENTIFIER OUTPUT, - @Identifier NVARCHAR(50), - @Name NVARCHAR(50), - @BusinessName NVARCHAR(50), - @BusinessAddress1 NVARCHAR(50), - @BusinessAddress2 NVARCHAR(50), - @BusinessAddress3 NVARCHAR(50), - @BusinessCountry VARCHAR(2), - @BusinessTaxNumber NVARCHAR(30), - @BillingEmail NVARCHAR(256), - @Plan NVARCHAR(50), - @PlanType TINYINT, - @Seats INT, - @MaxCollections SMALLINT, - @UsePolicies BIT, - @UseSso BIT, - @UseGroups BIT, - @UseDirectory BIT, - @UseEvents BIT, - @UseTotp BIT, - @Use2fa BIT, - @UseApi BIT, - @UseResetPassword BIT, - @SelfHost BIT, - @UsersGetPremium BIT, - @Storage BIGINT, - @MaxStorageGb SMALLINT, - @Gateway TINYINT, - @GatewayCustomerId VARCHAR(50), - @GatewaySubscriptionId VARCHAR(50), - @ReferenceData VARCHAR(MAX), - @Enabled BIT, - @LicenseKey VARCHAR(100), - @PublicKey VARCHAR(MAX), - @PrivateKey VARCHAR(MAX), - @TwoFactorProviders NVARCHAR(MAX), - @ExpirationDate DATETIME2(7), - @CreationDate DATETIME2(7), - @RevisionDate DATETIME2(7), - @OwnersNotifiedOfAutoscaling DATETIME2(7), - @MaxAutoscaleSeats INT, - @UseKeyConnector BIT = 0, - @UseScim BIT = 0, - @UseSecretsManager BIT = 0 -AS -BEGIN - SET NOCOUNT ON - - INSERT INTO [dbo].[Organization] - ( - [Id], - [Identifier], - [Name], - [BusinessName], - [BusinessAddress1], - [BusinessAddress2], - [BusinessAddress3], - [BusinessCountry], - [BusinessTaxNumber], - [BillingEmail], - [Plan], - [PlanType], - [Seats], - [MaxCollections], - [UsePolicies], - [UseSso], - [UseGroups], - [UseDirectory], - [UseEvents], - [UseTotp], - [Use2fa], - [UseApi], - [UseResetPassword], - [SelfHost], - [UsersGetPremium], - [Storage], - [MaxStorageGb], - [Gateway], - [GatewayCustomerId], - [GatewaySubscriptionId], - [ReferenceData], - [Enabled], - [LicenseKey], - [PublicKey], - [PrivateKey], - [TwoFactorProviders], - [ExpirationDate], - [CreationDate], - [RevisionDate], - [OwnersNotifiedOfAutoscaling], - [MaxAutoscaleSeats], - [UseKeyConnector], - [UseScim], - [UseSecretsManager] - ) - VALUES - ( - @Id, - @Identifier, - @Name, - @BusinessName, - @BusinessAddress1, - @BusinessAddress2, - @BusinessAddress3, - @BusinessCountry, - @BusinessTaxNumber, - @BillingEmail, - @Plan, - @PlanType, - @Seats, - @MaxCollections, - @UsePolicies, - @UseSso, - @UseGroups, - @UseDirectory, - @UseEvents, - @UseTotp, - @Use2fa, - @UseApi, - @UseResetPassword, - @SelfHost, - @UsersGetPremium, - @Storage, - @MaxStorageGb, - @Gateway, - @GatewayCustomerId, - @GatewaySubscriptionId, - @ReferenceData, - @Enabled, - @LicenseKey, - @PublicKey, - @PrivateKey, - @TwoFactorProviders, - @ExpirationDate, - @CreationDate, - @RevisionDate, - @OwnersNotifiedOfAutoscaling, - @MaxAutoscaleSeats, - @UseKeyConnector, - @UseScim, - @UseSecretsManager - ) -END -GO - -CREATE OR ALTER PROCEDURE [dbo].[Organization_Update] - @Id UNIQUEIDENTIFIER, - @Identifier NVARCHAR(50), - @Name NVARCHAR(50), - @BusinessName NVARCHAR(50), - @BusinessAddress1 NVARCHAR(50), - @BusinessAddress2 NVARCHAR(50), - @BusinessAddress3 NVARCHAR(50), - @BusinessCountry VARCHAR(2), - @BusinessTaxNumber NVARCHAR(30), - @BillingEmail NVARCHAR(256), - @Plan NVARCHAR(50), - @PlanType TINYINT, - @Seats INT, - @MaxCollections SMALLINT, - @UsePolicies BIT, - @UseSso BIT, - @UseGroups BIT, - @UseDirectory BIT, - @UseEvents BIT, - @UseTotp BIT, - @Use2fa BIT, - @UseApi BIT, - @UseResetPassword BIT, - @SelfHost BIT, - @UsersGetPremium BIT, - @Storage BIGINT, - @MaxStorageGb SMALLINT, - @Gateway TINYINT, - @GatewayCustomerId VARCHAR(50), - @GatewaySubscriptionId VARCHAR(50), - @ReferenceData VARCHAR(MAX), - @Enabled BIT, - @LicenseKey VARCHAR(100), - @PublicKey VARCHAR(MAX), - @PrivateKey VARCHAR(MAX), - @TwoFactorProviders NVARCHAR(MAX), - @ExpirationDate DATETIME2(7), - @CreationDate DATETIME2(7), - @RevisionDate DATETIME2(7), - @OwnersNotifiedOfAutoscaling DATETIME2(7), - @MaxAutoscaleSeats INT, - @UseKeyConnector BIT = 0, - @UseScim BIT = 0, - @UseSecretsManager BIT = 0 -AS -BEGIN - SET NOCOUNT ON - - UPDATE - [dbo].[Organization] - SET - [Identifier] = @Identifier, - [Name] = @Name, - [BusinessName] = @BusinessName, - [BusinessAddress1] = @BusinessAddress1, - [BusinessAddress2] = @BusinessAddress2, - [BusinessAddress3] = @BusinessAddress3, - [BusinessCountry] = @BusinessCountry, - [BusinessTaxNumber] = @BusinessTaxNumber, - [BillingEmail] = @BillingEmail, - [Plan] = @Plan, - [PlanType] = @PlanType, - [Seats] = @Seats, - [MaxCollections] = @MaxCollections, - [UsePolicies] = @UsePolicies, - [UseSso] = @UseSso, - [UseGroups] = @UseGroups, - [UseDirectory] = @UseDirectory, - [UseEvents] = @UseEvents, - [UseTotp] = @UseTotp, - [Use2fa] = @Use2fa, - [UseApi] = @UseApi, - [UseResetPassword] = @UseResetPassword, - [SelfHost] = @SelfHost, - [UsersGetPremium] = @UsersGetPremium, - [Storage] = @Storage, - [MaxStorageGb] = @MaxStorageGb, - [Gateway] = @Gateway, - [GatewayCustomerId] = @GatewayCustomerId, - [GatewaySubscriptionId] = @GatewaySubscriptionId, - [ReferenceData] = @ReferenceData, - [Enabled] = @Enabled, - [LicenseKey] = @LicenseKey, - [PublicKey] = @PublicKey, - [PrivateKey] = @PrivateKey, - [TwoFactorProviders] = @TwoFactorProviders, - [ExpirationDate] = @ExpirationDate, - [CreationDate] = @CreationDate, - [RevisionDate] = @RevisionDate, - [OwnersNotifiedOfAutoscaling] = @OwnersNotifiedOfAutoscaling, - [MaxAutoscaleSeats] = @MaxAutoscaleSeats, - [UseKeyConnector] = @UseKeyConnector, - [UseScim] = @UseScim, - [UseSecretsManager] = @UseSecretsManager - WHERE - [Id] = @Id -END -GO - -IF OBJECT_ID('[dbo].[OrganizationView]') IS NOT NULL - BEGIN - EXECUTE sp_refreshview N'[dbo].[OrganizationView]'; - END -GO - -CREATE OR ALTER VIEW [dbo].[OrganizationUserOrganizationDetailsView] -AS -SELECT - OU.[UserId], - OU.[OrganizationId], - O.[Name], - O.[Enabled], - O.[PlanType], - O.[UsePolicies], - O.[UseSso], - O.[UseKeyConnector], - O.[UseScim], - O.[UseGroups], - O.[UseDirectory], - O.[UseEvents], - O.[UseTotp], - O.[Use2fa], - O.[UseApi], - O.[UseResetPassword], - O.[UseSecretsManager], - O.[SelfHost], - O.[UsersGetPremium], - O.[Seats], - O.[MaxCollections], - O.[MaxStorageGb], - O.[Identifier], - OU.[Key], - OU.[ResetPasswordKey], - O.[PublicKey], - O.[PrivateKey], - OU.[Status], - OU.[Type], - SU.[ExternalId] SsoExternalId, - OU.[Permissions], - PO.[ProviderId], - P.[Name] ProviderName, - SS.[Data] SsoConfig, - OS.[FriendlyName] FamilySponsorshipFriendlyName, - OS.[LastSyncDate] FamilySponsorshipLastSyncDate, - OS.[ToDelete] FamilySponsorshipToDelete, - OS.[ValidUntil] FamilySponsorshipValidUntil -FROM - [dbo].[OrganizationUser] OU -LEFT JOIN - [dbo].[Organization] O ON O.[Id] = OU.[OrganizationId] -LEFT JOIN - [dbo].[SsoUser] SU ON SU.[UserId] = OU.[UserId] AND SU.[OrganizationId] = OU.[OrganizationId] -LEFT JOIN - [dbo].[ProviderOrganization] PO ON PO.[OrganizationId] = O.[Id] -LEFT JOIN - [dbo].[Provider] P ON P.[Id] = PO.[ProviderId] -LEFT JOIN - [dbo].[SsoConfig] SS ON SS.[OrganizationId] = OU.[OrganizationId] -LEFT JOIN - [dbo].[OrganizationSponsorship] OS ON OS.[SponsoringOrganizationUserID] = OU.[Id] diff --git a/util/Migrator/DbScripts/2022-11-29_00_ApiKey_Never_Expire.sql b/util/Migrator/DbScripts/2022-11-29_00_ApiKey_Never_Expire.sql deleted file mode 100644 index 80fa099aa261..000000000000 --- a/util/Migrator/DbScripts/2022-11-29_00_ApiKey_Never_Expire.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE [dbo].[ApiKey] ALTER COLUMN [ExpireAt] DATETIME2(7) NULL; diff --git a/util/Migrator/DbScripts/2023-01-06_00_SecretsManager.sql b/util/Migrator/DbScripts/2023-01-06_00_SecretsManager.sql new file mode 100644 index 000000000000..6a178e37525e --- /dev/null +++ b/util/Migrator/DbScripts/2023-01-06_00_SecretsManager.sql @@ -0,0 +1,807 @@ +IF COL_LENGTH('[dbo].[Organization]', 'UseSecretsManager') IS NULL +BEGIN + ALTER TABLE + [dbo].[Organization] + ADD + [UseSecretsManager] BIT NOT NULL CONSTRAINT [DF_Organization_UseSecretsManager] DEFAULT (0) +END +GO + +CREATE OR ALTER VIEW [dbo].[OrganizationUserOrganizationDetailsView] +AS +SELECT + OU.[UserId], + OU.[OrganizationId], + O.[Name], + O.[Enabled], + O.[PlanType], + O.[UsePolicies], + O.[UseSso], + O.[UseKeyConnector], + O.[UseScim], + O.[UseGroups], + O.[UseDirectory], + O.[UseEvents], + O.[UseTotp], + O.[Use2fa], + O.[UseApi], + O.[UseResetPassword], + O.[SelfHost], + O.[UsersGetPremium], + O.[UseCustomPermissions], + O.[UseSecretsManager], + O.[Seats], + O.[MaxCollections], + O.[MaxStorageGb], + O.[Identifier], + OU.[Key], + OU.[ResetPasswordKey], + O.[PublicKey], + O.[PrivateKey], + OU.[Status], + OU.[Type], + SU.[ExternalId] SsoExternalId, + OU.[Permissions], + PO.[ProviderId], + P.[Name] ProviderName, + SS.[Data] SsoConfig, + OS.[FriendlyName] FamilySponsorshipFriendlyName, + OS.[LastSyncDate] FamilySponsorshipLastSyncDate, + OS.[ToDelete] FamilySponsorshipToDelete, + OS.[ValidUntil] FamilySponsorshipValidUntil +FROM + [dbo].[OrganizationUser] OU +LEFT JOIN + [dbo].[Organization] O ON O.[Id] = OU.[OrganizationId] +LEFT JOIN + [dbo].[SsoUser] SU ON SU.[UserId] = OU.[UserId] AND SU.[OrganizationId] = OU.[OrganizationId] +LEFT JOIN + [dbo].[ProviderOrganization] PO ON PO.[OrganizationId] = O.[Id] +LEFT JOIN + [dbo].[Provider] P ON P.[Id] = PO.[ProviderId] +LEFT JOIN + [dbo].[SsoConfig] SS ON SS.[OrganizationId] = OU.[OrganizationId] +LEFT JOIN + [dbo].[OrganizationSponsorship] OS ON OS.[SponsoringOrganizationUserID] = OU.[Id] +GO + +CREATE OR ALTER PROCEDURE [dbo].[Organization_Create] + @Id UNIQUEIDENTIFIER OUTPUT, + @Identifier NVARCHAR(50), + @Name NVARCHAR(50), + @BusinessName NVARCHAR(50), + @BusinessAddress1 NVARCHAR(50), + @BusinessAddress2 NVARCHAR(50), + @BusinessAddress3 NVARCHAR(50), + @BusinessCountry VARCHAR(2), + @BusinessTaxNumber NVARCHAR(30), + @BillingEmail NVARCHAR(256), + @Plan NVARCHAR(50), + @PlanType TINYINT, + @Seats INT, + @MaxCollections SMALLINT, + @UsePolicies BIT, + @UseSso BIT, + @UseGroups BIT, + @UseDirectory BIT, + @UseEvents BIT, + @UseTotp BIT, + @Use2fa BIT, + @UseApi BIT, + @UseResetPassword BIT, + @SelfHost BIT, + @UsersGetPremium BIT, + @Storage BIGINT, + @MaxStorageGb SMALLINT, + @Gateway TINYINT, + @GatewayCustomerId VARCHAR(50), + @GatewaySubscriptionId VARCHAR(50), + @ReferenceData VARCHAR(MAX), + @Enabled BIT, + @LicenseKey VARCHAR(100), + @PublicKey VARCHAR(MAX), + @PrivateKey VARCHAR(MAX), + @TwoFactorProviders NVARCHAR(MAX), + @ExpirationDate DATETIME2(7), + @CreationDate DATETIME2(7), + @RevisionDate DATETIME2(7), + @OwnersNotifiedOfAutoscaling DATETIME2(7), + @MaxAutoscaleSeats INT, + @UseKeyConnector BIT = 0, + @UseScim BIT = 0, + @UseCustomPermissions BIT = 0, + @UseSecretsManager BIT = 0 +AS +BEGIN + SET NOCOUNT ON + + INSERT INTO [dbo].[Organization] + ( + [Id], + [Identifier], + [Name], + [BusinessName], + [BusinessAddress1], + [BusinessAddress2], + [BusinessAddress3], + [BusinessCountry], + [BusinessTaxNumber], + [BillingEmail], + [Plan], + [PlanType], + [Seats], + [MaxCollections], + [UsePolicies], + [UseSso], + [UseGroups], + [UseDirectory], + [UseEvents], + [UseTotp], + [Use2fa], + [UseApi], + [UseResetPassword], + [SelfHost], + [UsersGetPremium], + [Storage], + [MaxStorageGb], + [Gateway], + [GatewayCustomerId], + [GatewaySubscriptionId], + [ReferenceData], + [Enabled], + [LicenseKey], + [PublicKey], + [PrivateKey], + [TwoFactorProviders], + [ExpirationDate], + [CreationDate], + [RevisionDate], + [OwnersNotifiedOfAutoscaling], + [MaxAutoscaleSeats], + [UseKeyConnector], + [UseScim], + [UseCustomPermissions], + [UseSecretsManager] + ) + VALUES + ( + @Id, + @Identifier, + @Name, + @BusinessName, + @BusinessAddress1, + @BusinessAddress2, + @BusinessAddress3, + @BusinessCountry, + @BusinessTaxNumber, + @BillingEmail, + @Plan, + @PlanType, + @Seats, + @MaxCollections, + @UsePolicies, + @UseSso, + @UseGroups, + @UseDirectory, + @UseEvents, + @UseTotp, + @Use2fa, + @UseApi, + @UseResetPassword, + @SelfHost, + @UsersGetPremium, + @Storage, + @MaxStorageGb, + @Gateway, + @GatewayCustomerId, + @GatewaySubscriptionId, + @ReferenceData, + @Enabled, + @LicenseKey, + @PublicKey, + @PrivateKey, + @TwoFactorProviders, + @ExpirationDate, + @CreationDate, + @RevisionDate, + @OwnersNotifiedOfAutoscaling, + @MaxAutoscaleSeats, + @UseKeyConnector, + @UseScim, + @UseCustomPermissions, + @UseSecretsManager + ) +END +GO + +CREATE OR ALTER PROCEDURE [dbo].[Organization_Update] + @Id UNIQUEIDENTIFIER, + @Identifier NVARCHAR(50), + @Name NVARCHAR(50), + @BusinessName NVARCHAR(50), + @BusinessAddress1 NVARCHAR(50), + @BusinessAddress2 NVARCHAR(50), + @BusinessAddress3 NVARCHAR(50), + @BusinessCountry VARCHAR(2), + @BusinessTaxNumber NVARCHAR(30), + @BillingEmail NVARCHAR(256), + @Plan NVARCHAR(50), + @PlanType TINYINT, + @Seats INT, + @MaxCollections SMALLINT, + @UsePolicies BIT, + @UseSso BIT, + @UseGroups BIT, + @UseDirectory BIT, + @UseEvents BIT, + @UseTotp BIT, + @Use2fa BIT, + @UseApi BIT, + @UseResetPassword BIT, + @SelfHost BIT, + @UsersGetPremium BIT, + @Storage BIGINT, + @MaxStorageGb SMALLINT, + @Gateway TINYINT, + @GatewayCustomerId VARCHAR(50), + @GatewaySubscriptionId VARCHAR(50), + @ReferenceData VARCHAR(MAX), + @Enabled BIT, + @LicenseKey VARCHAR(100), + @PublicKey VARCHAR(MAX), + @PrivateKey VARCHAR(MAX), + @TwoFactorProviders NVARCHAR(MAX), + @ExpirationDate DATETIME2(7), + @CreationDate DATETIME2(7), + @RevisionDate DATETIME2(7), + @OwnersNotifiedOfAutoscaling DATETIME2(7), + @MaxAutoscaleSeats INT, + @UseKeyConnector BIT = 0, + @UseScim BIT = 0, + @UseCustomPermissions BIT = 0, + @UseSecretsManager BIT = 0 +AS +BEGIN + SET NOCOUNT ON + + UPDATE + [dbo].[Organization] + SET + [Identifier] = @Identifier, + [Name] = @Name, + [BusinessName] = @BusinessName, + [BusinessAddress1] = @BusinessAddress1, + [BusinessAddress2] = @BusinessAddress2, + [BusinessAddress3] = @BusinessAddress3, + [BusinessCountry] = @BusinessCountry, + [BusinessTaxNumber] = @BusinessTaxNumber, + [BillingEmail] = @BillingEmail, + [Plan] = @Plan, + [PlanType] = @PlanType, + [Seats] = @Seats, + [MaxCollections] = @MaxCollections, + [UsePolicies] = @UsePolicies, + [UseSso] = @UseSso, + [UseGroups] = @UseGroups, + [UseDirectory] = @UseDirectory, + [UseEvents] = @UseEvents, + [UseTotp] = @UseTotp, + [Use2fa] = @Use2fa, + [UseApi] = @UseApi, + [UseResetPassword] = @UseResetPassword, + [SelfHost] = @SelfHost, + [UsersGetPremium] = @UsersGetPremium, + [Storage] = @Storage, + [MaxStorageGb] = @MaxStorageGb, + [Gateway] = @Gateway, + [GatewayCustomerId] = @GatewayCustomerId, + [GatewaySubscriptionId] = @GatewaySubscriptionId, + [ReferenceData] = @ReferenceData, + [Enabled] = @Enabled, + [LicenseKey] = @LicenseKey, + [PublicKey] = @PublicKey, + [PrivateKey] = @PrivateKey, + [TwoFactorProviders] = @TwoFactorProviders, + [ExpirationDate] = @ExpirationDate, + [CreationDate] = @CreationDate, + [RevisionDate] = @RevisionDate, + [OwnersNotifiedOfAutoscaling] = @OwnersNotifiedOfAutoscaling, + [MaxAutoscaleSeats] = @MaxAutoscaleSeats, + [UseKeyConnector] = @UseKeyConnector, + [UseScim] = @UseScim, + [UseCustomPermissions] = @UseCustomPermissions, + [UseSecretsManager] = @UseSecretsManager + WHERE + [Id] = @Id +END +GO + +IF OBJECT_ID('[dbo].[Secret]') IS NULL +BEGIN + CREATE TABLE [dbo].[Secret] + ( + [Id] UNIQUEIDENTIFIER NOT NULL, + [OrganizationId] UNIQUEIDENTIFIER NOT NULL, + [Key] NVARCHAR(MAX) NULL, + [Value] NVARCHAR(MAX) NULL, + [Note] NVARCHAR(MAX) NULL, + [CreationDate] DATETIME2(7) NOT NULL, + [RevisionDate] DATETIME2(7) NOT NULL, + [DeletedDate] DATETIME2(7) NULL, + CONSTRAINT [PK_Secret] PRIMARY KEY CLUSTERED ([Id] ASC), + CONSTRAINT [FK_Secret_OrganizationId] FOREIGN KEY ([OrganizationId]) REFERENCES [dbo].[Organization]([Id]) + ); + + CREATE NONCLUSTERED INDEX [IX_Secret_OrganizationId] ON [dbo].[Secret] ([OrganizationId] ASC); + + CREATE NONCLUSTERED INDEX [IX_Secret_DeletedDate] ON [dbo].[Secret] ([DeletedDate] ASC); +END +GO + +IF OBJECT_ID('[dbo].[Project]') IS NULL +BEGIN + CREATE TABLE [dbo].[Project] ( + [Id] UNIQUEIDENTIFIER NOT NULL, + [OrganizationId] UNIQUEIDENTIFIER NOT NULL, + [Name] NVARCHAR(MAX) NULL, + [CreationDate] DATETIME2 (7), + [RevisionDate] DATETIME2 (7), + [DeletedDate] DATETIME2 (7) NULL, + CONSTRAINT [PK_Project] PRIMARY KEY CLUSTERED ([Id] ASC), + CONSTRAINT [FK_Project_Organization] FOREIGN KEY ([OrganizationId]) REFERENCES [dbo].[Organization] ([Id]) + ); + + CREATE NONCLUSTERED INDEX [IX_Project_OrganizationId] ON [dbo].[Project] ([OrganizationId] ASC); + + CREATE NONCLUSTERED INDEX [IX_Project_DeletedDate] ON [dbo].[Project] ([DeletedDate] ASC); +END +GO + +IF OBJECT_ID('[dbo].[ProjectSecret]') IS NULL +BEGIN + CREATE TABLE [dbo].[ProjectSecret] ( + [ProjectsId] uniqueidentifier NOT NULL, + [SecretsId] uniqueidentifier NOT NULL, + CONSTRAINT [PK_ProjectSecret] PRIMARY KEY ([ProjectsId], [SecretsId]), + CONSTRAINT [FK_ProjectSecret_Project_ProjectsId] FOREIGN KEY ([ProjectsId]) REFERENCES [Project] ([Id]) ON DELETE CASCADE, + CONSTRAINT [FK_ProjectSecret_Secret_SecretsId] FOREIGN KEY ([SecretsId]) REFERENCES [Secret] ([Id]) ON DELETE CASCADE + ); + + CREATE NONCLUSTERED INDEX [IX_ProjectSecret_SecretsId] ON [ProjectSecret] ([SecretsId]); +END +GO + +IF OBJECT_ID('[dbo].[ServiceAccount]') IS NULL +BEGIN + CREATE TABLE [dbo].[ServiceAccount] + ( + [Id] UNIQUEIDENTIFIER NOT NULL, + [OrganizationId] UNIQUEIDENTIFIER NOT NULL, + [Name] NVARCHAR(MAX) NULL, + [CreationDate] DATETIME2(7) NOT NULL, + [RevisionDate] DATETIME2(7) NOT NULL, + CONSTRAINT [PK_ServiceAccount] PRIMARY KEY CLUSTERED ([Id] ASC), + CONSTRAINT [FK_ServiceAccount_OrganizationId] FOREIGN KEY ([OrganizationId]) REFERENCES [dbo].[Organization]([Id]) + ); + + CREATE NONCLUSTERED INDEX [IX_ServiceAccount_OrganizationId] ON [dbo].[ServiceAccount] ([OrganizationId] ASC); +END +GO + +IF OBJECT_ID('[dbo].[ApiKey]') IS NULL +BEGIN + CREATE TABLE [dbo].[ApiKey] ( + [Id] UNIQUEIDENTIFIER, + [ServiceAccountId] UNIQUEIDENTIFIER NULL, + [Name] VARCHAR(200) NOT NULL, + [ClientSecret] VARCHAR(30) NOT NULL, + [Scope] NVARCHAR (4000) NOT NULL, + [EncryptedPayload] NVARCHAR (4000) NOT NULL, + [Key] VARCHAR (MAX) NOT NULL, + [ExpireAt] DATETIME2(7) NULL, + [CreationDate] DATETIME2(7) NOT NULL, + [RevisionDate] DATETIME2(7) NOT NULL, + CONSTRAINT [PK_ApiKey] PRIMARY KEY CLUSTERED ([Id] ASC), + CONSTRAINT [FK_ApiKey_ServiceAccountId] FOREIGN KEY ([ServiceAccountId]) REFERENCES [dbo].[ServiceAccount] ([Id]) + ); + + CREATE NONCLUSTERED INDEX [IX_ApiKey_ServiceAccountId] + ON [dbo].[ApiKey]([ServiceAccountId] ASC); +END +GO + +CREATE OR ALTER VIEW [dbo].[ApiKeyDetailsView] +AS +SELECT + AK.*, + SA.[OrganizationId] ServiceAccountOrganizationId +FROM + [dbo].[ApiKey] AS AK +LEFT JOIN + [dbo].[ServiceAccount] SA ON SA.[Id] = AK.[ServiceAccountId] +GO + +CREATE OR ALTER VIEW [dbo].[ApiKeyView] +AS +SELECT + * +FROM + [dbo].[ApiKey] +GO + +CREATE OR ALTER PROCEDURE [dbo].[ApiKey_Create] + @Id UNIQUEIDENTIFIER OUTPUT, + @ServiceAccountId UNIQUEIDENTIFIER, + @Name VARCHAR(200), + @ClientSecret VARCHAR(30), + @Scope NVARCHAR(4000), + @EncryptedPayload NVARCHAR(4000), + @Key VARCHAR(MAX), + @ExpireAt DATETIME2(7), + @CreationDate DATETIME2(7), + @RevisionDate DATETIME2(7) +AS +BEGIN + SET NOCOUNT ON + + INSERT INTO [dbo].[ApiKey] + ( + [Id], + [ServiceAccountId], + [Name], + [ClientSecret], + [Scope], + [EncryptedPayload], + [Key], + [ExpireAt], + [CreationDate], + [RevisionDate] + ) + VALUES + ( + @Id, + @ServiceAccountId, + @Name, + @ClientSecret, + @Scope, + @EncryptedPayload, + @Key, + @ExpireAt, + @CreationDate, + @RevisionDate + ) +END +GO + +CREATE OR ALTER PROCEDURE [dbo].[ApiKey_ReadByServiceAccountId] + @ServiceAccountId UNIQUEIDENTIFIER +AS +BEGIN + SET NOCOUNT ON + + SELECT + * + FROM + [dbo].[ApiKeyView] + WHERE + [ServiceAccountId] = @ServiceAccountId +END +GO + +CREATE OR ALTER PROCEDURE [dbo].[ApiKeyDetails_ReadById] + @Id UNIQUEIDENTIFIER +AS +BEGIN + SET NOCOUNT ON + + SELECT + * + FROM + [dbo].[ApiKeyDetailsView] + WHERE + [Id] = @Id +END +GO + +IF OBJECT_ID('[dbo].[AccessPolicy]') IS NULL +BEGIN + CREATE TABLE [AccessPolicy] ( + [Id] UNIQUEIDENTIFIER NOT NULL, + [Discriminator] NVARCHAR(50) NOT NULL, + [OrganizationUserId] UNIQUEIDENTIFIER NULL, + [GroupId] UNIQUEIDENTIFIER NULL, + [ServiceAccountId] UNIQUEIDENTIFIER NULL, + [GrantedProjectId] UNIQUEIDENTIFIER NULL, + [GrantedServiceAccountId] UNIQUEIDENTIFIER NULL, + [Read] BIT NOT NULL, + [Write] BIT NOT NULL, + [CreationDate] DATETIME2 NOT NULL, + [RevisionDate] DATETIME2 NOT NULL, + CONSTRAINT [PK_AccessPolicy] PRIMARY KEY CLUSTERED ([Id]), + CONSTRAINT [FK_AccessPolicy_Group_GroupId] FOREIGN KEY ([GroupId]) REFERENCES [Group] ([Id]) ON DELETE CASCADE, + CONSTRAINT [FK_AccessPolicy_OrganizationUser_OrganizationUserId] FOREIGN KEY ([OrganizationUserId]) REFERENCES [OrganizationUser] ([Id]), + CONSTRAINT [FK_AccessPolicy_Project_GrantedProjectId] FOREIGN KEY ([GrantedProjectId]) REFERENCES [Project] ([Id]) ON DELETE CASCADE, + CONSTRAINT [FK_AccessPolicy_ServiceAccount_GrantedServiceAccountId] FOREIGN KEY ([GrantedServiceAccountId]) REFERENCES [ServiceAccount] ([Id]), + CONSTRAINT [FK_AccessPolicy_ServiceAccount_ServiceAccountId] FOREIGN KEY ([ServiceAccountId]) REFERENCES [ServiceAccount] ([Id]) + ); + + CREATE NONCLUSTERED INDEX [IX_AccessPolicy_GroupId] ON [AccessPolicy] ([GroupId]); + + CREATE NONCLUSTERED INDEX [IX_AccessPolicy_OrganizationUserId] ON [AccessPolicy] ([OrganizationUserId]); + + CREATE NONCLUSTERED INDEX [IX_AccessPolicy_GrantedProjectId] ON [AccessPolicy] ([GrantedProjectId]); + + CREATE NONCLUSTERED INDEX [IX_AccessPolicy_ServiceAccountId] ON [AccessPolicy] ([ServiceAccountId]); + + CREATE NONCLUSTERED INDEX [IX_AccessPolicy_GrantedServiceAccountId] ON [AccessPolicy] ([GrantedServiceAccountId]); +END +GO + +CREATE OR ALTER PROCEDURE [dbo].[User_DeleteById] + @Id UNIQUEIDENTIFIER +WITH RECOMPILE +AS +BEGIN + SET NOCOUNT ON + DECLARE @BatchSize INT = 100 + + -- Delete ciphers + WHILE @BatchSize > 0 + BEGIN + BEGIN TRANSACTION User_DeleteById_Ciphers + + DELETE TOP(@BatchSize) + FROM + [dbo].[Cipher] + WHERE + [UserId] = @Id + + SET @BatchSize = @@ROWCOUNT + + COMMIT TRANSACTION User_DeleteById_Ciphers + END + + BEGIN TRANSACTION User_DeleteById + + -- Delete folders + DELETE + FROM + [dbo].[Folder] + WHERE + [UserId] = @Id + + -- Delete devices + DELETE + FROM + [dbo].[Device] + WHERE + [UserId] = @Id + + -- Delete collection users + DELETE + CU + FROM + [dbo].[CollectionUser] CU + INNER JOIN + [dbo].[OrganizationUser] OU ON OU.[Id] = CU.[OrganizationUserId] + WHERE + OU.[UserId] = @Id + + -- Delete group users + DELETE + GU + FROM + [dbo].[GroupUser] GU + INNER JOIN + [dbo].[OrganizationUser] OU ON OU.[Id] = GU.[OrganizationUserId] + WHERE + OU.[UserId] = @Id + + -- Delete AccessPolicy + DELETE + AP + FROM + [dbo].[AccessPolicy] AP + INNER JOIN + [dbo].[OrganizationUser] OU ON OU.[Id] = AP.[OrganizationUserId] + WHERE + [UserId] = @Id + + -- Delete organization users + DELETE + FROM + [dbo].[OrganizationUser] + WHERE + [UserId] = @Id + + -- Delete provider users + DELETE + FROM + [dbo].[ProviderUser] + WHERE + [UserId] = @Id + + -- Delete SSO Users + DELETE + FROM + [dbo].[SsoUser] + WHERE + [UserId] = @Id + + -- Delete Emergency Accesses + DELETE + FROM + [dbo].[EmergencyAccess] + WHERE + [GrantorId] = @Id + OR + [GranteeId] = @Id + + -- Delete Sends + DELETE + FROM + [dbo].[Send] + WHERE + [UserId] = @Id + + -- Finally, delete the user + DELETE + FROM + [dbo].[User] + WHERE + [Id] = @Id + + COMMIT TRANSACTION User_DeleteById +END +GO + +CREATE OR ALTER PROCEDURE [dbo].[Organization_DeleteById] + @Id UNIQUEIDENTIFIER +AS +BEGIN + SET NOCOUNT ON + + EXEC [dbo].[User_BumpAccountRevisionDateByOrganizationId] @Id + + DECLARE @BatchSize INT = 100 + WHILE @BatchSize > 0 + BEGIN + BEGIN TRANSACTION Organization_DeleteById_Ciphers + + DELETE TOP(@BatchSize) + FROM + [dbo].[Cipher] + WHERE + [UserId] IS NULL + AND [OrganizationId] = @Id + + SET @BatchSize = @@ROWCOUNT + + COMMIT TRANSACTION Organization_DeleteById_Ciphers + END + + BEGIN TRANSACTION Organization_DeleteById + + DELETE + FROM + [dbo].[SsoUser] + WHERE + [OrganizationId] = @Id + + DELETE + FROM + [dbo].[SsoConfig] + WHERE + [OrganizationId] = @Id + + DELETE CU + FROM + [dbo].[CollectionUser] CU + INNER JOIN + [dbo].[OrganizationUser] OU ON [CU].[OrganizationUserId] = [OU].[Id] + WHERE + [OU].[OrganizationId] = @Id + + DELETE + FROM + [dbo].[OrganizationUser] + WHERE + [OrganizationId] = @Id + + DELETE + FROM + [dbo].[ProviderOrganization] + WHERE + [OrganizationId] = @Id + + EXEC [dbo].[OrganizationApiKey_OrganizationDeleted] @Id + EXEC [dbo].[OrganizationConnection_OrganizationDeleted] @Id + EXEC [dbo].[OrganizationSponsorship_OrganizationDeleted] @Id + + DELETE + FROM + [dbo].[Project] + WHERE + [OrganizationId] = @Id + + DELETE + FROM + [dbo].[Secret] + WHERE + [OrganizationId] = @Id + + DELETE AK + FROM + [dbo].[ApiKey] AK + INNER JOIN + [dbo].[ServiceAccount] SA ON [AK].[ServiceAccountId] = [SA].[Id] + WHERE + [SA].[OrganizationId] = @Id + + DELETE + FROM + [dbo].[ServiceAccount] + WHERE + [OrganizationId] = @Id + + DELETE + FROM + [dbo].[Organization] + WHERE + [Id] = @Id + + COMMIT TRANSACTION Organization_DeleteById +END +GO + +CREATE OR ALTER PROCEDURE [dbo].[OrganizationUser_DeleteById] + @Id UNIQUEIDENTIFIER +AS +BEGIN + SET NOCOUNT ON + + EXEC [dbo].[User_BumpAccountRevisionDateByOrganizationUserId] @Id + + DECLARE @OrganizationId UNIQUEIDENTIFIER + DECLARE @UserId UNIQUEIDENTIFIER + + SELECT + @OrganizationId = [OrganizationId], + @UserId = [UserId] + FROM + [dbo].[OrganizationUser] + WHERE + [Id] = @Id + + IF @OrganizationId IS NOT NULL AND @UserId IS NOT NULL + BEGIN + EXEC [dbo].[SsoUser_Delete] @UserId, @OrganizationId + END + + DELETE + FROM + [dbo].[CollectionUser] + WHERE + [OrganizationUserId] = @Id + + DELETE + FROM + [dbo].[GroupUser] + WHERE + [OrganizationUserId] = @Id + + DELETE + FROM + [dbo].[AccessPolicy] + WHERE + [OrganizationUserId] = @Id + + EXEC [dbo].[OrganizationSponsorship_OrganizationUserDeleted] @Id + + DELETE + FROM + [dbo].[OrganizationUser] + WHERE + [Id] = @Id +END +GO diff --git a/util/MySqlMigrations/Migrations/20220720222516_CreateSecretTable.Designer.cs b/util/MySqlMigrations/Migrations/20220720222516_CreateSecretTable.Designer.cs deleted file mode 100644 index cce26bfa366e..000000000000 --- a/util/MySqlMigrations/Migrations/20220720222516_CreateSecretTable.Designer.cs +++ /dev/null @@ -1,1643 +0,0 @@ -// -using System; -using Bit.Infrastructure.EntityFramework.Repositories; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace Bit.MySqlMigrations.Migrations -{ - [DbContext(typeof(DatabaseContext))] - [Migration("20220720222516_CreateSecretTable")] - partial class CreateSecretTable - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "6.0.4") - .HasAnnotation("Relational:MaxIdentifierLength", 64); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Cipher", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("Attachments") - .HasColumnType("longtext"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Data") - .HasColumnType("longtext"); - - b.Property("DeletedDate") - .HasColumnType("datetime(6)"); - - b.Property("Favorites") - .HasColumnType("longtext"); - - b.Property("Folders") - .HasColumnType("longtext"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("Reprompt") - .HasColumnType("tinyint unsigned"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Type") - .HasColumnType("tinyint unsigned"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("UserId"); - - b.ToTable("Cipher", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Collection", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("ExternalId") - .HasMaxLength(300) - .HasColumnType("varchar(300)"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.ToTable("Collection", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionCipher", b => - { - b.Property("CollectionId") - .HasColumnType("char(36)"); - - b.Property("CipherId") - .HasColumnType("char(36)"); - - b.HasKey("CollectionId", "CipherId"); - - b.HasIndex("CipherId"); - - b.ToTable("CollectionCipher", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionGroup", b => - { - b.Property("CollectionId") - .HasColumnType("char(36)"); - - b.Property("GroupId") - .HasColumnType("char(36)"); - - b.Property("HidePasswords") - .HasColumnType("tinyint(1)"); - - b.Property("ReadOnly") - .HasColumnType("tinyint(1)"); - - b.HasKey("CollectionId", "GroupId"); - - b.HasIndex("GroupId"); - - b.ToTable("CollectionGroups"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionUser", b => - { - b.Property("CollectionId") - .HasColumnType("char(36)"); - - b.Property("OrganizationUserId") - .HasColumnType("char(36)"); - - b.Property("HidePasswords") - .HasColumnType("tinyint(1)"); - - b.Property("ReadOnly") - .HasColumnType("tinyint(1)"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("CollectionId", "OrganizationUserId"); - - b.HasIndex("OrganizationUserId"); - - b.HasIndex("UserId"); - - b.ToTable("CollectionUsers"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Device", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Identifier") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("Name") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("PushToken") - .HasMaxLength(255) - .HasColumnType("varchar(255)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Type") - .HasColumnType("tinyint unsigned"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Device", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.EmergencyAccess", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("GranteeId") - .HasColumnType("char(36)"); - - b.Property("GrantorId") - .HasColumnType("char(36)"); - - b.Property("KeyEncrypted") - .HasColumnType("longtext"); - - b.Property("LastNotificationDate") - .HasColumnType("datetime(6)"); - - b.Property("RecoveryInitiatedDate") - .HasColumnType("datetime(6)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Status") - .HasColumnType("tinyint unsigned"); - - b.Property("Type") - .HasColumnType("tinyint unsigned"); - - b.Property("WaitTimeDays") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("GranteeId"); - - b.HasIndex("GrantorId"); - - b.ToTable("EmergencyAccess", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Event", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("ActingUserId") - .HasColumnType("char(36)"); - - b.Property("CipherId") - .HasColumnType("char(36)"); - - b.Property("CollectionId") - .HasColumnType("char(36)"); - - b.Property("Date") - .HasColumnType("datetime(6)"); - - b.Property("DeviceType") - .HasColumnType("tinyint unsigned"); - - b.Property("GroupId") - .HasColumnType("char(36)"); - - b.Property("InstallationId") - .HasColumnType("char(36)"); - - b.Property("IpAddress") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("OrganizationUserId") - .HasColumnType("char(36)"); - - b.Property("PolicyId") - .HasColumnType("char(36)"); - - b.Property("ProviderId") - .HasColumnType("char(36)"); - - b.Property("ProviderOrganizationId") - .HasColumnType("char(36)"); - - b.Property("ProviderUserId") - .HasColumnType("char(36)"); - - b.Property("Type") - .HasColumnType("int"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("Event", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Folder", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Folder", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Grant", b => - { - b.Property("Key") - .HasMaxLength(200) - .HasColumnType("varchar(200)"); - - b.Property("ClientId") - .HasMaxLength(200) - .HasColumnType("varchar(200)"); - - b.Property("ConsumedDate") - .HasColumnType("datetime(6)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Data") - .HasColumnType("longtext"); - - b.Property("Description") - .HasMaxLength(200) - .HasColumnType("varchar(200)"); - - b.Property("ExpirationDate") - .HasColumnType("datetime(6)"); - - b.Property("SessionId") - .HasMaxLength(100) - .HasColumnType("varchar(100)"); - - b.Property("SubjectId") - .HasMaxLength(200) - .HasColumnType("varchar(200)"); - - b.Property("Type") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.HasKey("Key"); - - b.ToTable("Grant", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Group", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("AccessAll") - .HasColumnType("tinyint(1)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("ExternalId") - .HasMaxLength(300) - .HasColumnType("varchar(300)"); - - b.Property("Name") - .HasMaxLength(100) - .HasColumnType("varchar(100)"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.ToTable("Group", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.GroupUser", b => - { - b.Property("GroupId") - .HasColumnType("char(36)"); - - b.Property("OrganizationUserId") - .HasColumnType("char(36)"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("GroupId", "OrganizationUserId"); - - b.HasIndex("OrganizationUserId"); - - b.HasIndex("UserId"); - - b.ToTable("GroupUser", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Installation", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("Enabled") - .HasColumnType("tinyint(1)"); - - b.Property("Key") - .HasMaxLength(150) - .HasColumnType("varchar(150)"); - - b.HasKey("Id"); - - b.ToTable("Installation", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Organization", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("BillingEmail") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("BusinessAddress1") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("BusinessAddress2") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("BusinessAddress3") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("BusinessCountry") - .HasMaxLength(2) - .HasColumnType("varchar(2)"); - - b.Property("BusinessName") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("BusinessTaxNumber") - .HasMaxLength(30) - .HasColumnType("varchar(30)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Enabled") - .HasColumnType("tinyint(1)"); - - b.Property("ExpirationDate") - .HasColumnType("datetime(6)"); - - b.Property("Gateway") - .HasColumnType("tinyint unsigned"); - - b.Property("GatewayCustomerId") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("GatewaySubscriptionId") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("Identifier") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("LicenseKey") - .HasMaxLength(100) - .HasColumnType("varchar(100)"); - - b.Property("MaxAutoscaleSeats") - .HasColumnType("int"); - - b.Property("MaxCollections") - .HasColumnType("smallint"); - - b.Property("MaxStorageGb") - .HasColumnType("smallint"); - - b.Property("Name") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("OwnersNotifiedOfAutoscaling") - .HasColumnType("datetime(6)"); - - b.Property("Plan") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("PlanType") - .HasColumnType("tinyint unsigned"); - - b.Property("PrivateKey") - .HasColumnType("longtext"); - - b.Property("PublicKey") - .HasColumnType("longtext"); - - b.Property("ReferenceData") - .HasColumnType("longtext"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Seats") - .HasColumnType("int"); - - b.Property("SelfHost") - .HasColumnType("tinyint(1)"); - - b.Property("Storage") - .HasColumnType("bigint"); - - b.Property("TwoFactorProviders") - .HasColumnType("longtext"); - - b.Property("Use2fa") - .HasColumnType("tinyint(1)"); - - b.Property("UseApi") - .HasColumnType("tinyint(1)"); - - b.Property("UseDirectory") - .HasColumnType("tinyint(1)"); - - b.Property("UseEvents") - .HasColumnType("tinyint(1)"); - - b.Property("UseGroups") - .HasColumnType("tinyint(1)"); - - b.Property("UseKeyConnector") - .HasColumnType("tinyint(1)"); - - b.Property("UsePolicies") - .HasColumnType("tinyint(1)"); - - b.Property("UseResetPassword") - .HasColumnType("tinyint(1)"); - - b.Property("UseScim") - .HasColumnType("tinyint(1)"); - - b.Property("UseSso") - .HasColumnType("tinyint(1)"); - - b.Property("UseTotp") - .HasColumnType("tinyint(1)"); - - b.Property("UsersGetPremium") - .HasColumnType("tinyint(1)"); - - b.HasKey("Id"); - - b.ToTable("Organization", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationApiKey", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("ApiKey") - .HasMaxLength(30) - .HasColumnType("varchar(30)"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Type") - .HasColumnType("tinyint unsigned"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.ToTable("OrganizationApiKey", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationConnection", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("Config") - .HasColumnType("longtext"); - - b.Property("Enabled") - .HasColumnType("tinyint(1)"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("Type") - .HasColumnType("tinyint unsigned"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.ToTable("OrganizationConnection", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationSponsorship", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("FriendlyName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("LastSyncDate") - .HasColumnType("datetime(6)"); - - b.Property("OfferedToEmail") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("PlanSponsorshipType") - .HasColumnType("tinyint unsigned"); - - b.Property("SponsoredOrganizationId") - .HasColumnType("char(36)"); - - b.Property("SponsoringOrganizationId") - .HasColumnType("char(36)"); - - b.Property("SponsoringOrganizationUserId") - .HasColumnType("char(36)"); - - b.Property("ToDelete") - .HasColumnType("tinyint(1)"); - - b.Property("ValidUntil") - .HasColumnType("datetime(6)"); - - b.HasKey("Id"); - - b.HasIndex("SponsoredOrganizationId"); - - b.HasIndex("SponsoringOrganizationId"); - - b.ToTable("OrganizationSponsorship", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("AccessAll") - .HasColumnType("tinyint(1)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("ExternalId") - .HasMaxLength(300) - .HasColumnType("varchar(300)"); - - b.Property("Key") - .HasColumnType("longtext"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("Permissions") - .HasColumnType("longtext"); - - b.Property("ResetPasswordKey") - .HasColumnType("longtext"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Status") - .HasColumnType("smallint"); - - b.Property("Type") - .HasColumnType("tinyint unsigned"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("UserId"); - - b.ToTable("OrganizationUser", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Policy", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Data") - .HasColumnType("longtext"); - - b.Property("Enabled") - .HasColumnType("tinyint(1)"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Type") - .HasColumnType("tinyint unsigned"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.ToTable("Policy", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Provider", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("BillingEmail") - .HasColumnType("longtext"); - - b.Property("BusinessAddress1") - .HasColumnType("longtext"); - - b.Property("BusinessAddress2") - .HasColumnType("longtext"); - - b.Property("BusinessAddress3") - .HasColumnType("longtext"); - - b.Property("BusinessCountry") - .HasColumnType("longtext"); - - b.Property("BusinessName") - .HasColumnType("longtext"); - - b.Property("BusinessTaxNumber") - .HasColumnType("longtext"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Enabled") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Status") - .HasColumnType("tinyint unsigned"); - - b.Property("UseEvents") - .HasColumnType("tinyint(1)"); - - b.HasKey("Id"); - - b.ToTable("Provider", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ProviderOrganization", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Key") - .HasColumnType("longtext"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("ProviderId") - .HasColumnType("char(36)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Settings") - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("ProviderId"); - - b.ToTable("ProviderOrganization", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ProviderUser", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Email") - .HasColumnType("longtext"); - - b.Property("Key") - .HasColumnType("longtext"); - - b.Property("Permissions") - .HasColumnType("longtext"); - - b.Property("ProviderId") - .HasColumnType("char(36)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Status") - .HasColumnType("tinyint unsigned"); - - b.Property("Type") - .HasColumnType("tinyint unsigned"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ProviderId"); - - b.HasIndex("UserId"); - - b.ToTable("ProviderUser", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Secret", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("DeletedDate") - .HasColumnType("datetime(6)"); - - b.Property("Key") - .HasColumnType("longtext"); - - b.Property("Note") - .HasColumnType("longtext"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Value") - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.HasIndex("DeletedDate") - .HasAnnotation("SqlServer:Clustered", false); - - b.HasIndex("OrganizationId"); - - b.ToTable("Secret", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Send", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("AccessCount") - .HasColumnType("int"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Data") - .HasColumnType("longtext"); - - b.Property("DeletionDate") - .HasColumnType("datetime(6)"); - - b.Property("Disabled") - .HasColumnType("tinyint(1)"); - - b.Property("ExpirationDate") - .HasColumnType("datetime(6)"); - - b.Property("HideEmail") - .HasColumnType("tinyint(1)"); - - b.Property("Key") - .HasColumnType("longtext"); - - b.Property("MaxAccessCount") - .HasColumnType("int"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("Password") - .HasMaxLength(300) - .HasColumnType("varchar(300)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Type") - .HasColumnType("tinyint unsigned"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("UserId"); - - b.ToTable("Send", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.SsoConfig", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Data") - .HasColumnType("longtext"); - - b.Property("Enabled") - .HasColumnType("tinyint(1)"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.ToTable("SsoConfig", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.SsoUser", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("ExternalId") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("UserId"); - - b.ToTable("SsoUser", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.TaxRate", b => - { - b.Property("Id") - .HasMaxLength(40) - .HasColumnType("varchar(40)"); - - b.Property("Active") - .HasColumnType("tinyint(1)"); - - b.Property("Country") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("PostalCode") - .HasMaxLength(10) - .HasColumnType("varchar(10)"); - - b.Property("Rate") - .HasColumnType("decimal(65,30)"); - - b.Property("State") - .HasMaxLength(2) - .HasColumnType("varchar(2)"); - - b.HasKey("Id"); - - b.ToTable("TaxRate", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Transaction", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("Amount") - .HasColumnType("decimal(65,30)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Details") - .HasMaxLength(100) - .HasColumnType("varchar(100)"); - - b.Property("Gateway") - .HasColumnType("tinyint unsigned"); - - b.Property("GatewayId") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("PaymentMethodType") - .HasColumnType("tinyint unsigned"); - - b.Property("Refunded") - .HasColumnType("tinyint(1)"); - - b.Property("RefundedAmount") - .HasColumnType("decimal(65,30)"); - - b.Property("Type") - .HasColumnType("tinyint unsigned"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("UserId"); - - b.ToTable("Transaction", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.User", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("AccountRevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("ApiKey") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("varchar(30)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Culture") - .HasMaxLength(10) - .HasColumnType("varchar(10)"); - - b.Property("Email") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("EmailVerified") - .HasColumnType("tinyint(1)"); - - b.Property("EquivalentDomains") - .HasColumnType("longtext"); - - b.Property("ExcludedGlobalEquivalentDomains") - .HasColumnType("longtext"); - - b.Property("FailedLoginCount") - .HasColumnType("int"); - - b.Property("ForcePasswordReset") - .HasColumnType("tinyint(1)"); - - b.Property("Gateway") - .HasColumnType("tinyint unsigned"); - - b.Property("GatewayCustomerId") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("GatewaySubscriptionId") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("Kdf") - .HasColumnType("tinyint unsigned"); - - b.Property("KdfIterations") - .HasColumnType("int"); - - b.Property("Key") - .HasColumnType("longtext"); - - b.Property("LastFailedLoginDate") - .HasColumnType("datetime(6)"); - - b.Property("LicenseKey") - .HasMaxLength(100) - .HasColumnType("varchar(100)"); - - b.Property("MasterPassword") - .HasMaxLength(300) - .HasColumnType("varchar(300)"); - - b.Property("MasterPasswordHint") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("MaxStorageGb") - .HasColumnType("smallint"); - - b.Property("Name") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("Premium") - .HasColumnType("tinyint(1)"); - - b.Property("PremiumExpirationDate") - .HasColumnType("datetime(6)"); - - b.Property("PrivateKey") - .HasColumnType("longtext"); - - b.Property("PublicKey") - .HasColumnType("longtext"); - - b.Property("ReferenceData") - .HasColumnType("longtext"); - - b.Property("RenewalReminderDate") - .HasColumnType("datetime(6)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("SecurityStamp") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("Storage") - .HasColumnType("bigint"); - - b.Property("TwoFactorProviders") - .HasColumnType("longtext"); - - b.Property("TwoFactorRecoveryCode") - .HasMaxLength(32) - .HasColumnType("varchar(32)"); - - b.Property("UnknownDeviceVerificationEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("UsesKeyConnector") - .HasColumnType("tinyint(1)"); - - b.HasKey("Id"); - - b.ToTable("User", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Cipher", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("Ciphers") - .HasForeignKey("OrganizationId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany("Ciphers") - .HasForeignKey("UserId"); - - b.Navigation("Organization"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Collection", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany() - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionCipher", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Cipher", "Cipher") - .WithMany("CollectionCiphers") - .HasForeignKey("CipherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Collection", "Collection") - .WithMany("CollectionCiphers") - .HasForeignKey("CollectionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Cipher"); - - b.Navigation("Collection"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionGroup", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Collection", "Collection") - .WithMany("CollectionGroups") - .HasForeignKey("CollectionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Group", "Group") - .WithMany() - .HasForeignKey("GroupId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Collection"); - - b.Navigation("Group"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionUser", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Collection", "Collection") - .WithMany("CollectionUsers") - .HasForeignKey("CollectionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", "OrganizationUser") - .WithMany("CollectionUsers") - .HasForeignKey("OrganizationUserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", null) - .WithMany("CollectionUsers") - .HasForeignKey("UserId"); - - b.Navigation("Collection"); - - b.Navigation("OrganizationUser"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Device", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.EmergencyAccess", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "Grantee") - .WithMany() - .HasForeignKey("GranteeId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "Grantor") - .WithMany() - .HasForeignKey("GrantorId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Grantee"); - - b.Navigation("Grantor"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Folder", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany("Folders") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Group", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("Groups") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.GroupUser", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Group", "Group") - .WithMany("GroupUsers") - .HasForeignKey("GroupId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", "OrganizationUser") - .WithMany() - .HasForeignKey("OrganizationUserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", null) - .WithMany("GroupUsers") - .HasForeignKey("UserId"); - - b.Navigation("Group"); - - b.Navigation("OrganizationUser"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationApiKey", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("ApiKeys") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationConnection", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("Connections") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationSponsorship", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "SponsoredOrganization") - .WithMany() - .HasForeignKey("SponsoredOrganizationId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "SponsoringOrganization") - .WithMany() - .HasForeignKey("SponsoringOrganizationId"); - - b.Navigation("SponsoredOrganization"); - - b.Navigation("SponsoringOrganization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("OrganizationUsers") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany("OrganizationUsers") - .HasForeignKey("UserId"); - - b.Navigation("Organization"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Policy", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("Policies") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ProviderOrganization", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany() - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Provider", "Provider") - .WithMany() - .HasForeignKey("ProviderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - - b.Navigation("Provider"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ProviderUser", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Provider", "Provider") - .WithMany() - .HasForeignKey("ProviderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany() - .HasForeignKey("UserId"); - - b.Navigation("Provider"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Secret", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany() - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Send", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany() - .HasForeignKey("OrganizationId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany() - .HasForeignKey("UserId"); - - b.Navigation("Organization"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.SsoConfig", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("SsoConfigs") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.SsoUser", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("SsoUsers") - .HasForeignKey("OrganizationId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany("SsoUsers") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Transaction", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("Transactions") - .HasForeignKey("OrganizationId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany("Transactions") - .HasForeignKey("UserId"); - - b.Navigation("Organization"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Cipher", b => - { - b.Navigation("CollectionCiphers"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Collection", b => - { - b.Navigation("CollectionCiphers"); - - b.Navigation("CollectionGroups"); - - b.Navigation("CollectionUsers"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Group", b => - { - b.Navigation("GroupUsers"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Organization", b => - { - b.Navigation("ApiKeys"); - - b.Navigation("Ciphers"); - - b.Navigation("Connections"); - - b.Navigation("Groups"); - - b.Navigation("OrganizationUsers"); - - b.Navigation("Policies"); - - b.Navigation("SsoConfigs"); - - b.Navigation("SsoUsers"); - - b.Navigation("Transactions"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", b => - { - b.Navigation("CollectionUsers"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.User", b => - { - b.Navigation("Ciphers"); - - b.Navigation("CollectionUsers"); - - b.Navigation("Folders"); - - b.Navigation("GroupUsers"); - - b.Navigation("OrganizationUsers"); - - b.Navigation("SsoUsers"); - - b.Navigation("Transactions"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/util/MySqlMigrations/Migrations/20220720222516_CreateSecretTable.cs b/util/MySqlMigrations/Migrations/20220720222516_CreateSecretTable.cs deleted file mode 100644 index 105a07cc1bce..000000000000 --- a/util/MySqlMigrations/Migrations/20220720222516_CreateSecretTable.cs +++ /dev/null @@ -1,55 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Bit.MySqlMigrations.Migrations; - -public partial class CreateSecretTable : Migration -{ - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "Secret", - columns: table => new - { - Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), - OrganizationId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), - Key = table.Column(type: "longtext", nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), - Value = table.Column(type: "longtext", nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), - Note = table.Column(type: "longtext", nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), - CreationDate = table.Column(type: "datetime(6)", nullable: false), - RevisionDate = table.Column(type: "datetime(6)", nullable: false), - DeletedDate = table.Column(type: "datetime(6)", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Secret", x => x.Id); - table.ForeignKey( - name: "FK_Secret_Organization_OrganizationId", - column: x => x.OrganizationId, - principalTable: "Organization", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateIndex( - name: "IX_Secret_DeletedDate", - table: "Secret", - column: "DeletedDate"); - - migrationBuilder.CreateIndex( - name: "IX_Secret_OrganizationId", - table: "Secret", - column: "OrganizationId"); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "Secret"); - } -} diff --git a/util/MySqlMigrations/Migrations/20220830195738_CreateProjectTable.Designer.cs b/util/MySqlMigrations/Migrations/20220830195738_CreateProjectTable.Designer.cs deleted file mode 100644 index 793424be0c59..000000000000 --- a/util/MySqlMigrations/Migrations/20220830195738_CreateProjectTable.Designer.cs +++ /dev/null @@ -1,1688 +0,0 @@ -// -using System; -using Bit.Infrastructure.EntityFramework.Repositories; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace Bit.MySqlMigrations.Migrations -{ - [DbContext(typeof(DatabaseContext))] - [Migration("20220830195738_CreateProjectTable")] - partial class CreateProjectTable - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "6.0.4") - .HasAnnotation("Relational:MaxIdentifierLength", 64); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Cipher", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("Attachments") - .HasColumnType("longtext"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Data") - .HasColumnType("longtext"); - - b.Property("DeletedDate") - .HasColumnType("datetime(6)"); - - b.Property("Favorites") - .HasColumnType("longtext"); - - b.Property("Folders") - .HasColumnType("longtext"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("Reprompt") - .HasColumnType("tinyint unsigned"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Type") - .HasColumnType("tinyint unsigned"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("UserId"); - - b.ToTable("Cipher", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Collection", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("ExternalId") - .HasMaxLength(300) - .HasColumnType("varchar(300)"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.ToTable("Collection", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionCipher", b => - { - b.Property("CollectionId") - .HasColumnType("char(36)"); - - b.Property("CipherId") - .HasColumnType("char(36)"); - - b.HasKey("CollectionId", "CipherId"); - - b.HasIndex("CipherId"); - - b.ToTable("CollectionCipher", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionGroup", b => - { - b.Property("CollectionId") - .HasColumnType("char(36)"); - - b.Property("GroupId") - .HasColumnType("char(36)"); - - b.Property("HidePasswords") - .HasColumnType("tinyint(1)"); - - b.Property("ReadOnly") - .HasColumnType("tinyint(1)"); - - b.HasKey("CollectionId", "GroupId"); - - b.HasIndex("GroupId"); - - b.ToTable("CollectionGroups"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionUser", b => - { - b.Property("CollectionId") - .HasColumnType("char(36)"); - - b.Property("OrganizationUserId") - .HasColumnType("char(36)"); - - b.Property("HidePasswords") - .HasColumnType("tinyint(1)"); - - b.Property("ReadOnly") - .HasColumnType("tinyint(1)"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("CollectionId", "OrganizationUserId"); - - b.HasIndex("OrganizationUserId"); - - b.HasIndex("UserId"); - - b.ToTable("CollectionUsers"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Device", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Identifier") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("Name") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("PushToken") - .HasMaxLength(255) - .HasColumnType("varchar(255)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Type") - .HasColumnType("tinyint unsigned"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Device", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.EmergencyAccess", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("GranteeId") - .HasColumnType("char(36)"); - - b.Property("GrantorId") - .HasColumnType("char(36)"); - - b.Property("KeyEncrypted") - .HasColumnType("longtext"); - - b.Property("LastNotificationDate") - .HasColumnType("datetime(6)"); - - b.Property("RecoveryInitiatedDate") - .HasColumnType("datetime(6)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Status") - .HasColumnType("tinyint unsigned"); - - b.Property("Type") - .HasColumnType("tinyint unsigned"); - - b.Property("WaitTimeDays") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("GranteeId"); - - b.HasIndex("GrantorId"); - - b.ToTable("EmergencyAccess", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Event", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("ActingUserId") - .HasColumnType("char(36)"); - - b.Property("CipherId") - .HasColumnType("char(36)"); - - b.Property("CollectionId") - .HasColumnType("char(36)"); - - b.Property("Date") - .HasColumnType("datetime(6)"); - - b.Property("DeviceType") - .HasColumnType("tinyint unsigned"); - - b.Property("GroupId") - .HasColumnType("char(36)"); - - b.Property("InstallationId") - .HasColumnType("char(36)"); - - b.Property("IpAddress") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("OrganizationUserId") - .HasColumnType("char(36)"); - - b.Property("PolicyId") - .HasColumnType("char(36)"); - - b.Property("ProviderId") - .HasColumnType("char(36)"); - - b.Property("ProviderOrganizationId") - .HasColumnType("char(36)"); - - b.Property("ProviderUserId") - .HasColumnType("char(36)"); - - b.Property("Type") - .HasColumnType("int"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("Event", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Folder", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Folder", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Grant", b => - { - b.Property("Key") - .HasMaxLength(200) - .HasColumnType("varchar(200)"); - - b.Property("ClientId") - .HasMaxLength(200) - .HasColumnType("varchar(200)"); - - b.Property("ConsumedDate") - .HasColumnType("datetime(6)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Data") - .HasColumnType("longtext"); - - b.Property("Description") - .HasMaxLength(200) - .HasColumnType("varchar(200)"); - - b.Property("ExpirationDate") - .HasColumnType("datetime(6)"); - - b.Property("SessionId") - .HasMaxLength(100) - .HasColumnType("varchar(100)"); - - b.Property("SubjectId") - .HasMaxLength(200) - .HasColumnType("varchar(200)"); - - b.Property("Type") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.HasKey("Key"); - - b.ToTable("Grant", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Group", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("AccessAll") - .HasColumnType("tinyint(1)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("ExternalId") - .HasMaxLength(300) - .HasColumnType("varchar(300)"); - - b.Property("Name") - .HasMaxLength(100) - .HasColumnType("varchar(100)"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.ToTable("Group", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.GroupUser", b => - { - b.Property("GroupId") - .HasColumnType("char(36)"); - - b.Property("OrganizationUserId") - .HasColumnType("char(36)"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("GroupId", "OrganizationUserId"); - - b.HasIndex("OrganizationUserId"); - - b.HasIndex("UserId"); - - b.ToTable("GroupUser", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Installation", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("Enabled") - .HasColumnType("tinyint(1)"); - - b.Property("Key") - .HasMaxLength(150) - .HasColumnType("varchar(150)"); - - b.HasKey("Id"); - - b.ToTable("Installation", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Organization", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("BillingEmail") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("BusinessAddress1") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("BusinessAddress2") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("BusinessAddress3") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("BusinessCountry") - .HasMaxLength(2) - .HasColumnType("varchar(2)"); - - b.Property("BusinessName") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("BusinessTaxNumber") - .HasMaxLength(30) - .HasColumnType("varchar(30)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Enabled") - .HasColumnType("tinyint(1)"); - - b.Property("ExpirationDate") - .HasColumnType("datetime(6)"); - - b.Property("Gateway") - .HasColumnType("tinyint unsigned"); - - b.Property("GatewayCustomerId") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("GatewaySubscriptionId") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("Identifier") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("LicenseKey") - .HasMaxLength(100) - .HasColumnType("varchar(100)"); - - b.Property("MaxAutoscaleSeats") - .HasColumnType("int"); - - b.Property("MaxCollections") - .HasColumnType("smallint"); - - b.Property("MaxStorageGb") - .HasColumnType("smallint"); - - b.Property("Name") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("OwnersNotifiedOfAutoscaling") - .HasColumnType("datetime(6)"); - - b.Property("Plan") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("PlanType") - .HasColumnType("tinyint unsigned"); - - b.Property("PrivateKey") - .HasColumnType("longtext"); - - b.Property("PublicKey") - .HasColumnType("longtext"); - - b.Property("ReferenceData") - .HasColumnType("longtext"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Seats") - .HasColumnType("int"); - - b.Property("SelfHost") - .HasColumnType("tinyint(1)"); - - b.Property("Storage") - .HasColumnType("bigint"); - - b.Property("TwoFactorProviders") - .HasColumnType("longtext"); - - b.Property("Use2fa") - .HasColumnType("tinyint(1)"); - - b.Property("UseApi") - .HasColumnType("tinyint(1)"); - - b.Property("UseDirectory") - .HasColumnType("tinyint(1)"); - - b.Property("UseEvents") - .HasColumnType("tinyint(1)"); - - b.Property("UseGroups") - .HasColumnType("tinyint(1)"); - - b.Property("UseKeyConnector") - .HasColumnType("tinyint(1)"); - - b.Property("UsePolicies") - .HasColumnType("tinyint(1)"); - - b.Property("UseResetPassword") - .HasColumnType("tinyint(1)"); - - b.Property("UseScim") - .HasColumnType("tinyint(1)"); - - b.Property("UseSso") - .HasColumnType("tinyint(1)"); - - b.Property("UseTotp") - .HasColumnType("tinyint(1)"); - - b.Property("UsersGetPremium") - .HasColumnType("tinyint(1)"); - - b.HasKey("Id"); - - b.ToTable("Organization", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationApiKey", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("ApiKey") - .HasMaxLength(30) - .HasColumnType("varchar(30)"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Type") - .HasColumnType("tinyint unsigned"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.ToTable("OrganizationApiKey", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationConnection", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("Config") - .HasColumnType("longtext"); - - b.Property("Enabled") - .HasColumnType("tinyint(1)"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("Type") - .HasColumnType("tinyint unsigned"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.ToTable("OrganizationConnection", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationSponsorship", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("FriendlyName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("LastSyncDate") - .HasColumnType("datetime(6)"); - - b.Property("OfferedToEmail") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("PlanSponsorshipType") - .HasColumnType("tinyint unsigned"); - - b.Property("SponsoredOrganizationId") - .HasColumnType("char(36)"); - - b.Property("SponsoringOrganizationId") - .HasColumnType("char(36)"); - - b.Property("SponsoringOrganizationUserId") - .HasColumnType("char(36)"); - - b.Property("ToDelete") - .HasColumnType("tinyint(1)"); - - b.Property("ValidUntil") - .HasColumnType("datetime(6)"); - - b.HasKey("Id"); - - b.HasIndex("SponsoredOrganizationId"); - - b.HasIndex("SponsoringOrganizationId"); - - b.ToTable("OrganizationSponsorship", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("AccessAll") - .HasColumnType("tinyint(1)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("ExternalId") - .HasMaxLength(300) - .HasColumnType("varchar(300)"); - - b.Property("Key") - .HasColumnType("longtext"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("Permissions") - .HasColumnType("longtext"); - - b.Property("ResetPasswordKey") - .HasColumnType("longtext"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Status") - .HasColumnType("smallint"); - - b.Property("Type") - .HasColumnType("tinyint unsigned"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("UserId"); - - b.ToTable("OrganizationUser", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Policy", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Data") - .HasColumnType("longtext"); - - b.Property("Enabled") - .HasColumnType("tinyint(1)"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Type") - .HasColumnType("tinyint unsigned"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.ToTable("Policy", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Project", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("DeletedDate") - .HasColumnType("datetime(6)"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.HasKey("Id") - .HasAnnotation("SqlServer:Clustered", true); - - b.HasIndex("DeletedDate") - .HasAnnotation("SqlServer:Clustered", false); - - b.HasIndex("OrganizationId") - .HasAnnotation("SqlServer:Clustered", false); - - b.ToTable("Project", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Provider", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("BillingEmail") - .HasColumnType("longtext"); - - b.Property("BusinessAddress1") - .HasColumnType("longtext"); - - b.Property("BusinessAddress2") - .HasColumnType("longtext"); - - b.Property("BusinessAddress3") - .HasColumnType("longtext"); - - b.Property("BusinessCountry") - .HasColumnType("longtext"); - - b.Property("BusinessName") - .HasColumnType("longtext"); - - b.Property("BusinessTaxNumber") - .HasColumnType("longtext"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Enabled") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Status") - .HasColumnType("tinyint unsigned"); - - b.Property("UseEvents") - .HasColumnType("tinyint(1)"); - - b.HasKey("Id"); - - b.ToTable("Provider", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ProviderOrganization", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Key") - .HasColumnType("longtext"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("ProviderId") - .HasColumnType("char(36)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Settings") - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("ProviderId"); - - b.ToTable("ProviderOrganization", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ProviderUser", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Email") - .HasColumnType("longtext"); - - b.Property("Key") - .HasColumnType("longtext"); - - b.Property("Permissions") - .HasColumnType("longtext"); - - b.Property("ProviderId") - .HasColumnType("char(36)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Status") - .HasColumnType("tinyint unsigned"); - - b.Property("Type") - .HasColumnType("tinyint unsigned"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ProviderId"); - - b.HasIndex("UserId"); - - b.ToTable("ProviderUser", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Secret", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("DeletedDate") - .HasColumnType("datetime(6)"); - - b.Property("Key") - .HasColumnType("longtext"); - - b.Property("Note") - .HasColumnType("longtext"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Value") - .HasColumnType("longtext"); - - b.HasKey("Id") - .HasAnnotation("SqlServer:Clustered", true); - - b.HasIndex("DeletedDate") - .HasAnnotation("SqlServer:Clustered", false); - - b.HasIndex("OrganizationId") - .HasAnnotation("SqlServer:Clustered", false); - - b.ToTable("Secret", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Send", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("AccessCount") - .HasColumnType("int"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Data") - .HasColumnType("longtext"); - - b.Property("DeletionDate") - .HasColumnType("datetime(6)"); - - b.Property("Disabled") - .HasColumnType("tinyint(1)"); - - b.Property("ExpirationDate") - .HasColumnType("datetime(6)"); - - b.Property("HideEmail") - .HasColumnType("tinyint(1)"); - - b.Property("Key") - .HasColumnType("longtext"); - - b.Property("MaxAccessCount") - .HasColumnType("int"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("Password") - .HasMaxLength(300) - .HasColumnType("varchar(300)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Type") - .HasColumnType("tinyint unsigned"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("UserId"); - - b.ToTable("Send", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.SsoConfig", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Data") - .HasColumnType("longtext"); - - b.Property("Enabled") - .HasColumnType("tinyint(1)"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.ToTable("SsoConfig", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.SsoUser", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("ExternalId") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("UserId"); - - b.ToTable("SsoUser", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.TaxRate", b => - { - b.Property("Id") - .HasMaxLength(40) - .HasColumnType("varchar(40)"); - - b.Property("Active") - .HasColumnType("tinyint(1)"); - - b.Property("Country") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("PostalCode") - .HasMaxLength(10) - .HasColumnType("varchar(10)"); - - b.Property("Rate") - .HasColumnType("decimal(65,30)"); - - b.Property("State") - .HasMaxLength(2) - .HasColumnType("varchar(2)"); - - b.HasKey("Id"); - - b.ToTable("TaxRate", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Transaction", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("Amount") - .HasColumnType("decimal(65,30)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Details") - .HasMaxLength(100) - .HasColumnType("varchar(100)"); - - b.Property("Gateway") - .HasColumnType("tinyint unsigned"); - - b.Property("GatewayId") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("PaymentMethodType") - .HasColumnType("tinyint unsigned"); - - b.Property("Refunded") - .HasColumnType("tinyint(1)"); - - b.Property("RefundedAmount") - .HasColumnType("decimal(65,30)"); - - b.Property("Type") - .HasColumnType("tinyint unsigned"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("UserId"); - - b.ToTable("Transaction", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.User", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("AccountRevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("ApiKey") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("varchar(30)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Culture") - .HasMaxLength(10) - .HasColumnType("varchar(10)"); - - b.Property("Email") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("EmailVerified") - .HasColumnType("tinyint(1)"); - - b.Property("EquivalentDomains") - .HasColumnType("longtext"); - - b.Property("ExcludedGlobalEquivalentDomains") - .HasColumnType("longtext"); - - b.Property("FailedLoginCount") - .HasColumnType("int"); - - b.Property("ForcePasswordReset") - .HasColumnType("tinyint(1)"); - - b.Property("Gateway") - .HasColumnType("tinyint unsigned"); - - b.Property("GatewayCustomerId") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("GatewaySubscriptionId") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("Kdf") - .HasColumnType("tinyint unsigned"); - - b.Property("KdfIterations") - .HasColumnType("int"); - - b.Property("Key") - .HasColumnType("longtext"); - - b.Property("LastFailedLoginDate") - .HasColumnType("datetime(6)"); - - b.Property("LicenseKey") - .HasMaxLength(100) - .HasColumnType("varchar(100)"); - - b.Property("MasterPassword") - .HasMaxLength(300) - .HasColumnType("varchar(300)"); - - b.Property("MasterPasswordHint") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("MaxStorageGb") - .HasColumnType("smallint"); - - b.Property("Name") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("Premium") - .HasColumnType("tinyint(1)"); - - b.Property("PremiumExpirationDate") - .HasColumnType("datetime(6)"); - - b.Property("PrivateKey") - .HasColumnType("longtext"); - - b.Property("PublicKey") - .HasColumnType("longtext"); - - b.Property("ReferenceData") - .HasColumnType("longtext"); - - b.Property("RenewalReminderDate") - .HasColumnType("datetime(6)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("SecurityStamp") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("Storage") - .HasColumnType("bigint"); - - b.Property("TwoFactorProviders") - .HasColumnType("longtext"); - - b.Property("TwoFactorRecoveryCode") - .HasMaxLength(32) - .HasColumnType("varchar(32)"); - - b.Property("UnknownDeviceVerificationEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("UsesKeyConnector") - .HasColumnType("tinyint(1)"); - - b.HasKey("Id"); - - b.ToTable("User", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Cipher", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("Ciphers") - .HasForeignKey("OrganizationId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany("Ciphers") - .HasForeignKey("UserId"); - - b.Navigation("Organization"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Collection", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany() - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionCipher", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Cipher", "Cipher") - .WithMany("CollectionCiphers") - .HasForeignKey("CipherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Collection", "Collection") - .WithMany("CollectionCiphers") - .HasForeignKey("CollectionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Cipher"); - - b.Navigation("Collection"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionGroup", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Collection", "Collection") - .WithMany("CollectionGroups") - .HasForeignKey("CollectionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Group", "Group") - .WithMany() - .HasForeignKey("GroupId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Collection"); - - b.Navigation("Group"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionUser", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Collection", "Collection") - .WithMany("CollectionUsers") - .HasForeignKey("CollectionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", "OrganizationUser") - .WithMany("CollectionUsers") - .HasForeignKey("OrganizationUserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", null) - .WithMany("CollectionUsers") - .HasForeignKey("UserId"); - - b.Navigation("Collection"); - - b.Navigation("OrganizationUser"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Device", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.EmergencyAccess", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "Grantee") - .WithMany() - .HasForeignKey("GranteeId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "Grantor") - .WithMany() - .HasForeignKey("GrantorId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Grantee"); - - b.Navigation("Grantor"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Folder", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany("Folders") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Group", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("Groups") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.GroupUser", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Group", "Group") - .WithMany("GroupUsers") - .HasForeignKey("GroupId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", "OrganizationUser") - .WithMany() - .HasForeignKey("OrganizationUserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", null) - .WithMany("GroupUsers") - .HasForeignKey("UserId"); - - b.Navigation("Group"); - - b.Navigation("OrganizationUser"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationApiKey", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("ApiKeys") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationConnection", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("Connections") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationSponsorship", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "SponsoredOrganization") - .WithMany() - .HasForeignKey("SponsoredOrganizationId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "SponsoringOrganization") - .WithMany() - .HasForeignKey("SponsoringOrganizationId"); - - b.Navigation("SponsoredOrganization"); - - b.Navigation("SponsoringOrganization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("OrganizationUsers") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany("OrganizationUsers") - .HasForeignKey("UserId"); - - b.Navigation("Organization"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Policy", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("Policies") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Project", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany() - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ProviderOrganization", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany() - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Provider", "Provider") - .WithMany() - .HasForeignKey("ProviderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - - b.Navigation("Provider"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ProviderUser", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Provider", "Provider") - .WithMany() - .HasForeignKey("ProviderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany() - .HasForeignKey("UserId"); - - b.Navigation("Provider"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Secret", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany() - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Send", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany() - .HasForeignKey("OrganizationId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany() - .HasForeignKey("UserId"); - - b.Navigation("Organization"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.SsoConfig", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("SsoConfigs") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.SsoUser", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("SsoUsers") - .HasForeignKey("OrganizationId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany("SsoUsers") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Transaction", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("Transactions") - .HasForeignKey("OrganizationId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany("Transactions") - .HasForeignKey("UserId"); - - b.Navigation("Organization"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Cipher", b => - { - b.Navigation("CollectionCiphers"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Collection", b => - { - b.Navigation("CollectionCiphers"); - - b.Navigation("CollectionGroups"); - - b.Navigation("CollectionUsers"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Group", b => - { - b.Navigation("GroupUsers"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Organization", b => - { - b.Navigation("ApiKeys"); - - b.Navigation("Ciphers"); - - b.Navigation("Connections"); - - b.Navigation("Groups"); - - b.Navigation("OrganizationUsers"); - - b.Navigation("Policies"); - - b.Navigation("SsoConfigs"); - - b.Navigation("SsoUsers"); - - b.Navigation("Transactions"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", b => - { - b.Navigation("CollectionUsers"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.User", b => - { - b.Navigation("Ciphers"); - - b.Navigation("CollectionUsers"); - - b.Navigation("Folders"); - - b.Navigation("GroupUsers"); - - b.Navigation("OrganizationUsers"); - - b.Navigation("SsoUsers"); - - b.Navigation("Transactions"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/util/MySqlMigrations/Migrations/20220830195738_CreateProjectTable.cs b/util/MySqlMigrations/Migrations/20220830195738_CreateProjectTable.cs deleted file mode 100644 index ae928c2907b8..000000000000 --- a/util/MySqlMigrations/Migrations/20220830195738_CreateProjectTable.cs +++ /dev/null @@ -1,51 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Bit.MySqlMigrations.Migrations; - -public partial class CreateProjectTable : Migration -{ - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "Project", - columns: table => new - { - Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), - OrganizationId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), - Name = table.Column(type: "longtext", nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), - CreationDate = table.Column(type: "datetime(6)", nullable: false), - RevisionDate = table.Column(type: "datetime(6)", nullable: false), - DeletedDate = table.Column(type: "datetime(6)", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Project", x => x.Id); - table.ForeignKey( - name: "FK_Project_Organization_OrganizationId", - column: x => x.OrganizationId, - principalTable: "Organization", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateIndex( - name: "IX_Project_DeletedDate", - table: "Project", - column: "DeletedDate"); - - migrationBuilder.CreateIndex( - name: "IX_Project_OrganizationId", - table: "Project", - column: "OrganizationId"); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "Project"); - } -} diff --git a/util/MySqlMigrations/Migrations/20220926191322_SmServiceAccount.Designer.cs b/util/MySqlMigrations/Migrations/20220926191322_SmServiceAccount.Designer.cs deleted file mode 100644 index 86a2242f5d08..000000000000 --- a/util/MySqlMigrations/Migrations/20220926191322_SmServiceAccount.Designer.cs +++ /dev/null @@ -1,1725 +0,0 @@ -// -using System; -using Bit.Infrastructure.EntityFramework.Repositories; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace Bit.MySqlMigrations.Migrations -{ - [DbContext(typeof(DatabaseContext))] - [Migration("20220926191322_SmServiceAccount")] - partial class SmServiceAccount - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "6.0.4") - .HasAnnotation("Relational:MaxIdentifierLength", 64); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Cipher", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("Attachments") - .HasColumnType("longtext"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Data") - .HasColumnType("longtext"); - - b.Property("DeletedDate") - .HasColumnType("datetime(6)"); - - b.Property("Favorites") - .HasColumnType("longtext"); - - b.Property("Folders") - .HasColumnType("longtext"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("Reprompt") - .HasColumnType("tinyint unsigned"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Type") - .HasColumnType("tinyint unsigned"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("UserId"); - - b.ToTable("Cipher", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Collection", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("ExternalId") - .HasMaxLength(300) - .HasColumnType("varchar(300)"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.ToTable("Collection", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionCipher", b => - { - b.Property("CollectionId") - .HasColumnType("char(36)"); - - b.Property("CipherId") - .HasColumnType("char(36)"); - - b.HasKey("CollectionId", "CipherId"); - - b.HasIndex("CipherId"); - - b.ToTable("CollectionCipher", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionGroup", b => - { - b.Property("CollectionId") - .HasColumnType("char(36)"); - - b.Property("GroupId") - .HasColumnType("char(36)"); - - b.Property("HidePasswords") - .HasColumnType("tinyint(1)"); - - b.Property("ReadOnly") - .HasColumnType("tinyint(1)"); - - b.HasKey("CollectionId", "GroupId"); - - b.HasIndex("GroupId"); - - b.ToTable("CollectionGroups"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionUser", b => - { - b.Property("CollectionId") - .HasColumnType("char(36)"); - - b.Property("OrganizationUserId") - .HasColumnType("char(36)"); - - b.Property("HidePasswords") - .HasColumnType("tinyint(1)"); - - b.Property("ReadOnly") - .HasColumnType("tinyint(1)"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("CollectionId", "OrganizationUserId"); - - b.HasIndex("OrganizationUserId"); - - b.HasIndex("UserId"); - - b.ToTable("CollectionUsers"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Device", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Identifier") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("Name") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("PushToken") - .HasMaxLength(255) - .HasColumnType("varchar(255)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Type") - .HasColumnType("tinyint unsigned"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Device", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.EmergencyAccess", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("GranteeId") - .HasColumnType("char(36)"); - - b.Property("GrantorId") - .HasColumnType("char(36)"); - - b.Property("KeyEncrypted") - .HasColumnType("longtext"); - - b.Property("LastNotificationDate") - .HasColumnType("datetime(6)"); - - b.Property("RecoveryInitiatedDate") - .HasColumnType("datetime(6)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Status") - .HasColumnType("tinyint unsigned"); - - b.Property("Type") - .HasColumnType("tinyint unsigned"); - - b.Property("WaitTimeDays") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("GranteeId"); - - b.HasIndex("GrantorId"); - - b.ToTable("EmergencyAccess", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Event", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("ActingUserId") - .HasColumnType("char(36)"); - - b.Property("CipherId") - .HasColumnType("char(36)"); - - b.Property("CollectionId") - .HasColumnType("char(36)"); - - b.Property("Date") - .HasColumnType("datetime(6)"); - - b.Property("DeviceType") - .HasColumnType("tinyint unsigned"); - - b.Property("GroupId") - .HasColumnType("char(36)"); - - b.Property("InstallationId") - .HasColumnType("char(36)"); - - b.Property("IpAddress") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("OrganizationUserId") - .HasColumnType("char(36)"); - - b.Property("PolicyId") - .HasColumnType("char(36)"); - - b.Property("ProviderId") - .HasColumnType("char(36)"); - - b.Property("ProviderOrganizationId") - .HasColumnType("char(36)"); - - b.Property("ProviderUserId") - .HasColumnType("char(36)"); - - b.Property("Type") - .HasColumnType("int"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("Event", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Folder", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Folder", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Grant", b => - { - b.Property("Key") - .HasMaxLength(200) - .HasColumnType("varchar(200)"); - - b.Property("ClientId") - .HasMaxLength(200) - .HasColumnType("varchar(200)"); - - b.Property("ConsumedDate") - .HasColumnType("datetime(6)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Data") - .HasColumnType("longtext"); - - b.Property("Description") - .HasMaxLength(200) - .HasColumnType("varchar(200)"); - - b.Property("ExpirationDate") - .HasColumnType("datetime(6)"); - - b.Property("SessionId") - .HasMaxLength(100) - .HasColumnType("varchar(100)"); - - b.Property("SubjectId") - .HasMaxLength(200) - .HasColumnType("varchar(200)"); - - b.Property("Type") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.HasKey("Key"); - - b.ToTable("Grant", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Group", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("AccessAll") - .HasColumnType("tinyint(1)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("ExternalId") - .HasMaxLength(300) - .HasColumnType("varchar(300)"); - - b.Property("Name") - .HasMaxLength(100) - .HasColumnType("varchar(100)"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.ToTable("Group", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.GroupUser", b => - { - b.Property("GroupId") - .HasColumnType("char(36)"); - - b.Property("OrganizationUserId") - .HasColumnType("char(36)"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("GroupId", "OrganizationUserId"); - - b.HasIndex("OrganizationUserId"); - - b.HasIndex("UserId"); - - b.ToTable("GroupUser", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Installation", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("Enabled") - .HasColumnType("tinyint(1)"); - - b.Property("Key") - .HasMaxLength(150) - .HasColumnType("varchar(150)"); - - b.HasKey("Id"); - - b.ToTable("Installation", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Organization", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("BillingEmail") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("BusinessAddress1") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("BusinessAddress2") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("BusinessAddress3") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("BusinessCountry") - .HasMaxLength(2) - .HasColumnType("varchar(2)"); - - b.Property("BusinessName") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("BusinessTaxNumber") - .HasMaxLength(30) - .HasColumnType("varchar(30)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Enabled") - .HasColumnType("tinyint(1)"); - - b.Property("ExpirationDate") - .HasColumnType("datetime(6)"); - - b.Property("Gateway") - .HasColumnType("tinyint unsigned"); - - b.Property("GatewayCustomerId") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("GatewaySubscriptionId") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("Identifier") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("LicenseKey") - .HasMaxLength(100) - .HasColumnType("varchar(100)"); - - b.Property("MaxAutoscaleSeats") - .HasColumnType("int"); - - b.Property("MaxCollections") - .HasColumnType("smallint"); - - b.Property("MaxStorageGb") - .HasColumnType("smallint"); - - b.Property("Name") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("OwnersNotifiedOfAutoscaling") - .HasColumnType("datetime(6)"); - - b.Property("Plan") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("PlanType") - .HasColumnType("tinyint unsigned"); - - b.Property("PrivateKey") - .HasColumnType("longtext"); - - b.Property("PublicKey") - .HasColumnType("longtext"); - - b.Property("ReferenceData") - .HasColumnType("longtext"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Seats") - .HasColumnType("int"); - - b.Property("SelfHost") - .HasColumnType("tinyint(1)"); - - b.Property("Storage") - .HasColumnType("bigint"); - - b.Property("TwoFactorProviders") - .HasColumnType("longtext"); - - b.Property("Use2fa") - .HasColumnType("tinyint(1)"); - - b.Property("UseApi") - .HasColumnType("tinyint(1)"); - - b.Property("UseDirectory") - .HasColumnType("tinyint(1)"); - - b.Property("UseEvents") - .HasColumnType("tinyint(1)"); - - b.Property("UseGroups") - .HasColumnType("tinyint(1)"); - - b.Property("UseKeyConnector") - .HasColumnType("tinyint(1)"); - - b.Property("UsePolicies") - .HasColumnType("tinyint(1)"); - - b.Property("UseResetPassword") - .HasColumnType("tinyint(1)"); - - b.Property("UseScim") - .HasColumnType("tinyint(1)"); - - b.Property("UseSso") - .HasColumnType("tinyint(1)"); - - b.Property("UseTotp") - .HasColumnType("tinyint(1)"); - - b.Property("UsersGetPremium") - .HasColumnType("tinyint(1)"); - - b.HasKey("Id"); - - b.ToTable("Organization", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationApiKey", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("ApiKey") - .HasMaxLength(30) - .HasColumnType("varchar(30)"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Type") - .HasColumnType("tinyint unsigned"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.ToTable("OrganizationApiKey", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationConnection", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("Config") - .HasColumnType("longtext"); - - b.Property("Enabled") - .HasColumnType("tinyint(1)"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("Type") - .HasColumnType("tinyint unsigned"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.ToTable("OrganizationConnection", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationSponsorship", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("FriendlyName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("LastSyncDate") - .HasColumnType("datetime(6)"); - - b.Property("OfferedToEmail") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("PlanSponsorshipType") - .HasColumnType("tinyint unsigned"); - - b.Property("SponsoredOrganizationId") - .HasColumnType("char(36)"); - - b.Property("SponsoringOrganizationId") - .HasColumnType("char(36)"); - - b.Property("SponsoringOrganizationUserId") - .HasColumnType("char(36)"); - - b.Property("ToDelete") - .HasColumnType("tinyint(1)"); - - b.Property("ValidUntil") - .HasColumnType("datetime(6)"); - - b.HasKey("Id"); - - b.HasIndex("SponsoredOrganizationId"); - - b.HasIndex("SponsoringOrganizationId"); - - b.ToTable("OrganizationSponsorship", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("AccessAll") - .HasColumnType("tinyint(1)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("ExternalId") - .HasMaxLength(300) - .HasColumnType("varchar(300)"); - - b.Property("Key") - .HasColumnType("longtext"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("Permissions") - .HasColumnType("longtext"); - - b.Property("ResetPasswordKey") - .HasColumnType("longtext"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Status") - .HasColumnType("smallint"); - - b.Property("Type") - .HasColumnType("tinyint unsigned"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("UserId"); - - b.ToTable("OrganizationUser", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Policy", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Data") - .HasColumnType("longtext"); - - b.Property("Enabled") - .HasColumnType("tinyint(1)"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Type") - .HasColumnType("tinyint unsigned"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.ToTable("Policy", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Project", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("DeletedDate") - .HasColumnType("datetime(6)"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.HasKey("Id") - .HasAnnotation("SqlServer:Clustered", true); - - b.HasIndex("DeletedDate") - .HasAnnotation("SqlServer:Clustered", false); - - b.HasIndex("OrganizationId") - .HasAnnotation("SqlServer:Clustered", false); - - b.ToTable("Project", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Provider", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("BillingEmail") - .HasColumnType("longtext"); - - b.Property("BusinessAddress1") - .HasColumnType("longtext"); - - b.Property("BusinessAddress2") - .HasColumnType("longtext"); - - b.Property("BusinessAddress3") - .HasColumnType("longtext"); - - b.Property("BusinessCountry") - .HasColumnType("longtext"); - - b.Property("BusinessName") - .HasColumnType("longtext"); - - b.Property("BusinessTaxNumber") - .HasColumnType("longtext"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Enabled") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Status") - .HasColumnType("tinyint unsigned"); - - b.Property("UseEvents") - .HasColumnType("tinyint(1)"); - - b.HasKey("Id"); - - b.ToTable("Provider", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ProviderOrganization", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Key") - .HasColumnType("longtext"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("ProviderId") - .HasColumnType("char(36)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Settings") - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("ProviderId"); - - b.ToTable("ProviderOrganization", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ProviderUser", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Email") - .HasColumnType("longtext"); - - b.Property("Key") - .HasColumnType("longtext"); - - b.Property("Permissions") - .HasColumnType("longtext"); - - b.Property("ProviderId") - .HasColumnType("char(36)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Status") - .HasColumnType("tinyint unsigned"); - - b.Property("Type") - .HasColumnType("tinyint unsigned"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ProviderId"); - - b.HasIndex("UserId"); - - b.ToTable("ProviderUser", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Secret", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("DeletedDate") - .HasColumnType("datetime(6)"); - - b.Property("Key") - .HasColumnType("longtext"); - - b.Property("Note") - .HasColumnType("longtext"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Value") - .HasColumnType("longtext"); - - b.HasKey("Id") - .HasAnnotation("SqlServer:Clustered", true); - - b.HasIndex("DeletedDate") - .HasAnnotation("SqlServer:Clustered", false); - - b.HasIndex("OrganizationId") - .HasAnnotation("SqlServer:Clustered", false); - - b.ToTable("Secret", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Send", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("AccessCount") - .HasColumnType("int"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Data") - .HasColumnType("longtext"); - - b.Property("DeletionDate") - .HasColumnType("datetime(6)"); - - b.Property("Disabled") - .HasColumnType("tinyint(1)"); - - b.Property("ExpirationDate") - .HasColumnType("datetime(6)"); - - b.Property("HideEmail") - .HasColumnType("tinyint(1)"); - - b.Property("Key") - .HasColumnType("longtext"); - - b.Property("MaxAccessCount") - .HasColumnType("int"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("Password") - .HasMaxLength(300) - .HasColumnType("varchar(300)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Type") - .HasColumnType("tinyint unsigned"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("UserId"); - - b.ToTable("Send", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ServiceAccount", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.HasKey("Id") - .HasAnnotation("SqlServer:Clustered", true); - - b.HasIndex("OrganizationId") - .HasAnnotation("SqlServer:Clustered", false); - - b.ToTable("ServiceAccount", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.SsoConfig", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Data") - .HasColumnType("longtext"); - - b.Property("Enabled") - .HasColumnType("tinyint(1)"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.ToTable("SsoConfig", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.SsoUser", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("ExternalId") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("UserId"); - - b.ToTable("SsoUser", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.TaxRate", b => - { - b.Property("Id") - .HasMaxLength(40) - .HasColumnType("varchar(40)"); - - b.Property("Active") - .HasColumnType("tinyint(1)"); - - b.Property("Country") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("PostalCode") - .HasMaxLength(10) - .HasColumnType("varchar(10)"); - - b.Property("Rate") - .HasColumnType("decimal(65,30)"); - - b.Property("State") - .HasMaxLength(2) - .HasColumnType("varchar(2)"); - - b.HasKey("Id"); - - b.ToTable("TaxRate", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Transaction", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("Amount") - .HasColumnType("decimal(65,30)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Details") - .HasMaxLength(100) - .HasColumnType("varchar(100)"); - - b.Property("Gateway") - .HasColumnType("tinyint unsigned"); - - b.Property("GatewayId") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("PaymentMethodType") - .HasColumnType("tinyint unsigned"); - - b.Property("Refunded") - .HasColumnType("tinyint(1)"); - - b.Property("RefundedAmount") - .HasColumnType("decimal(65,30)"); - - b.Property("Type") - .HasColumnType("tinyint unsigned"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("UserId"); - - b.ToTable("Transaction", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.User", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("AccountRevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("ApiKey") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("varchar(30)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Culture") - .HasMaxLength(10) - .HasColumnType("varchar(10)"); - - b.Property("Email") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("EmailVerified") - .HasColumnType("tinyint(1)"); - - b.Property("EquivalentDomains") - .HasColumnType("longtext"); - - b.Property("ExcludedGlobalEquivalentDomains") - .HasColumnType("longtext"); - - b.Property("FailedLoginCount") - .HasColumnType("int"); - - b.Property("ForcePasswordReset") - .HasColumnType("tinyint(1)"); - - b.Property("Gateway") - .HasColumnType("tinyint unsigned"); - - b.Property("GatewayCustomerId") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("GatewaySubscriptionId") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("Kdf") - .HasColumnType("tinyint unsigned"); - - b.Property("KdfIterations") - .HasColumnType("int"); - - b.Property("Key") - .HasColumnType("longtext"); - - b.Property("LastFailedLoginDate") - .HasColumnType("datetime(6)"); - - b.Property("LicenseKey") - .HasMaxLength(100) - .HasColumnType("varchar(100)"); - - b.Property("MasterPassword") - .HasMaxLength(300) - .HasColumnType("varchar(300)"); - - b.Property("MasterPasswordHint") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("MaxStorageGb") - .HasColumnType("smallint"); - - b.Property("Name") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("Premium") - .HasColumnType("tinyint(1)"); - - b.Property("PremiumExpirationDate") - .HasColumnType("datetime(6)"); - - b.Property("PrivateKey") - .HasColumnType("longtext"); - - b.Property("PublicKey") - .HasColumnType("longtext"); - - b.Property("ReferenceData") - .HasColumnType("longtext"); - - b.Property("RenewalReminderDate") - .HasColumnType("datetime(6)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("SecurityStamp") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("Storage") - .HasColumnType("bigint"); - - b.Property("TwoFactorProviders") - .HasColumnType("longtext"); - - b.Property("TwoFactorRecoveryCode") - .HasMaxLength(32) - .HasColumnType("varchar(32)"); - - b.Property("UnknownDeviceVerificationEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("UsesKeyConnector") - .HasColumnType("tinyint(1)"); - - b.HasKey("Id"); - - b.ToTable("User", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Cipher", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("Ciphers") - .HasForeignKey("OrganizationId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany("Ciphers") - .HasForeignKey("UserId"); - - b.Navigation("Organization"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Collection", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany() - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionCipher", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Cipher", "Cipher") - .WithMany("CollectionCiphers") - .HasForeignKey("CipherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Collection", "Collection") - .WithMany("CollectionCiphers") - .HasForeignKey("CollectionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Cipher"); - - b.Navigation("Collection"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionGroup", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Collection", "Collection") - .WithMany("CollectionGroups") - .HasForeignKey("CollectionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Group", "Group") - .WithMany() - .HasForeignKey("GroupId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Collection"); - - b.Navigation("Group"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionUser", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Collection", "Collection") - .WithMany("CollectionUsers") - .HasForeignKey("CollectionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", "OrganizationUser") - .WithMany("CollectionUsers") - .HasForeignKey("OrganizationUserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", null) - .WithMany("CollectionUsers") - .HasForeignKey("UserId"); - - b.Navigation("Collection"); - - b.Navigation("OrganizationUser"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Device", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.EmergencyAccess", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "Grantee") - .WithMany() - .HasForeignKey("GranteeId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "Grantor") - .WithMany() - .HasForeignKey("GrantorId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Grantee"); - - b.Navigation("Grantor"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Folder", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany("Folders") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Group", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("Groups") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.GroupUser", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Group", "Group") - .WithMany("GroupUsers") - .HasForeignKey("GroupId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", "OrganizationUser") - .WithMany() - .HasForeignKey("OrganizationUserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", null) - .WithMany("GroupUsers") - .HasForeignKey("UserId"); - - b.Navigation("Group"); - - b.Navigation("OrganizationUser"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationApiKey", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("ApiKeys") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationConnection", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("Connections") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationSponsorship", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "SponsoredOrganization") - .WithMany() - .HasForeignKey("SponsoredOrganizationId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "SponsoringOrganization") - .WithMany() - .HasForeignKey("SponsoringOrganizationId"); - - b.Navigation("SponsoredOrganization"); - - b.Navigation("SponsoringOrganization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("OrganizationUsers") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany("OrganizationUsers") - .HasForeignKey("UserId"); - - b.Navigation("Organization"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Policy", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("Policies") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Project", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany() - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ProviderOrganization", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany() - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Provider", "Provider") - .WithMany() - .HasForeignKey("ProviderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - - b.Navigation("Provider"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ProviderUser", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Provider", "Provider") - .WithMany() - .HasForeignKey("ProviderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany() - .HasForeignKey("UserId"); - - b.Navigation("Provider"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Secret", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany() - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Send", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany() - .HasForeignKey("OrganizationId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany() - .HasForeignKey("UserId"); - - b.Navigation("Organization"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ServiceAccount", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany() - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.SsoConfig", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("SsoConfigs") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.SsoUser", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("SsoUsers") - .HasForeignKey("OrganizationId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany("SsoUsers") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Transaction", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("Transactions") - .HasForeignKey("OrganizationId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany("Transactions") - .HasForeignKey("UserId"); - - b.Navigation("Organization"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Cipher", b => - { - b.Navigation("CollectionCiphers"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Collection", b => - { - b.Navigation("CollectionCiphers"); - - b.Navigation("CollectionGroups"); - - b.Navigation("CollectionUsers"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Group", b => - { - b.Navigation("GroupUsers"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Organization", b => - { - b.Navigation("ApiKeys"); - - b.Navigation("Ciphers"); - - b.Navigation("Connections"); - - b.Navigation("Groups"); - - b.Navigation("OrganizationUsers"); - - b.Navigation("Policies"); - - b.Navigation("SsoConfigs"); - - b.Navigation("SsoUsers"); - - b.Navigation("Transactions"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", b => - { - b.Navigation("CollectionUsers"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.User", b => - { - b.Navigation("Ciphers"); - - b.Navigation("CollectionUsers"); - - b.Navigation("Folders"); - - b.Navigation("GroupUsers"); - - b.Navigation("OrganizationUsers"); - - b.Navigation("SsoUsers"); - - b.Navigation("Transactions"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/util/MySqlMigrations/Migrations/20220926191322_SmServiceAccount.cs b/util/MySqlMigrations/Migrations/20220926191322_SmServiceAccount.cs deleted file mode 100644 index ad6aec03492a..000000000000 --- a/util/MySqlMigrations/Migrations/20220926191322_SmServiceAccount.cs +++ /dev/null @@ -1,45 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Bit.MySqlMigrations.Migrations; - -public partial class SmServiceAccount : Migration -{ - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "ServiceAccount", - columns: table => new - { - Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), - OrganizationId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), - Name = table.Column(type: "longtext", nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), - CreationDate = table.Column(type: "datetime(6)", nullable: false), - RevisionDate = table.Column(type: "datetime(6)", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ServiceAccount", x => x.Id); - table.ForeignKey( - name: "FK_ServiceAccount_Organization_OrganizationId", - column: x => x.OrganizationId, - principalTable: "Organization", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateIndex( - name: "IX_ServiceAccount_OrganizationId", - table: "ServiceAccount", - column: "OrganizationId"); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "ServiceAccount"); - } -} diff --git a/util/MySqlMigrations/Migrations/20221010151710_ApiKey.Designer.cs b/util/MySqlMigrations/Migrations/20221010151710_ApiKey.Designer.cs deleted file mode 100644 index 3146d695a7c8..000000000000 --- a/util/MySqlMigrations/Migrations/20221010151710_ApiKey.Designer.cs +++ /dev/null @@ -1,1855 +0,0 @@ -// -using System; -using Bit.Infrastructure.EntityFramework.Repositories; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace Bit.MySqlMigrations.Migrations -{ - [DbContext(typeof(DatabaseContext))] - [Migration("20221010151710_ApiKey")] - partial class ApiKey - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "6.0.4") - .HasAnnotation("Relational:MaxIdentifierLength", 64); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ApiKey", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("ClientSecret") - .HasMaxLength(30) - .HasColumnType("varchar(30)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("EncryptedPayload") - .HasMaxLength(4000) - .HasColumnType("varchar(4000)"); - - b.Property("ExpireAt") - .HasColumnType("datetime(6)"); - - b.Property("Key") - .HasColumnType("longtext"); - - b.Property("Name") - .HasMaxLength(200) - .HasColumnType("varchar(200)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Scope") - .HasMaxLength(4000) - .HasColumnType("varchar(4000)"); - - b.Property("ServiceAccountId") - .HasColumnType("char(36)"); - - b.HasKey("Id") - .HasAnnotation("SqlServer:Clustered", true); - - b.HasIndex("ServiceAccountId") - .HasAnnotation("SqlServer:Clustered", false); - - b.ToTable("ApiKey", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.AuthRequest", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("AccessCode") - .HasMaxLength(25) - .HasColumnType("varchar(25)"); - - b.Property("AuthenticationDate") - .HasColumnType("datetime(6)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Key") - .HasColumnType("longtext"); - - b.Property("MasterPasswordHash") - .HasColumnType("longtext"); - - b.Property("PublicKey") - .HasColumnType("longtext"); - - b.Property("RequestDeviceIdentifier") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("RequestDeviceType") - .HasColumnType("tinyint unsigned"); - - b.Property("RequestFingerprint") - .HasColumnType("longtext"); - - b.Property("RequestIpAddress") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("ResponseDate") - .HasColumnType("datetime(6)"); - - b.Property("ResponseDeviceId") - .HasColumnType("char(36)"); - - b.Property("Type") - .HasColumnType("tinyint unsigned"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ResponseDeviceId"); - - b.HasIndex("UserId"); - - b.ToTable("AuthRequest", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Cipher", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("Attachments") - .HasColumnType("longtext"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Data") - .HasColumnType("longtext"); - - b.Property("DeletedDate") - .HasColumnType("datetime(6)"); - - b.Property("Favorites") - .HasColumnType("longtext"); - - b.Property("Folders") - .HasColumnType("longtext"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("Reprompt") - .HasColumnType("tinyint unsigned"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Type") - .HasColumnType("tinyint unsigned"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("UserId"); - - b.ToTable("Cipher", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Collection", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("ExternalId") - .HasMaxLength(300) - .HasColumnType("varchar(300)"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.ToTable("Collection", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionCipher", b => - { - b.Property("CollectionId") - .HasColumnType("char(36)"); - - b.Property("CipherId") - .HasColumnType("char(36)"); - - b.HasKey("CollectionId", "CipherId"); - - b.HasIndex("CipherId"); - - b.ToTable("CollectionCipher", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionGroup", b => - { - b.Property("CollectionId") - .HasColumnType("char(36)"); - - b.Property("GroupId") - .HasColumnType("char(36)"); - - b.Property("HidePasswords") - .HasColumnType("tinyint(1)"); - - b.Property("ReadOnly") - .HasColumnType("tinyint(1)"); - - b.HasKey("CollectionId", "GroupId"); - - b.HasIndex("GroupId"); - - b.ToTable("CollectionGroups"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionUser", b => - { - b.Property("CollectionId") - .HasColumnType("char(36)"); - - b.Property("OrganizationUserId") - .HasColumnType("char(36)"); - - b.Property("HidePasswords") - .HasColumnType("tinyint(1)"); - - b.Property("ReadOnly") - .HasColumnType("tinyint(1)"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("CollectionId", "OrganizationUserId"); - - b.HasIndex("OrganizationUserId"); - - b.HasIndex("UserId"); - - b.ToTable("CollectionUsers"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Device", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Identifier") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("Name") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("PushToken") - .HasMaxLength(255) - .HasColumnType("varchar(255)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Type") - .HasColumnType("tinyint unsigned"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Device", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.EmergencyAccess", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("GranteeId") - .HasColumnType("char(36)"); - - b.Property("GrantorId") - .HasColumnType("char(36)"); - - b.Property("KeyEncrypted") - .HasColumnType("longtext"); - - b.Property("LastNotificationDate") - .HasColumnType("datetime(6)"); - - b.Property("RecoveryInitiatedDate") - .HasColumnType("datetime(6)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Status") - .HasColumnType("tinyint unsigned"); - - b.Property("Type") - .HasColumnType("tinyint unsigned"); - - b.Property("WaitTimeDays") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("GranteeId"); - - b.HasIndex("GrantorId"); - - b.ToTable("EmergencyAccess", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Event", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("ActingUserId") - .HasColumnType("char(36)"); - - b.Property("CipherId") - .HasColumnType("char(36)"); - - b.Property("CollectionId") - .HasColumnType("char(36)"); - - b.Property("Date") - .HasColumnType("datetime(6)"); - - b.Property("DeviceType") - .HasColumnType("tinyint unsigned"); - - b.Property("GroupId") - .HasColumnType("char(36)"); - - b.Property("InstallationId") - .HasColumnType("char(36)"); - - b.Property("IpAddress") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("OrganizationUserId") - .HasColumnType("char(36)"); - - b.Property("PolicyId") - .HasColumnType("char(36)"); - - b.Property("ProviderId") - .HasColumnType("char(36)"); - - b.Property("ProviderOrganizationId") - .HasColumnType("char(36)"); - - b.Property("ProviderUserId") - .HasColumnType("char(36)"); - - b.Property("Type") - .HasColumnType("int"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("Event", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Folder", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Folder", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Grant", b => - { - b.Property("Key") - .HasMaxLength(200) - .HasColumnType("varchar(200)"); - - b.Property("ClientId") - .HasMaxLength(200) - .HasColumnType("varchar(200)"); - - b.Property("ConsumedDate") - .HasColumnType("datetime(6)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Data") - .HasColumnType("longtext"); - - b.Property("Description") - .HasMaxLength(200) - .HasColumnType("varchar(200)"); - - b.Property("ExpirationDate") - .HasColumnType("datetime(6)"); - - b.Property("SessionId") - .HasMaxLength(100) - .HasColumnType("varchar(100)"); - - b.Property("SubjectId") - .HasMaxLength(200) - .HasColumnType("varchar(200)"); - - b.Property("Type") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.HasKey("Key"); - - b.ToTable("Grant", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Group", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("AccessAll") - .HasColumnType("tinyint(1)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("ExternalId") - .HasMaxLength(300) - .HasColumnType("varchar(300)"); - - b.Property("Name") - .HasMaxLength(100) - .HasColumnType("varchar(100)"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.ToTable("Group", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.GroupUser", b => - { - b.Property("GroupId") - .HasColumnType("char(36)"); - - b.Property("OrganizationUserId") - .HasColumnType("char(36)"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("GroupId", "OrganizationUserId"); - - b.HasIndex("OrganizationUserId"); - - b.HasIndex("UserId"); - - b.ToTable("GroupUser", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Installation", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("Enabled") - .HasColumnType("tinyint(1)"); - - b.Property("Key") - .HasMaxLength(150) - .HasColumnType("varchar(150)"); - - b.HasKey("Id"); - - b.ToTable("Installation", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Organization", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("BillingEmail") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("BusinessAddress1") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("BusinessAddress2") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("BusinessAddress3") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("BusinessCountry") - .HasMaxLength(2) - .HasColumnType("varchar(2)"); - - b.Property("BusinessName") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("BusinessTaxNumber") - .HasMaxLength(30) - .HasColumnType("varchar(30)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Enabled") - .HasColumnType("tinyint(1)"); - - b.Property("ExpirationDate") - .HasColumnType("datetime(6)"); - - b.Property("Gateway") - .HasColumnType("tinyint unsigned"); - - b.Property("GatewayCustomerId") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("GatewaySubscriptionId") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("Identifier") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("LicenseKey") - .HasMaxLength(100) - .HasColumnType("varchar(100)"); - - b.Property("MaxAutoscaleSeats") - .HasColumnType("int"); - - b.Property("MaxCollections") - .HasColumnType("smallint"); - - b.Property("MaxStorageGb") - .HasColumnType("smallint"); - - b.Property("Name") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("OwnersNotifiedOfAutoscaling") - .HasColumnType("datetime(6)"); - - b.Property("Plan") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("PlanType") - .HasColumnType("tinyint unsigned"); - - b.Property("PrivateKey") - .HasColumnType("longtext"); - - b.Property("PublicKey") - .HasColumnType("longtext"); - - b.Property("ReferenceData") - .HasColumnType("longtext"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Seats") - .HasColumnType("int"); - - b.Property("SelfHost") - .HasColumnType("tinyint(1)"); - - b.Property("Storage") - .HasColumnType("bigint"); - - b.Property("TwoFactorProviders") - .HasColumnType("longtext"); - - b.Property("Use2fa") - .HasColumnType("tinyint(1)"); - - b.Property("UseApi") - .HasColumnType("tinyint(1)"); - - b.Property("UseDirectory") - .HasColumnType("tinyint(1)"); - - b.Property("UseEvents") - .HasColumnType("tinyint(1)"); - - b.Property("UseGroups") - .HasColumnType("tinyint(1)"); - - b.Property("UseKeyConnector") - .HasColumnType("tinyint(1)"); - - b.Property("UsePolicies") - .HasColumnType("tinyint(1)"); - - b.Property("UseResetPassword") - .HasColumnType("tinyint(1)"); - - b.Property("UseScim") - .HasColumnType("tinyint(1)"); - - b.Property("UseSso") - .HasColumnType("tinyint(1)"); - - b.Property("UseTotp") - .HasColumnType("tinyint(1)"); - - b.Property("UsersGetPremium") - .HasColumnType("tinyint(1)"); - - b.HasKey("Id"); - - b.ToTable("Organization", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationApiKey", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("ApiKey") - .HasMaxLength(30) - .HasColumnType("varchar(30)"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Type") - .HasColumnType("tinyint unsigned"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.ToTable("OrganizationApiKey", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationConnection", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("Config") - .HasColumnType("longtext"); - - b.Property("Enabled") - .HasColumnType("tinyint(1)"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("Type") - .HasColumnType("tinyint unsigned"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.ToTable("OrganizationConnection", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationSponsorship", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("FriendlyName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("LastSyncDate") - .HasColumnType("datetime(6)"); - - b.Property("OfferedToEmail") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("PlanSponsorshipType") - .HasColumnType("tinyint unsigned"); - - b.Property("SponsoredOrganizationId") - .HasColumnType("char(36)"); - - b.Property("SponsoringOrganizationId") - .HasColumnType("char(36)"); - - b.Property("SponsoringOrganizationUserId") - .HasColumnType("char(36)"); - - b.Property("ToDelete") - .HasColumnType("tinyint(1)"); - - b.Property("ValidUntil") - .HasColumnType("datetime(6)"); - - b.HasKey("Id"); - - b.HasIndex("SponsoredOrganizationId"); - - b.HasIndex("SponsoringOrganizationId"); - - b.ToTable("OrganizationSponsorship", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("AccessAll") - .HasColumnType("tinyint(1)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("ExternalId") - .HasMaxLength(300) - .HasColumnType("varchar(300)"); - - b.Property("Key") - .HasColumnType("longtext"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("Permissions") - .HasColumnType("longtext"); - - b.Property("ResetPasswordKey") - .HasColumnType("longtext"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Status") - .HasColumnType("smallint"); - - b.Property("Type") - .HasColumnType("tinyint unsigned"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("UserId"); - - b.ToTable("OrganizationUser", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Policy", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Data") - .HasColumnType("longtext"); - - b.Property("Enabled") - .HasColumnType("tinyint(1)"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Type") - .HasColumnType("tinyint unsigned"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.ToTable("Policy", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Project", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("DeletedDate") - .HasColumnType("datetime(6)"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.HasKey("Id") - .HasAnnotation("SqlServer:Clustered", true); - - b.HasIndex("DeletedDate") - .HasAnnotation("SqlServer:Clustered", false); - - b.HasIndex("OrganizationId") - .HasAnnotation("SqlServer:Clustered", false); - - b.ToTable("Project", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Provider", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("BillingEmail") - .HasColumnType("longtext"); - - b.Property("BusinessAddress1") - .HasColumnType("longtext"); - - b.Property("BusinessAddress2") - .HasColumnType("longtext"); - - b.Property("BusinessAddress3") - .HasColumnType("longtext"); - - b.Property("BusinessCountry") - .HasColumnType("longtext"); - - b.Property("BusinessName") - .HasColumnType("longtext"); - - b.Property("BusinessTaxNumber") - .HasColumnType("longtext"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Enabled") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Status") - .HasColumnType("tinyint unsigned"); - - b.Property("UseEvents") - .HasColumnType("tinyint(1)"); - - b.HasKey("Id"); - - b.ToTable("Provider", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ProviderOrganization", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Key") - .HasColumnType("longtext"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("ProviderId") - .HasColumnType("char(36)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Settings") - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("ProviderId"); - - b.ToTable("ProviderOrganization", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ProviderUser", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Email") - .HasColumnType("longtext"); - - b.Property("Key") - .HasColumnType("longtext"); - - b.Property("Permissions") - .HasColumnType("longtext"); - - b.Property("ProviderId") - .HasColumnType("char(36)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Status") - .HasColumnType("tinyint unsigned"); - - b.Property("Type") - .HasColumnType("tinyint unsigned"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ProviderId"); - - b.HasIndex("UserId"); - - b.ToTable("ProviderUser", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Secret", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("DeletedDate") - .HasColumnType("datetime(6)"); - - b.Property("Key") - .HasColumnType("longtext"); - - b.Property("Note") - .HasColumnType("longtext"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Value") - .HasColumnType("longtext"); - - b.HasKey("Id") - .HasAnnotation("SqlServer:Clustered", true); - - b.HasIndex("DeletedDate") - .HasAnnotation("SqlServer:Clustered", false); - - b.HasIndex("OrganizationId") - .HasAnnotation("SqlServer:Clustered", false); - - b.ToTable("Secret", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Send", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("AccessCount") - .HasColumnType("int"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Data") - .HasColumnType("longtext"); - - b.Property("DeletionDate") - .HasColumnType("datetime(6)"); - - b.Property("Disabled") - .HasColumnType("tinyint(1)"); - - b.Property("ExpirationDate") - .HasColumnType("datetime(6)"); - - b.Property("HideEmail") - .HasColumnType("tinyint(1)"); - - b.Property("Key") - .HasColumnType("longtext"); - - b.Property("MaxAccessCount") - .HasColumnType("int"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("Password") - .HasMaxLength(300) - .HasColumnType("varchar(300)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Type") - .HasColumnType("tinyint unsigned"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("UserId"); - - b.ToTable("Send", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ServiceAccount", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.HasKey("Id") - .HasAnnotation("SqlServer:Clustered", true); - - b.HasIndex("OrganizationId") - .HasAnnotation("SqlServer:Clustered", false); - - b.ToTable("ServiceAccount", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.SsoConfig", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Data") - .HasColumnType("longtext"); - - b.Property("Enabled") - .HasColumnType("tinyint(1)"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.ToTable("SsoConfig", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.SsoUser", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("ExternalId") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("UserId"); - - b.ToTable("SsoUser", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.TaxRate", b => - { - b.Property("Id") - .HasMaxLength(40) - .HasColumnType("varchar(40)"); - - b.Property("Active") - .HasColumnType("tinyint(1)"); - - b.Property("Country") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("PostalCode") - .HasMaxLength(10) - .HasColumnType("varchar(10)"); - - b.Property("Rate") - .HasColumnType("decimal(65,30)"); - - b.Property("State") - .HasMaxLength(2) - .HasColumnType("varchar(2)"); - - b.HasKey("Id"); - - b.ToTable("TaxRate", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Transaction", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("Amount") - .HasColumnType("decimal(65,30)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Details") - .HasMaxLength(100) - .HasColumnType("varchar(100)"); - - b.Property("Gateway") - .HasColumnType("tinyint unsigned"); - - b.Property("GatewayId") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("PaymentMethodType") - .HasColumnType("tinyint unsigned"); - - b.Property("Refunded") - .HasColumnType("tinyint(1)"); - - b.Property("RefundedAmount") - .HasColumnType("decimal(65,30)"); - - b.Property("Type") - .HasColumnType("tinyint unsigned"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("UserId"); - - b.ToTable("Transaction", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.User", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("AccountRevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("ApiKey") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("varchar(30)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Culture") - .HasMaxLength(10) - .HasColumnType("varchar(10)"); - - b.Property("Email") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("EmailVerified") - .HasColumnType("tinyint(1)"); - - b.Property("EquivalentDomains") - .HasColumnType("longtext"); - - b.Property("ExcludedGlobalEquivalentDomains") - .HasColumnType("longtext"); - - b.Property("FailedLoginCount") - .HasColumnType("int"); - - b.Property("ForcePasswordReset") - .HasColumnType("tinyint(1)"); - - b.Property("Gateway") - .HasColumnType("tinyint unsigned"); - - b.Property("GatewayCustomerId") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("GatewaySubscriptionId") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("Kdf") - .HasColumnType("tinyint unsigned"); - - b.Property("KdfIterations") - .HasColumnType("int"); - - b.Property("Key") - .HasColumnType("longtext"); - - b.Property("LastFailedLoginDate") - .HasColumnType("datetime(6)"); - - b.Property("LicenseKey") - .HasMaxLength(100) - .HasColumnType("varchar(100)"); - - b.Property("MasterPassword") - .HasMaxLength(300) - .HasColumnType("varchar(300)"); - - b.Property("MasterPasswordHint") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("MaxStorageGb") - .HasColumnType("smallint"); - - b.Property("Name") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("Premium") - .HasColumnType("tinyint(1)"); - - b.Property("PremiumExpirationDate") - .HasColumnType("datetime(6)"); - - b.Property("PrivateKey") - .HasColumnType("longtext"); - - b.Property("PublicKey") - .HasColumnType("longtext"); - - b.Property("ReferenceData") - .HasColumnType("longtext"); - - b.Property("RenewalReminderDate") - .HasColumnType("datetime(6)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("SecurityStamp") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("Storage") - .HasColumnType("bigint"); - - b.Property("TwoFactorProviders") - .HasColumnType("longtext"); - - b.Property("TwoFactorRecoveryCode") - .HasMaxLength(32) - .HasColumnType("varchar(32)"); - - b.Property("UnknownDeviceVerificationEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("UsesKeyConnector") - .HasColumnType("tinyint(1)"); - - b.HasKey("Id"); - - b.ToTable("User", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ApiKey", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.ServiceAccount", "ServiceAccount") - .WithMany() - .HasForeignKey("ServiceAccountId"); - - b.Navigation("ServiceAccount"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.AuthRequest", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Device", "ResponseDevice") - .WithMany() - .HasForeignKey("ResponseDeviceId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ResponseDevice"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Cipher", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("Ciphers") - .HasForeignKey("OrganizationId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany("Ciphers") - .HasForeignKey("UserId"); - - b.Navigation("Organization"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Collection", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany() - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionCipher", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Cipher", "Cipher") - .WithMany("CollectionCiphers") - .HasForeignKey("CipherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Collection", "Collection") - .WithMany("CollectionCiphers") - .HasForeignKey("CollectionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Cipher"); - - b.Navigation("Collection"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionGroup", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Collection", "Collection") - .WithMany("CollectionGroups") - .HasForeignKey("CollectionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Group", "Group") - .WithMany() - .HasForeignKey("GroupId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Collection"); - - b.Navigation("Group"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionUser", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Collection", "Collection") - .WithMany("CollectionUsers") - .HasForeignKey("CollectionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", "OrganizationUser") - .WithMany("CollectionUsers") - .HasForeignKey("OrganizationUserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", null) - .WithMany("CollectionUsers") - .HasForeignKey("UserId"); - - b.Navigation("Collection"); - - b.Navigation("OrganizationUser"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Device", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.EmergencyAccess", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "Grantee") - .WithMany() - .HasForeignKey("GranteeId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "Grantor") - .WithMany() - .HasForeignKey("GrantorId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Grantee"); - - b.Navigation("Grantor"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Folder", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany("Folders") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Group", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("Groups") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.GroupUser", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Group", "Group") - .WithMany("GroupUsers") - .HasForeignKey("GroupId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", "OrganizationUser") - .WithMany() - .HasForeignKey("OrganizationUserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", null) - .WithMany("GroupUsers") - .HasForeignKey("UserId"); - - b.Navigation("Group"); - - b.Navigation("OrganizationUser"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationApiKey", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("ApiKeys") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationConnection", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("Connections") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationSponsorship", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "SponsoredOrganization") - .WithMany() - .HasForeignKey("SponsoredOrganizationId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "SponsoringOrganization") - .WithMany() - .HasForeignKey("SponsoringOrganizationId"); - - b.Navigation("SponsoredOrganization"); - - b.Navigation("SponsoringOrganization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("OrganizationUsers") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany("OrganizationUsers") - .HasForeignKey("UserId"); - - b.Navigation("Organization"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Policy", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("Policies") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Project", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany() - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ProviderOrganization", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany() - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Provider", "Provider") - .WithMany() - .HasForeignKey("ProviderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - - b.Navigation("Provider"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ProviderUser", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Provider", "Provider") - .WithMany() - .HasForeignKey("ProviderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany() - .HasForeignKey("UserId"); - - b.Navigation("Provider"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Secret", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany() - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Send", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany() - .HasForeignKey("OrganizationId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany() - .HasForeignKey("UserId"); - - b.Navigation("Organization"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ServiceAccount", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany() - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.SsoConfig", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("SsoConfigs") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.SsoUser", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("SsoUsers") - .HasForeignKey("OrganizationId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany("SsoUsers") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Transaction", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("Transactions") - .HasForeignKey("OrganizationId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany("Transactions") - .HasForeignKey("UserId"); - - b.Navigation("Organization"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Cipher", b => - { - b.Navigation("CollectionCiphers"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Collection", b => - { - b.Navigation("CollectionCiphers"); - - b.Navigation("CollectionGroups"); - - b.Navigation("CollectionUsers"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Group", b => - { - b.Navigation("GroupUsers"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Organization", b => - { - b.Navigation("ApiKeys"); - - b.Navigation("Ciphers"); - - b.Navigation("Connections"); - - b.Navigation("Groups"); - - b.Navigation("OrganizationUsers"); - - b.Navigation("Policies"); - - b.Navigation("SsoConfigs"); - - b.Navigation("SsoUsers"); - - b.Navigation("Transactions"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", b => - { - b.Navigation("CollectionUsers"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.User", b => - { - b.Navigation("Ciphers"); - - b.Navigation("CollectionUsers"); - - b.Navigation("Folders"); - - b.Navigation("GroupUsers"); - - b.Navigation("OrganizationUsers"); - - b.Navigation("SsoUsers"); - - b.Navigation("Transactions"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/util/MySqlMigrations/Migrations/20221010151710_ApiKey.cs b/util/MySqlMigrations/Migrations/20221010151710_ApiKey.cs deleted file mode 100644 index d7e63c3a8ae4..000000000000 --- a/util/MySqlMigrations/Migrations/20221010151710_ApiKey.cs +++ /dev/null @@ -1,53 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Bit.MySqlMigrations.Migrations; - -public partial class ApiKey : Migration -{ - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "ApiKey", - columns: table => new - { - Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), - ServiceAccountId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), - Name = table.Column(type: "varchar(200)", maxLength: 200, nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), - ClientSecret = table.Column(type: "varchar(30)", maxLength: 30, nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), - Scope = table.Column(type: "varchar(4000)", maxLength: 4000, nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), - EncryptedPayload = table.Column(type: "varchar(4000)", maxLength: 4000, nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), - Key = table.Column(type: "longtext", nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), - ExpireAt = table.Column(type: "datetime(6)", nullable: false), - CreationDate = table.Column(type: "datetime(6)", nullable: false), - RevisionDate = table.Column(type: "datetime(6)", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ApiKey", x => x.Id); - table.ForeignKey( - name: "FK_ApiKey_ServiceAccount_ServiceAccountId", - column: x => x.ServiceAccountId, - principalTable: "ServiceAccount", - principalColumn: "Id"); - }) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateIndex( - name: "IX_ApiKey_ServiceAccountId", - table: "ApiKey", - column: "ServiceAccountId"); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "ApiKey"); - } -} diff --git a/util/MySqlMigrations/Migrations/20221018133046_ProjectSecret.Designer.cs b/util/MySqlMigrations/Migrations/20221018133046_ProjectSecret.Designer.cs deleted file mode 100644 index 7babd06748d6..000000000000 --- a/util/MySqlMigrations/Migrations/20221018133046_ProjectSecret.Designer.cs +++ /dev/null @@ -1,1831 +0,0 @@ -// -using System; -using Bit.Infrastructure.EntityFramework.Repositories; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace Bit.MySqlMigrations.Migrations -{ - [DbContext(typeof(DatabaseContext))] - [Migration("20221018133046_ProjectSecret")] - partial class ProjectSecret - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "6.0.4") - .HasAnnotation("Relational:MaxIdentifierLength", 64); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.AuthRequest", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("AccessCode") - .HasMaxLength(25) - .HasColumnType("varchar(25)"); - - b.Property("AuthenticationDate") - .HasColumnType("datetime(6)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Key") - .HasColumnType("longtext"); - - b.Property("MasterPasswordHash") - .HasColumnType("longtext"); - - b.Property("PublicKey") - .HasColumnType("longtext"); - - b.Property("RequestDeviceIdentifier") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("RequestDeviceType") - .HasColumnType("tinyint unsigned"); - - b.Property("RequestFingerprint") - .HasColumnType("longtext"); - - b.Property("RequestIpAddress") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("ResponseDate") - .HasColumnType("datetime(6)"); - - b.Property("ResponseDeviceId") - .HasColumnType("char(36)"); - - b.Property("Type") - .HasColumnType("tinyint unsigned"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ResponseDeviceId"); - - b.HasIndex("UserId"); - - b.ToTable("AuthRequest", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Cipher", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("Attachments") - .HasColumnType("longtext"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Data") - .HasColumnType("longtext"); - - b.Property("DeletedDate") - .HasColumnType("datetime(6)"); - - b.Property("Favorites") - .HasColumnType("longtext"); - - b.Property("Folders") - .HasColumnType("longtext"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("Reprompt") - .HasColumnType("tinyint unsigned"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Type") - .HasColumnType("tinyint unsigned"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("UserId"); - - b.ToTable("Cipher", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Collection", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("ExternalId") - .HasMaxLength(300) - .HasColumnType("varchar(300)"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.ToTable("Collection", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionCipher", b => - { - b.Property("CollectionId") - .HasColumnType("char(36)"); - - b.Property("CipherId") - .HasColumnType("char(36)"); - - b.HasKey("CollectionId", "CipherId"); - - b.HasIndex("CipherId"); - - b.ToTable("CollectionCipher", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionGroup", b => - { - b.Property("CollectionId") - .HasColumnType("char(36)"); - - b.Property("GroupId") - .HasColumnType("char(36)"); - - b.Property("HidePasswords") - .HasColumnType("tinyint(1)"); - - b.Property("ReadOnly") - .HasColumnType("tinyint(1)"); - - b.HasKey("CollectionId", "GroupId"); - - b.HasIndex("GroupId"); - - b.ToTable("CollectionGroups"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionUser", b => - { - b.Property("CollectionId") - .HasColumnType("char(36)"); - - b.Property("OrganizationUserId") - .HasColumnType("char(36)"); - - b.Property("HidePasswords") - .HasColumnType("tinyint(1)"); - - b.Property("ReadOnly") - .HasColumnType("tinyint(1)"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("CollectionId", "OrganizationUserId"); - - b.HasIndex("OrganizationUserId"); - - b.HasIndex("UserId"); - - b.ToTable("CollectionUsers"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Device", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Identifier") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("Name") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("PushToken") - .HasMaxLength(255) - .HasColumnType("varchar(255)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Type") - .HasColumnType("tinyint unsigned"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Device", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.EmergencyAccess", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("GranteeId") - .HasColumnType("char(36)"); - - b.Property("GrantorId") - .HasColumnType("char(36)"); - - b.Property("KeyEncrypted") - .HasColumnType("longtext"); - - b.Property("LastNotificationDate") - .HasColumnType("datetime(6)"); - - b.Property("RecoveryInitiatedDate") - .HasColumnType("datetime(6)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Status") - .HasColumnType("tinyint unsigned"); - - b.Property("Type") - .HasColumnType("tinyint unsigned"); - - b.Property("WaitTimeDays") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("GranteeId"); - - b.HasIndex("GrantorId"); - - b.ToTable("EmergencyAccess", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Event", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("ActingUserId") - .HasColumnType("char(36)"); - - b.Property("CipherId") - .HasColumnType("char(36)"); - - b.Property("CollectionId") - .HasColumnType("char(36)"); - - b.Property("Date") - .HasColumnType("datetime(6)"); - - b.Property("DeviceType") - .HasColumnType("tinyint unsigned"); - - b.Property("GroupId") - .HasColumnType("char(36)"); - - b.Property("InstallationId") - .HasColumnType("char(36)"); - - b.Property("IpAddress") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("OrganizationUserId") - .HasColumnType("char(36)"); - - b.Property("PolicyId") - .HasColumnType("char(36)"); - - b.Property("ProviderId") - .HasColumnType("char(36)"); - - b.Property("ProviderOrganizationId") - .HasColumnType("char(36)"); - - b.Property("ProviderUserId") - .HasColumnType("char(36)"); - - b.Property("Type") - .HasColumnType("int"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("Event", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Folder", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Folder", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Grant", b => - { - b.Property("Key") - .HasMaxLength(200) - .HasColumnType("varchar(200)"); - - b.Property("ClientId") - .HasMaxLength(200) - .HasColumnType("varchar(200)"); - - b.Property("ConsumedDate") - .HasColumnType("datetime(6)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Data") - .HasColumnType("longtext"); - - b.Property("Description") - .HasMaxLength(200) - .HasColumnType("varchar(200)"); - - b.Property("ExpirationDate") - .HasColumnType("datetime(6)"); - - b.Property("SessionId") - .HasMaxLength(100) - .HasColumnType("varchar(100)"); - - b.Property("SubjectId") - .HasMaxLength(200) - .HasColumnType("varchar(200)"); - - b.Property("Type") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.HasKey("Key"); - - b.ToTable("Grant", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Group", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("AccessAll") - .HasColumnType("tinyint(1)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("ExternalId") - .HasMaxLength(300) - .HasColumnType("varchar(300)"); - - b.Property("Name") - .HasMaxLength(100) - .HasColumnType("varchar(100)"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.ToTable("Group", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.GroupUser", b => - { - b.Property("GroupId") - .HasColumnType("char(36)"); - - b.Property("OrganizationUserId") - .HasColumnType("char(36)"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("GroupId", "OrganizationUserId"); - - b.HasIndex("OrganizationUserId"); - - b.HasIndex("UserId"); - - b.ToTable("GroupUser", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Installation", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("Enabled") - .HasColumnType("tinyint(1)"); - - b.Property("Key") - .HasMaxLength(150) - .HasColumnType("varchar(150)"); - - b.HasKey("Id"); - - b.ToTable("Installation", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Organization", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("BillingEmail") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("BusinessAddress1") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("BusinessAddress2") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("BusinessAddress3") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("BusinessCountry") - .HasMaxLength(2) - .HasColumnType("varchar(2)"); - - b.Property("BusinessName") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("BusinessTaxNumber") - .HasMaxLength(30) - .HasColumnType("varchar(30)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Enabled") - .HasColumnType("tinyint(1)"); - - b.Property("ExpirationDate") - .HasColumnType("datetime(6)"); - - b.Property("Gateway") - .HasColumnType("tinyint unsigned"); - - b.Property("GatewayCustomerId") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("GatewaySubscriptionId") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("Identifier") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("LicenseKey") - .HasMaxLength(100) - .HasColumnType("varchar(100)"); - - b.Property("MaxAutoscaleSeats") - .HasColumnType("int"); - - b.Property("MaxCollections") - .HasColumnType("smallint"); - - b.Property("MaxStorageGb") - .HasColumnType("smallint"); - - b.Property("Name") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("OwnersNotifiedOfAutoscaling") - .HasColumnType("datetime(6)"); - - b.Property("Plan") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("PlanType") - .HasColumnType("tinyint unsigned"); - - b.Property("PrivateKey") - .HasColumnType("longtext"); - - b.Property("PublicKey") - .HasColumnType("longtext"); - - b.Property("ReferenceData") - .HasColumnType("longtext"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Seats") - .HasColumnType("int"); - - b.Property("SelfHost") - .HasColumnType("tinyint(1)"); - - b.Property("Storage") - .HasColumnType("bigint"); - - b.Property("TwoFactorProviders") - .HasColumnType("longtext"); - - b.Property("Use2fa") - .HasColumnType("tinyint(1)"); - - b.Property("UseApi") - .HasColumnType("tinyint(1)"); - - b.Property("UseDirectory") - .HasColumnType("tinyint(1)"); - - b.Property("UseEvents") - .HasColumnType("tinyint(1)"); - - b.Property("UseGroups") - .HasColumnType("tinyint(1)"); - - b.Property("UseKeyConnector") - .HasColumnType("tinyint(1)"); - - b.Property("UsePolicies") - .HasColumnType("tinyint(1)"); - - b.Property("UseResetPassword") - .HasColumnType("tinyint(1)"); - - b.Property("UseScim") - .HasColumnType("tinyint(1)"); - - b.Property("UseSso") - .HasColumnType("tinyint(1)"); - - b.Property("UseTotp") - .HasColumnType("tinyint(1)"); - - b.Property("UsersGetPremium") - .HasColumnType("tinyint(1)"); - - b.HasKey("Id"); - - b.ToTable("Organization", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationApiKey", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("ApiKey") - .HasMaxLength(30) - .HasColumnType("varchar(30)"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Type") - .HasColumnType("tinyint unsigned"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.ToTable("OrganizationApiKey", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationConnection", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("Config") - .HasColumnType("longtext"); - - b.Property("Enabled") - .HasColumnType("tinyint(1)"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("Type") - .HasColumnType("tinyint unsigned"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.ToTable("OrganizationConnection", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationSponsorship", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("FriendlyName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("LastSyncDate") - .HasColumnType("datetime(6)"); - - b.Property("OfferedToEmail") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("PlanSponsorshipType") - .HasColumnType("tinyint unsigned"); - - b.Property("SponsoredOrganizationId") - .HasColumnType("char(36)"); - - b.Property("SponsoringOrganizationId") - .HasColumnType("char(36)"); - - b.Property("SponsoringOrganizationUserId") - .HasColumnType("char(36)"); - - b.Property("ToDelete") - .HasColumnType("tinyint(1)"); - - b.Property("ValidUntil") - .HasColumnType("datetime(6)"); - - b.HasKey("Id"); - - b.HasIndex("SponsoredOrganizationId"); - - b.HasIndex("SponsoringOrganizationId"); - - b.ToTable("OrganizationSponsorship", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("AccessAll") - .HasColumnType("tinyint(1)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("ExternalId") - .HasMaxLength(300) - .HasColumnType("varchar(300)"); - - b.Property("Key") - .HasColumnType("longtext"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("Permissions") - .HasColumnType("longtext"); - - b.Property("ResetPasswordKey") - .HasColumnType("longtext"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Status") - .HasColumnType("smallint"); - - b.Property("Type") - .HasColumnType("tinyint unsigned"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("UserId"); - - b.ToTable("OrganizationUser", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Policy", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Data") - .HasColumnType("longtext"); - - b.Property("Enabled") - .HasColumnType("tinyint(1)"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Type") - .HasColumnType("tinyint unsigned"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.ToTable("Policy", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Project", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("DeletedDate") - .HasColumnType("datetime(6)"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.HasKey("Id") - .HasAnnotation("SqlServer:Clustered", true); - - b.HasIndex("DeletedDate") - .HasAnnotation("SqlServer:Clustered", false); - - b.HasIndex("OrganizationId") - .HasAnnotation("SqlServer:Clustered", false); - - b.ToTable("Project", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Provider", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("BillingEmail") - .HasColumnType("longtext"); - - b.Property("BusinessAddress1") - .HasColumnType("longtext"); - - b.Property("BusinessAddress2") - .HasColumnType("longtext"); - - b.Property("BusinessAddress3") - .HasColumnType("longtext"); - - b.Property("BusinessCountry") - .HasColumnType("longtext"); - - b.Property("BusinessName") - .HasColumnType("longtext"); - - b.Property("BusinessTaxNumber") - .HasColumnType("longtext"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Enabled") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Status") - .HasColumnType("tinyint unsigned"); - - b.Property("UseEvents") - .HasColumnType("tinyint(1)"); - - b.HasKey("Id"); - - b.ToTable("Provider", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ProviderOrganization", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Key") - .HasColumnType("longtext"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("ProviderId") - .HasColumnType("char(36)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Settings") - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("ProviderId"); - - b.ToTable("ProviderOrganization", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ProviderUser", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Email") - .HasColumnType("longtext"); - - b.Property("Key") - .HasColumnType("longtext"); - - b.Property("Permissions") - .HasColumnType("longtext"); - - b.Property("ProviderId") - .HasColumnType("char(36)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Status") - .HasColumnType("tinyint unsigned"); - - b.Property("Type") - .HasColumnType("tinyint unsigned"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ProviderId"); - - b.HasIndex("UserId"); - - b.ToTable("ProviderUser", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Secret", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("DeletedDate") - .HasColumnType("datetime(6)"); - - b.Property("Key") - .HasColumnType("longtext"); - - b.Property("Note") - .HasColumnType("longtext"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Value") - .HasColumnType("longtext"); - - b.HasKey("Id") - .HasAnnotation("SqlServer:Clustered", true); - - b.HasIndex("DeletedDate") - .HasAnnotation("SqlServer:Clustered", false); - - b.HasIndex("OrganizationId") - .HasAnnotation("SqlServer:Clustered", false); - - b.ToTable("Secret", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Send", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("AccessCount") - .HasColumnType("int"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Data") - .HasColumnType("longtext"); - - b.Property("DeletionDate") - .HasColumnType("datetime(6)"); - - b.Property("Disabled") - .HasColumnType("tinyint(1)"); - - b.Property("ExpirationDate") - .HasColumnType("datetime(6)"); - - b.Property("HideEmail") - .HasColumnType("tinyint(1)"); - - b.Property("Key") - .HasColumnType("longtext"); - - b.Property("MaxAccessCount") - .HasColumnType("int"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("Password") - .HasMaxLength(300) - .HasColumnType("varchar(300)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Type") - .HasColumnType("tinyint unsigned"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("UserId"); - - b.ToTable("Send", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ServiceAccount", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.HasKey("Id") - .HasAnnotation("SqlServer:Clustered", true); - - b.HasIndex("OrganizationId") - .HasAnnotation("SqlServer:Clustered", false); - - b.ToTable("ServiceAccount", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.SsoConfig", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Data") - .HasColumnType("longtext"); - - b.Property("Enabled") - .HasColumnType("tinyint(1)"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.ToTable("SsoConfig", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.SsoUser", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("ExternalId") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("UserId"); - - b.ToTable("SsoUser", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.TaxRate", b => - { - b.Property("Id") - .HasMaxLength(40) - .HasColumnType("varchar(40)"); - - b.Property("Active") - .HasColumnType("tinyint(1)"); - - b.Property("Country") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("PostalCode") - .HasMaxLength(10) - .HasColumnType("varchar(10)"); - - b.Property("Rate") - .HasColumnType("decimal(65,30)"); - - b.Property("State") - .HasMaxLength(2) - .HasColumnType("varchar(2)"); - - b.HasKey("Id"); - - b.ToTable("TaxRate", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Transaction", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("Amount") - .HasColumnType("decimal(65,30)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Details") - .HasMaxLength(100) - .HasColumnType("varchar(100)"); - - b.Property("Gateway") - .HasColumnType("tinyint unsigned"); - - b.Property("GatewayId") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("PaymentMethodType") - .HasColumnType("tinyint unsigned"); - - b.Property("Refunded") - .HasColumnType("tinyint(1)"); - - b.Property("RefundedAmount") - .HasColumnType("decimal(65,30)"); - - b.Property("Type") - .HasColumnType("tinyint unsigned"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("UserId"); - - b.ToTable("Transaction", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.User", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("AccountRevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("ApiKey") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("varchar(30)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Culture") - .HasMaxLength(10) - .HasColumnType("varchar(10)"); - - b.Property("Email") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("EmailVerified") - .HasColumnType("tinyint(1)"); - - b.Property("EquivalentDomains") - .HasColumnType("longtext"); - - b.Property("ExcludedGlobalEquivalentDomains") - .HasColumnType("longtext"); - - b.Property("FailedLoginCount") - .HasColumnType("int"); - - b.Property("ForcePasswordReset") - .HasColumnType("tinyint(1)"); - - b.Property("Gateway") - .HasColumnType("tinyint unsigned"); - - b.Property("GatewayCustomerId") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("GatewaySubscriptionId") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("Kdf") - .HasColumnType("tinyint unsigned"); - - b.Property("KdfIterations") - .HasColumnType("int"); - - b.Property("Key") - .HasColumnType("longtext"); - - b.Property("LastFailedLoginDate") - .HasColumnType("datetime(6)"); - - b.Property("LicenseKey") - .HasMaxLength(100) - .HasColumnType("varchar(100)"); - - b.Property("MasterPassword") - .HasMaxLength(300) - .HasColumnType("varchar(300)"); - - b.Property("MasterPasswordHint") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("MaxStorageGb") - .HasColumnType("smallint"); - - b.Property("Name") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("Premium") - .HasColumnType("tinyint(1)"); - - b.Property("PremiumExpirationDate") - .HasColumnType("datetime(6)"); - - b.Property("PrivateKey") - .HasColumnType("longtext"); - - b.Property("PublicKey") - .HasColumnType("longtext"); - - b.Property("ReferenceData") - .HasColumnType("longtext"); - - b.Property("RenewalReminderDate") - .HasColumnType("datetime(6)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("SecurityStamp") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("Storage") - .HasColumnType("bigint"); - - b.Property("TwoFactorProviders") - .HasColumnType("longtext"); - - b.Property("TwoFactorRecoveryCode") - .HasMaxLength(32) - .HasColumnType("varchar(32)"); - - b.Property("UnknownDeviceVerificationEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("UsesKeyConnector") - .HasColumnType("tinyint(1)"); - - b.HasKey("Id"); - - b.ToTable("User", (string)null); - }); - - modelBuilder.Entity("ProjectSecret", b => - { - b.Property("ProjectsId") - .HasColumnType("char(36)"); - - b.Property("SecretsId") - .HasColumnType("char(36)"); - - b.HasKey("ProjectsId", "SecretsId"); - - b.HasIndex("SecretsId"); - - b.ToTable("ProjectSecret"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.AuthRequest", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Device", "ResponseDevice") - .WithMany() - .HasForeignKey("ResponseDeviceId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ResponseDevice"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Cipher", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("Ciphers") - .HasForeignKey("OrganizationId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany("Ciphers") - .HasForeignKey("UserId"); - - b.Navigation("Organization"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Collection", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany() - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionCipher", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Cipher", "Cipher") - .WithMany("CollectionCiphers") - .HasForeignKey("CipherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Collection", "Collection") - .WithMany("CollectionCiphers") - .HasForeignKey("CollectionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Cipher"); - - b.Navigation("Collection"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionGroup", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Collection", "Collection") - .WithMany("CollectionGroups") - .HasForeignKey("CollectionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Group", "Group") - .WithMany() - .HasForeignKey("GroupId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Collection"); - - b.Navigation("Group"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionUser", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Collection", "Collection") - .WithMany("CollectionUsers") - .HasForeignKey("CollectionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", "OrganizationUser") - .WithMany("CollectionUsers") - .HasForeignKey("OrganizationUserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", null) - .WithMany("CollectionUsers") - .HasForeignKey("UserId"); - - b.Navigation("Collection"); - - b.Navigation("OrganizationUser"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Device", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.EmergencyAccess", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "Grantee") - .WithMany() - .HasForeignKey("GranteeId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "Grantor") - .WithMany() - .HasForeignKey("GrantorId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Grantee"); - - b.Navigation("Grantor"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Folder", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany("Folders") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Group", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("Groups") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.GroupUser", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Group", "Group") - .WithMany("GroupUsers") - .HasForeignKey("GroupId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", "OrganizationUser") - .WithMany() - .HasForeignKey("OrganizationUserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", null) - .WithMany("GroupUsers") - .HasForeignKey("UserId"); - - b.Navigation("Group"); - - b.Navigation("OrganizationUser"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationApiKey", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("ApiKeys") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationConnection", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("Connections") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationSponsorship", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "SponsoredOrganization") - .WithMany() - .HasForeignKey("SponsoredOrganizationId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "SponsoringOrganization") - .WithMany() - .HasForeignKey("SponsoringOrganizationId"); - - b.Navigation("SponsoredOrganization"); - - b.Navigation("SponsoringOrganization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("OrganizationUsers") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany("OrganizationUsers") - .HasForeignKey("UserId"); - - b.Navigation("Organization"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Policy", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("Policies") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Project", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany() - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ProviderOrganization", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany() - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Provider", "Provider") - .WithMany() - .HasForeignKey("ProviderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - - b.Navigation("Provider"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ProviderUser", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Provider", "Provider") - .WithMany() - .HasForeignKey("ProviderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany() - .HasForeignKey("UserId"); - - b.Navigation("Provider"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Secret", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany() - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Send", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany() - .HasForeignKey("OrganizationId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany() - .HasForeignKey("UserId"); - - b.Navigation("Organization"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ServiceAccount", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany() - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.SsoConfig", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("SsoConfigs") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.SsoUser", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("SsoUsers") - .HasForeignKey("OrganizationId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany("SsoUsers") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Transaction", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("Transactions") - .HasForeignKey("OrganizationId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany("Transactions") - .HasForeignKey("UserId"); - - b.Navigation("Organization"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ProjectSecret", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Project", null) - .WithMany() - .HasForeignKey("ProjectsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Secret", null) - .WithMany() - .HasForeignKey("SecretsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Cipher", b => - { - b.Navigation("CollectionCiphers"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Collection", b => - { - b.Navigation("CollectionCiphers"); - - b.Navigation("CollectionGroups"); - - b.Navigation("CollectionUsers"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Group", b => - { - b.Navigation("GroupUsers"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Organization", b => - { - b.Navigation("ApiKeys"); - - b.Navigation("Ciphers"); - - b.Navigation("Connections"); - - b.Navigation("Groups"); - - b.Navigation("OrganizationUsers"); - - b.Navigation("Policies"); - - b.Navigation("SsoConfigs"); - - b.Navigation("SsoUsers"); - - b.Navigation("Transactions"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", b => - { - b.Navigation("CollectionUsers"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.User", b => - { - b.Navigation("Ciphers"); - - b.Navigation("CollectionUsers"); - - b.Navigation("Folders"); - - b.Navigation("GroupUsers"); - - b.Navigation("OrganizationUsers"); - - b.Navigation("SsoUsers"); - - b.Navigation("Transactions"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/util/MySqlMigrations/Migrations/20221018133046_ProjectSecret.cs b/util/MySqlMigrations/Migrations/20221018133046_ProjectSecret.cs deleted file mode 100644 index f3ba532e1c3e..000000000000 --- a/util/MySqlMigrations/Migrations/20221018133046_ProjectSecret.cs +++ /dev/null @@ -1,47 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Bit.MySqlMigrations.Migrations; - -public partial class ProjectSecret : Migration -{ - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "ProjectSecret", - columns: table => new - { - ProjectsId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), - SecretsId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") - }, - constraints: table => - { - table.PrimaryKey("PK_ProjectSecret", x => new { x.ProjectsId, x.SecretsId }); - table.ForeignKey( - name: "FK_ProjectSecret_Project_ProjectsId", - column: x => x.ProjectsId, - principalTable: "Project", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_ProjectSecret_Secret_SecretsId", - column: x => x.SecretsId, - principalTable: "Secret", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateIndex( - name: "IX_ProjectSecret_SecretsId", - table: "ProjectSecret", - column: "SecretsId"); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "ProjectSecret"); - } -} diff --git a/util/MySqlMigrations/Migrations/20221125153348_AccessPolicy.cs b/util/MySqlMigrations/Migrations/20221125153348_AccessPolicy.cs deleted file mode 100644 index 777ff579b1ff..000000000000 --- a/util/MySqlMigrations/Migrations/20221125153348_AccessPolicy.cs +++ /dev/null @@ -1,90 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Bit.MySqlMigrations.Migrations; - -public partial class AccessPolicy : Migration -{ - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "AccessPolicy", - columns: table => new - { - Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), - GroupId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), - GrantedProjectId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), - GrantedServiceAccountId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), - ServiceAccountId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), - OrganizationUserId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), - Read = table.Column(type: "tinyint(1)", nullable: false), - Write = table.Column(type: "tinyint(1)", nullable: false), - CreationDate = table.Column(type: "datetime(6)", nullable: false), - RevisionDate = table.Column(type: "datetime(6)", nullable: false), - Discriminator = table.Column(type: "longtext", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4") - }, - constraints: table => - { - table.PrimaryKey("PK_AccessPolicy", x => x.Id); - table.ForeignKey( - name: "FK_AccessPolicy_Group_GroupId", - column: x => x.GroupId, - principalTable: "Group", - principalColumn: "Id"); - table.ForeignKey( - name: "FK_AccessPolicy_OrganizationUser_OrganizationUserId", - column: x => x.OrganizationUserId, - principalTable: "OrganizationUser", - principalColumn: "Id"); - table.ForeignKey( - name: "FK_AccessPolicy_Project_GrantedProjectId", - column: x => x.GrantedProjectId, - principalTable: "Project", - principalColumn: "Id"); - table.ForeignKey( - name: "FK_AccessPolicy_ServiceAccount_GrantedServiceAccountId", - column: x => x.GrantedServiceAccountId, - principalTable: "ServiceAccount", - principalColumn: "Id"); - table.ForeignKey( - name: "FK_AccessPolicy_ServiceAccount_ServiceAccountId", - column: x => x.ServiceAccountId, - principalTable: "ServiceAccount", - principalColumn: "Id"); - }) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateIndex( - name: "IX_AccessPolicy_GrantedProjectId", - table: "AccessPolicy", - column: "GrantedProjectId"); - - migrationBuilder.CreateIndex( - name: "IX_AccessPolicy_GrantedServiceAccountId", - table: "AccessPolicy", - column: "GrantedServiceAccountId"); - - migrationBuilder.CreateIndex( - name: "IX_AccessPolicy_GroupId", - table: "AccessPolicy", - column: "GroupId"); - - migrationBuilder.CreateIndex( - name: "IX_AccessPolicy_OrganizationUserId", - table: "AccessPolicy", - column: "OrganizationUserId"); - - migrationBuilder.CreateIndex( - name: "IX_AccessPolicy_ServiceAccountId", - table: "AccessPolicy", - column: "ServiceAccountId"); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "AccessPolicy"); - } -} diff --git a/util/MySqlMigrations/Migrations/20221130233348_NeverExpireApiKey.Designer.cs b/util/MySqlMigrations/Migrations/20221130233348_NeverExpireApiKey.Designer.cs deleted file mode 100644 index 9fb6731cbf3a..000000000000 --- a/util/MySqlMigrations/Migrations/20221130233348_NeverExpireApiKey.Designer.cs +++ /dev/null @@ -1,1885 +0,0 @@ -// -using System; -using Bit.Infrastructure.EntityFramework.Repositories; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace Bit.MySqlMigrations.Migrations -{ - [DbContext(typeof(DatabaseContext))] - [Migration("20221130233348_NeverExpireApiKey")] - partial class NeverExpireApiKey - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "6.0.4") - .HasAnnotation("Relational:MaxIdentifierLength", 64); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ApiKey", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("ClientSecret") - .HasMaxLength(30) - .HasColumnType("varchar(30)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("EncryptedPayload") - .HasMaxLength(4000) - .HasColumnType("varchar(4000)"); - - b.Property("ExpireAt") - .HasColumnType("datetime(6)"); - - b.Property("Key") - .HasColumnType("longtext"); - - b.Property("Name") - .HasMaxLength(200) - .HasColumnType("varchar(200)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Scope") - .HasMaxLength(4000) - .HasColumnType("varchar(4000)"); - - b.Property("ServiceAccountId") - .HasColumnType("char(36)"); - - b.HasKey("Id") - .HasAnnotation("SqlServer:Clustered", true); - - b.HasIndex("ServiceAccountId") - .HasAnnotation("SqlServer:Clustered", false); - - b.ToTable("ApiKey", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.AuthRequest", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("AccessCode") - .HasMaxLength(25) - .HasColumnType("varchar(25)"); - - b.Property("AuthenticationDate") - .HasColumnType("datetime(6)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Key") - .HasColumnType("longtext"); - - b.Property("MasterPasswordHash") - .HasColumnType("longtext"); - - b.Property("PublicKey") - .HasColumnType("longtext"); - - b.Property("RequestDeviceIdentifier") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("RequestDeviceType") - .HasColumnType("tinyint unsigned"); - - b.Property("RequestFingerprint") - .HasColumnType("longtext"); - - b.Property("RequestIpAddress") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("ResponseDate") - .HasColumnType("datetime(6)"); - - b.Property("ResponseDeviceId") - .HasColumnType("char(36)"); - - b.Property("Type") - .HasColumnType("tinyint unsigned"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ResponseDeviceId"); - - b.HasIndex("UserId"); - - b.ToTable("AuthRequest", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Cipher", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("Attachments") - .HasColumnType("longtext"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Data") - .HasColumnType("longtext"); - - b.Property("DeletedDate") - .HasColumnType("datetime(6)"); - - b.Property("Favorites") - .HasColumnType("longtext"); - - b.Property("Folders") - .HasColumnType("longtext"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("Reprompt") - .HasColumnType("tinyint unsigned"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Type") - .HasColumnType("tinyint unsigned"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("UserId"); - - b.ToTable("Cipher", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Collection", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("ExternalId") - .HasMaxLength(300) - .HasColumnType("varchar(300)"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.ToTable("Collection", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionCipher", b => - { - b.Property("CollectionId") - .HasColumnType("char(36)"); - - b.Property("CipherId") - .HasColumnType("char(36)"); - - b.HasKey("CollectionId", "CipherId"); - - b.HasIndex("CipherId"); - - b.ToTable("CollectionCipher", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionGroup", b => - { - b.Property("CollectionId") - .HasColumnType("char(36)"); - - b.Property("GroupId") - .HasColumnType("char(36)"); - - b.Property("HidePasswords") - .HasColumnType("tinyint(1)"); - - b.Property("ReadOnly") - .HasColumnType("tinyint(1)"); - - b.HasKey("CollectionId", "GroupId"); - - b.HasIndex("GroupId"); - - b.ToTable("CollectionGroups"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionUser", b => - { - b.Property("CollectionId") - .HasColumnType("char(36)"); - - b.Property("OrganizationUserId") - .HasColumnType("char(36)"); - - b.Property("HidePasswords") - .HasColumnType("tinyint(1)"); - - b.Property("ReadOnly") - .HasColumnType("tinyint(1)"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("CollectionId", "OrganizationUserId"); - - b.HasIndex("OrganizationUserId"); - - b.HasIndex("UserId"); - - b.ToTable("CollectionUsers"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Device", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Identifier") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("Name") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("PushToken") - .HasMaxLength(255) - .HasColumnType("varchar(255)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Type") - .HasColumnType("tinyint unsigned"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Device", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.EmergencyAccess", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("GranteeId") - .HasColumnType("char(36)"); - - b.Property("GrantorId") - .HasColumnType("char(36)"); - - b.Property("KeyEncrypted") - .HasColumnType("longtext"); - - b.Property("LastNotificationDate") - .HasColumnType("datetime(6)"); - - b.Property("RecoveryInitiatedDate") - .HasColumnType("datetime(6)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Status") - .HasColumnType("tinyint unsigned"); - - b.Property("Type") - .HasColumnType("tinyint unsigned"); - - b.Property("WaitTimeDays") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("GranteeId"); - - b.HasIndex("GrantorId"); - - b.ToTable("EmergencyAccess", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Event", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("ActingUserId") - .HasColumnType("char(36)"); - - b.Property("CipherId") - .HasColumnType("char(36)"); - - b.Property("CollectionId") - .HasColumnType("char(36)"); - - b.Property("Date") - .HasColumnType("datetime(6)"); - - b.Property("DeviceType") - .HasColumnType("tinyint unsigned"); - - b.Property("GroupId") - .HasColumnType("char(36)"); - - b.Property("InstallationId") - .HasColumnType("char(36)"); - - b.Property("IpAddress") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("OrganizationUserId") - .HasColumnType("char(36)"); - - b.Property("PolicyId") - .HasColumnType("char(36)"); - - b.Property("ProviderId") - .HasColumnType("char(36)"); - - b.Property("ProviderOrganizationId") - .HasColumnType("char(36)"); - - b.Property("ProviderUserId") - .HasColumnType("char(36)"); - - b.Property("Type") - .HasColumnType("int"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("Event", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Folder", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Folder", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Grant", b => - { - b.Property("Key") - .HasMaxLength(200) - .HasColumnType("varchar(200)"); - - b.Property("ClientId") - .HasMaxLength(200) - .HasColumnType("varchar(200)"); - - b.Property("ConsumedDate") - .HasColumnType("datetime(6)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Data") - .HasColumnType("longtext"); - - b.Property("Description") - .HasMaxLength(200) - .HasColumnType("varchar(200)"); - - b.Property("ExpirationDate") - .HasColumnType("datetime(6)"); - - b.Property("SessionId") - .HasMaxLength(100) - .HasColumnType("varchar(100)"); - - b.Property("SubjectId") - .HasMaxLength(200) - .HasColumnType("varchar(200)"); - - b.Property("Type") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.HasKey("Key"); - - b.ToTable("Grant", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Group", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("AccessAll") - .HasColumnType("tinyint(1)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("ExternalId") - .HasMaxLength(300) - .HasColumnType("varchar(300)"); - - b.Property("Name") - .HasMaxLength(100) - .HasColumnType("varchar(100)"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.ToTable("Group", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.GroupUser", b => - { - b.Property("GroupId") - .HasColumnType("char(36)"); - - b.Property("OrganizationUserId") - .HasColumnType("char(36)"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("GroupId", "OrganizationUserId"); - - b.HasIndex("OrganizationUserId"); - - b.HasIndex("UserId"); - - b.ToTable("GroupUser", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Installation", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("Enabled") - .HasColumnType("tinyint(1)"); - - b.Property("Key") - .HasMaxLength(150) - .HasColumnType("varchar(150)"); - - b.HasKey("Id"); - - b.ToTable("Installation", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Organization", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("BillingEmail") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("BusinessAddress1") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("BusinessAddress2") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("BusinessAddress3") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("BusinessCountry") - .HasMaxLength(2) - .HasColumnType("varchar(2)"); - - b.Property("BusinessName") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("BusinessTaxNumber") - .HasMaxLength(30) - .HasColumnType("varchar(30)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Enabled") - .HasColumnType("tinyint(1)"); - - b.Property("ExpirationDate") - .HasColumnType("datetime(6)"); - - b.Property("Gateway") - .HasColumnType("tinyint unsigned"); - - b.Property("GatewayCustomerId") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("GatewaySubscriptionId") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("Identifier") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("LicenseKey") - .HasMaxLength(100) - .HasColumnType("varchar(100)"); - - b.Property("MaxAutoscaleSeats") - .HasColumnType("int"); - - b.Property("MaxCollections") - .HasColumnType("smallint"); - - b.Property("MaxStorageGb") - .HasColumnType("smallint"); - - b.Property("Name") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("OwnersNotifiedOfAutoscaling") - .HasColumnType("datetime(6)"); - - b.Property("Plan") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("PlanType") - .HasColumnType("tinyint unsigned"); - - b.Property("PrivateKey") - .HasColumnType("longtext"); - - b.Property("PublicKey") - .HasColumnType("longtext"); - - b.Property("ReferenceData") - .HasColumnType("longtext"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Seats") - .HasColumnType("int"); - - b.Property("SelfHost") - .HasColumnType("tinyint(1)"); - - b.Property("Storage") - .HasColumnType("bigint"); - - b.Property("TwoFactorProviders") - .HasColumnType("longtext"); - - b.Property("Use2fa") - .HasColumnType("tinyint(1)"); - - b.Property("UseApi") - .HasColumnType("tinyint(1)"); - - b.Property("UseDirectory") - .HasColumnType("tinyint(1)"); - - b.Property("UseEvents") - .HasColumnType("tinyint(1)"); - - b.Property("UseGroups") - .HasColumnType("tinyint(1)"); - - b.Property("UseKeyConnector") - .HasColumnType("tinyint(1)"); - - b.Property("UsePolicies") - .HasColumnType("tinyint(1)"); - - b.Property("UseResetPassword") - .HasColumnType("tinyint(1)"); - - b.Property("UseScim") - .HasColumnType("tinyint(1)"); - - b.Property("UseSso") - .HasColumnType("tinyint(1)"); - - b.Property("UseTotp") - .HasColumnType("tinyint(1)"); - - b.Property("UsersGetPremium") - .HasColumnType("tinyint(1)"); - - b.HasKey("Id"); - - b.ToTable("Organization", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationApiKey", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("ApiKey") - .HasMaxLength(30) - .HasColumnType("varchar(30)"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Type") - .HasColumnType("tinyint unsigned"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.ToTable("OrganizationApiKey", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationConnection", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("Config") - .HasColumnType("longtext"); - - b.Property("Enabled") - .HasColumnType("tinyint(1)"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("Type") - .HasColumnType("tinyint unsigned"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.ToTable("OrganizationConnection", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationSponsorship", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("FriendlyName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("LastSyncDate") - .HasColumnType("datetime(6)"); - - b.Property("OfferedToEmail") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("PlanSponsorshipType") - .HasColumnType("tinyint unsigned"); - - b.Property("SponsoredOrganizationId") - .HasColumnType("char(36)"); - - b.Property("SponsoringOrganizationId") - .HasColumnType("char(36)"); - - b.Property("SponsoringOrganizationUserId") - .HasColumnType("char(36)"); - - b.Property("ToDelete") - .HasColumnType("tinyint(1)"); - - b.Property("ValidUntil") - .HasColumnType("datetime(6)"); - - b.HasKey("Id"); - - b.HasIndex("SponsoredOrganizationId"); - - b.HasIndex("SponsoringOrganizationId"); - - b.ToTable("OrganizationSponsorship", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("AccessAll") - .HasColumnType("tinyint(1)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("ExternalId") - .HasMaxLength(300) - .HasColumnType("varchar(300)"); - - b.Property("Key") - .HasColumnType("longtext"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("Permissions") - .HasColumnType("longtext"); - - b.Property("ResetPasswordKey") - .HasColumnType("longtext"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Status") - .HasColumnType("smallint"); - - b.Property("Type") - .HasColumnType("tinyint unsigned"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("UserId"); - - b.ToTable("OrganizationUser", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Policy", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Data") - .HasColumnType("longtext"); - - b.Property("Enabled") - .HasColumnType("tinyint(1)"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Type") - .HasColumnType("tinyint unsigned"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.ToTable("Policy", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Project", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("DeletedDate") - .HasColumnType("datetime(6)"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.HasKey("Id") - .HasAnnotation("SqlServer:Clustered", true); - - b.HasIndex("DeletedDate") - .HasAnnotation("SqlServer:Clustered", false); - - b.HasIndex("OrganizationId") - .HasAnnotation("SqlServer:Clustered", false); - - b.ToTable("Project", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Provider", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("BillingEmail") - .HasColumnType("longtext"); - - b.Property("BusinessAddress1") - .HasColumnType("longtext"); - - b.Property("BusinessAddress2") - .HasColumnType("longtext"); - - b.Property("BusinessAddress3") - .HasColumnType("longtext"); - - b.Property("BusinessCountry") - .HasColumnType("longtext"); - - b.Property("BusinessName") - .HasColumnType("longtext"); - - b.Property("BusinessTaxNumber") - .HasColumnType("longtext"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Enabled") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Status") - .HasColumnType("tinyint unsigned"); - - b.Property("UseEvents") - .HasColumnType("tinyint(1)"); - - b.HasKey("Id"); - - b.ToTable("Provider", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ProviderOrganization", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Key") - .HasColumnType("longtext"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("ProviderId") - .HasColumnType("char(36)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Settings") - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("ProviderId"); - - b.ToTable("ProviderOrganization", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ProviderUser", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Email") - .HasColumnType("longtext"); - - b.Property("Key") - .HasColumnType("longtext"); - - b.Property("Permissions") - .HasColumnType("longtext"); - - b.Property("ProviderId") - .HasColumnType("char(36)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Status") - .HasColumnType("tinyint unsigned"); - - b.Property("Type") - .HasColumnType("tinyint unsigned"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ProviderId"); - - b.HasIndex("UserId"); - - b.ToTable("ProviderUser", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Secret", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("DeletedDate") - .HasColumnType("datetime(6)"); - - b.Property("Key") - .HasColumnType("longtext"); - - b.Property("Note") - .HasColumnType("longtext"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Value") - .HasColumnType("longtext"); - - b.HasKey("Id") - .HasAnnotation("SqlServer:Clustered", true); - - b.HasIndex("DeletedDate") - .HasAnnotation("SqlServer:Clustered", false); - - b.HasIndex("OrganizationId") - .HasAnnotation("SqlServer:Clustered", false); - - b.ToTable("Secret", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Send", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("AccessCount") - .HasColumnType("int"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Data") - .HasColumnType("longtext"); - - b.Property("DeletionDate") - .HasColumnType("datetime(6)"); - - b.Property("Disabled") - .HasColumnType("tinyint(1)"); - - b.Property("ExpirationDate") - .HasColumnType("datetime(6)"); - - b.Property("HideEmail") - .HasColumnType("tinyint(1)"); - - b.Property("Key") - .HasColumnType("longtext"); - - b.Property("MaxAccessCount") - .HasColumnType("int"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("Password") - .HasMaxLength(300) - .HasColumnType("varchar(300)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Type") - .HasColumnType("tinyint unsigned"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("UserId"); - - b.ToTable("Send", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ServiceAccount", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.HasKey("Id") - .HasAnnotation("SqlServer:Clustered", true); - - b.HasIndex("OrganizationId") - .HasAnnotation("SqlServer:Clustered", false); - - b.ToTable("ServiceAccount", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.SsoConfig", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Data") - .HasColumnType("longtext"); - - b.Property("Enabled") - .HasColumnType("tinyint(1)"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.ToTable("SsoConfig", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.SsoUser", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("ExternalId") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("UserId"); - - b.ToTable("SsoUser", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.TaxRate", b => - { - b.Property("Id") - .HasMaxLength(40) - .HasColumnType("varchar(40)"); - - b.Property("Active") - .HasColumnType("tinyint(1)"); - - b.Property("Country") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("PostalCode") - .HasMaxLength(10) - .HasColumnType("varchar(10)"); - - b.Property("Rate") - .HasColumnType("decimal(65,30)"); - - b.Property("State") - .HasMaxLength(2) - .HasColumnType("varchar(2)"); - - b.HasKey("Id"); - - b.ToTable("TaxRate", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Transaction", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("Amount") - .HasColumnType("decimal(65,30)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Details") - .HasMaxLength(100) - .HasColumnType("varchar(100)"); - - b.Property("Gateway") - .HasColumnType("tinyint unsigned"); - - b.Property("GatewayId") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("PaymentMethodType") - .HasColumnType("tinyint unsigned"); - - b.Property("Refunded") - .HasColumnType("tinyint(1)"); - - b.Property("RefundedAmount") - .HasColumnType("decimal(65,30)"); - - b.Property("Type") - .HasColumnType("tinyint unsigned"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("UserId"); - - b.ToTable("Transaction", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.User", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("AccountRevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("ApiKey") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("varchar(30)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Culture") - .HasMaxLength(10) - .HasColumnType("varchar(10)"); - - b.Property("Email") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("EmailVerified") - .HasColumnType("tinyint(1)"); - - b.Property("EquivalentDomains") - .HasColumnType("longtext"); - - b.Property("ExcludedGlobalEquivalentDomains") - .HasColumnType("longtext"); - - b.Property("FailedLoginCount") - .HasColumnType("int"); - - b.Property("ForcePasswordReset") - .HasColumnType("tinyint(1)"); - - b.Property("Gateway") - .HasColumnType("tinyint unsigned"); - - b.Property("GatewayCustomerId") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("GatewaySubscriptionId") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("Kdf") - .HasColumnType("tinyint unsigned"); - - b.Property("KdfIterations") - .HasColumnType("int"); - - b.Property("Key") - .HasColumnType("longtext"); - - b.Property("LastFailedLoginDate") - .HasColumnType("datetime(6)"); - - b.Property("LicenseKey") - .HasMaxLength(100) - .HasColumnType("varchar(100)"); - - b.Property("MasterPassword") - .HasMaxLength(300) - .HasColumnType("varchar(300)"); - - b.Property("MasterPasswordHint") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("MaxStorageGb") - .HasColumnType("smallint"); - - b.Property("Name") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("Premium") - .HasColumnType("tinyint(1)"); - - b.Property("PremiumExpirationDate") - .HasColumnType("datetime(6)"); - - b.Property("PrivateKey") - .HasColumnType("longtext"); - - b.Property("PublicKey") - .HasColumnType("longtext"); - - b.Property("ReferenceData") - .HasColumnType("longtext"); - - b.Property("RenewalReminderDate") - .HasColumnType("datetime(6)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("SecurityStamp") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("Storage") - .HasColumnType("bigint"); - - b.Property("TwoFactorProviders") - .HasColumnType("longtext"); - - b.Property("TwoFactorRecoveryCode") - .HasMaxLength(32) - .HasColumnType("varchar(32)"); - - b.Property("UnknownDeviceVerificationEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("UsesKeyConnector") - .HasColumnType("tinyint(1)"); - - b.HasKey("Id"); - - b.ToTable("User", (string)null); - }); - - modelBuilder.Entity("ProjectSecret", b => - { - b.Property("ProjectsId") - .HasColumnType("char(36)"); - - b.Property("SecretsId") - .HasColumnType("char(36)"); - - b.HasKey("ProjectsId", "SecretsId"); - - b.HasIndex("SecretsId"); - - b.ToTable("ProjectSecret"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ApiKey", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.ServiceAccount", "ServiceAccount") - .WithMany() - .HasForeignKey("ServiceAccountId"); - - b.Navigation("ServiceAccount"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.AuthRequest", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Device", "ResponseDevice") - .WithMany() - .HasForeignKey("ResponseDeviceId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ResponseDevice"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Cipher", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("Ciphers") - .HasForeignKey("OrganizationId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany("Ciphers") - .HasForeignKey("UserId"); - - b.Navigation("Organization"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Collection", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany() - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionCipher", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Cipher", "Cipher") - .WithMany("CollectionCiphers") - .HasForeignKey("CipherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Collection", "Collection") - .WithMany("CollectionCiphers") - .HasForeignKey("CollectionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Cipher"); - - b.Navigation("Collection"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionGroup", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Collection", "Collection") - .WithMany("CollectionGroups") - .HasForeignKey("CollectionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Group", "Group") - .WithMany() - .HasForeignKey("GroupId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Collection"); - - b.Navigation("Group"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionUser", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Collection", "Collection") - .WithMany("CollectionUsers") - .HasForeignKey("CollectionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", "OrganizationUser") - .WithMany("CollectionUsers") - .HasForeignKey("OrganizationUserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", null) - .WithMany("CollectionUsers") - .HasForeignKey("UserId"); - - b.Navigation("Collection"); - - b.Navigation("OrganizationUser"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Device", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.EmergencyAccess", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "Grantee") - .WithMany() - .HasForeignKey("GranteeId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "Grantor") - .WithMany() - .HasForeignKey("GrantorId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Grantee"); - - b.Navigation("Grantor"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Folder", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany("Folders") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Group", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("Groups") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.GroupUser", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Group", "Group") - .WithMany("GroupUsers") - .HasForeignKey("GroupId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", "OrganizationUser") - .WithMany() - .HasForeignKey("OrganizationUserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", null) - .WithMany("GroupUsers") - .HasForeignKey("UserId"); - - b.Navigation("Group"); - - b.Navigation("OrganizationUser"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationApiKey", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("ApiKeys") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationConnection", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("Connections") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationSponsorship", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "SponsoredOrganization") - .WithMany() - .HasForeignKey("SponsoredOrganizationId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "SponsoringOrganization") - .WithMany() - .HasForeignKey("SponsoringOrganizationId"); - - b.Navigation("SponsoredOrganization"); - - b.Navigation("SponsoringOrganization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("OrganizationUsers") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany("OrganizationUsers") - .HasForeignKey("UserId"); - - b.Navigation("Organization"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Policy", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("Policies") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Project", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany() - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ProviderOrganization", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany() - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Provider", "Provider") - .WithMany() - .HasForeignKey("ProviderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - - b.Navigation("Provider"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ProviderUser", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Provider", "Provider") - .WithMany() - .HasForeignKey("ProviderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany() - .HasForeignKey("UserId"); - - b.Navigation("Provider"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Secret", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany() - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Send", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany() - .HasForeignKey("OrganizationId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany() - .HasForeignKey("UserId"); - - b.Navigation("Organization"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ServiceAccount", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany() - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.SsoConfig", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("SsoConfigs") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.SsoUser", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("SsoUsers") - .HasForeignKey("OrganizationId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany("SsoUsers") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Transaction", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("Transactions") - .HasForeignKey("OrganizationId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany("Transactions") - .HasForeignKey("UserId"); - - b.Navigation("Organization"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ProjectSecret", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Project", null) - .WithMany() - .HasForeignKey("ProjectsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Secret", null) - .WithMany() - .HasForeignKey("SecretsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Cipher", b => - { - b.Navigation("CollectionCiphers"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Collection", b => - { - b.Navigation("CollectionCiphers"); - - b.Navigation("CollectionGroups"); - - b.Navigation("CollectionUsers"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Group", b => - { - b.Navigation("GroupUsers"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Organization", b => - { - b.Navigation("ApiKeys"); - - b.Navigation("Ciphers"); - - b.Navigation("Connections"); - - b.Navigation("Groups"); - - b.Navigation("OrganizationUsers"); - - b.Navigation("Policies"); - - b.Navigation("SsoConfigs"); - - b.Navigation("SsoUsers"); - - b.Navigation("Transactions"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", b => - { - b.Navigation("CollectionUsers"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.User", b => - { - b.Navigation("Ciphers"); - - b.Navigation("CollectionUsers"); - - b.Navigation("Folders"); - - b.Navigation("GroupUsers"); - - b.Navigation("OrganizationUsers"); - - b.Navigation("SsoUsers"); - - b.Navigation("Transactions"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/util/MySqlMigrations/Migrations/20221130233348_NeverExpireApiKey.cs b/util/MySqlMigrations/Migrations/20221130233348_NeverExpireApiKey.cs deleted file mode 100644 index 44df9115abf2..000000000000 --- a/util/MySqlMigrations/Migrations/20221130233348_NeverExpireApiKey.cs +++ /dev/null @@ -1,32 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Bit.MySqlMigrations.Migrations; - -public partial class NeverExpireApiKey : Migration -{ - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "ExpireAt", - table: "ApiKey", - type: "datetime(6)", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "datetime(6)"); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "ExpireAt", - table: "ApiKey", - type: "datetime(6)", - nullable: false, - defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), - oldClrType: typeof(DateTime), - oldType: "datetime(6)", - oldNullable: true); - } -} diff --git a/util/MySqlMigrations/Migrations/20221202104048_SecretsManagerFlag.Designer.cs b/util/MySqlMigrations/Migrations/20221202104048_SecretsManagerFlag.Designer.cs deleted file mode 100644 index adf0534e6384..000000000000 --- a/util/MySqlMigrations/Migrations/20221202104048_SecretsManagerFlag.Designer.cs +++ /dev/null @@ -1,1888 +0,0 @@ -// -using System; -using Bit.Infrastructure.EntityFramework.Repositories; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace Bit.MySqlMigrations.Migrations -{ - [DbContext(typeof(DatabaseContext))] - [Migration("20221202104048_SecretsManagerFlag")] - partial class SecretsManagerFlag - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "6.0.4") - .HasAnnotation("Relational:MaxIdentifierLength", 64); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ApiKey", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("ClientSecret") - .HasMaxLength(30) - .HasColumnType("varchar(30)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("EncryptedPayload") - .HasMaxLength(4000) - .HasColumnType("varchar(4000)"); - - b.Property("ExpireAt") - .HasColumnType("datetime(6)"); - - b.Property("Key") - .HasColumnType("longtext"); - - b.Property("Name") - .HasMaxLength(200) - .HasColumnType("varchar(200)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Scope") - .HasMaxLength(4000) - .HasColumnType("varchar(4000)"); - - b.Property("ServiceAccountId") - .HasColumnType("char(36)"); - - b.HasKey("Id") - .HasAnnotation("SqlServer:Clustered", true); - - b.HasIndex("ServiceAccountId") - .HasAnnotation("SqlServer:Clustered", false); - - b.ToTable("ApiKey", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.AuthRequest", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("AccessCode") - .HasMaxLength(25) - .HasColumnType("varchar(25)"); - - b.Property("AuthenticationDate") - .HasColumnType("datetime(6)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Key") - .HasColumnType("longtext"); - - b.Property("MasterPasswordHash") - .HasColumnType("longtext"); - - b.Property("PublicKey") - .HasColumnType("longtext"); - - b.Property("RequestDeviceIdentifier") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("RequestDeviceType") - .HasColumnType("tinyint unsigned"); - - b.Property("RequestFingerprint") - .HasColumnType("longtext"); - - b.Property("RequestIpAddress") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("ResponseDate") - .HasColumnType("datetime(6)"); - - b.Property("ResponseDeviceId") - .HasColumnType("char(36)"); - - b.Property("Type") - .HasColumnType("tinyint unsigned"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ResponseDeviceId"); - - b.HasIndex("UserId"); - - b.ToTable("AuthRequest", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Cipher", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("Attachments") - .HasColumnType("longtext"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Data") - .HasColumnType("longtext"); - - b.Property("DeletedDate") - .HasColumnType("datetime(6)"); - - b.Property("Favorites") - .HasColumnType("longtext"); - - b.Property("Folders") - .HasColumnType("longtext"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("Reprompt") - .HasColumnType("tinyint unsigned"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Type") - .HasColumnType("tinyint unsigned"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("UserId"); - - b.ToTable("Cipher", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Collection", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("ExternalId") - .HasMaxLength(300) - .HasColumnType("varchar(300)"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.ToTable("Collection", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionCipher", b => - { - b.Property("CollectionId") - .HasColumnType("char(36)"); - - b.Property("CipherId") - .HasColumnType("char(36)"); - - b.HasKey("CollectionId", "CipherId"); - - b.HasIndex("CipherId"); - - b.ToTable("CollectionCipher", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionGroup", b => - { - b.Property("CollectionId") - .HasColumnType("char(36)"); - - b.Property("GroupId") - .HasColumnType("char(36)"); - - b.Property("HidePasswords") - .HasColumnType("tinyint(1)"); - - b.Property("ReadOnly") - .HasColumnType("tinyint(1)"); - - b.HasKey("CollectionId", "GroupId"); - - b.HasIndex("GroupId"); - - b.ToTable("CollectionGroups"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionUser", b => - { - b.Property("CollectionId") - .HasColumnType("char(36)"); - - b.Property("OrganizationUserId") - .HasColumnType("char(36)"); - - b.Property("HidePasswords") - .HasColumnType("tinyint(1)"); - - b.Property("ReadOnly") - .HasColumnType("tinyint(1)"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("CollectionId", "OrganizationUserId"); - - b.HasIndex("OrganizationUserId"); - - b.HasIndex("UserId"); - - b.ToTable("CollectionUsers"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Device", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Identifier") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("Name") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("PushToken") - .HasMaxLength(255) - .HasColumnType("varchar(255)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Type") - .HasColumnType("tinyint unsigned"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Device", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.EmergencyAccess", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("GranteeId") - .HasColumnType("char(36)"); - - b.Property("GrantorId") - .HasColumnType("char(36)"); - - b.Property("KeyEncrypted") - .HasColumnType("longtext"); - - b.Property("LastNotificationDate") - .HasColumnType("datetime(6)"); - - b.Property("RecoveryInitiatedDate") - .HasColumnType("datetime(6)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Status") - .HasColumnType("tinyint unsigned"); - - b.Property("Type") - .HasColumnType("tinyint unsigned"); - - b.Property("WaitTimeDays") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("GranteeId"); - - b.HasIndex("GrantorId"); - - b.ToTable("EmergencyAccess", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Event", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("ActingUserId") - .HasColumnType("char(36)"); - - b.Property("CipherId") - .HasColumnType("char(36)"); - - b.Property("CollectionId") - .HasColumnType("char(36)"); - - b.Property("Date") - .HasColumnType("datetime(6)"); - - b.Property("DeviceType") - .HasColumnType("tinyint unsigned"); - - b.Property("GroupId") - .HasColumnType("char(36)"); - - b.Property("InstallationId") - .HasColumnType("char(36)"); - - b.Property("IpAddress") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("OrganizationUserId") - .HasColumnType("char(36)"); - - b.Property("PolicyId") - .HasColumnType("char(36)"); - - b.Property("ProviderId") - .HasColumnType("char(36)"); - - b.Property("ProviderOrganizationId") - .HasColumnType("char(36)"); - - b.Property("ProviderUserId") - .HasColumnType("char(36)"); - - b.Property("Type") - .HasColumnType("int"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.ToTable("Event", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Folder", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Folder", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Grant", b => - { - b.Property("Key") - .HasMaxLength(200) - .HasColumnType("varchar(200)"); - - b.Property("ClientId") - .HasMaxLength(200) - .HasColumnType("varchar(200)"); - - b.Property("ConsumedDate") - .HasColumnType("datetime(6)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Data") - .HasColumnType("longtext"); - - b.Property("Description") - .HasMaxLength(200) - .HasColumnType("varchar(200)"); - - b.Property("ExpirationDate") - .HasColumnType("datetime(6)"); - - b.Property("SessionId") - .HasMaxLength(100) - .HasColumnType("varchar(100)"); - - b.Property("SubjectId") - .HasMaxLength(200) - .HasColumnType("varchar(200)"); - - b.Property("Type") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.HasKey("Key"); - - b.ToTable("Grant", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Group", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("AccessAll") - .HasColumnType("tinyint(1)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("ExternalId") - .HasMaxLength(300) - .HasColumnType("varchar(300)"); - - b.Property("Name") - .HasMaxLength(100) - .HasColumnType("varchar(100)"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.ToTable("Group", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.GroupUser", b => - { - b.Property("GroupId") - .HasColumnType("char(36)"); - - b.Property("OrganizationUserId") - .HasColumnType("char(36)"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("GroupId", "OrganizationUserId"); - - b.HasIndex("OrganizationUserId"); - - b.HasIndex("UserId"); - - b.ToTable("GroupUser", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Installation", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("Enabled") - .HasColumnType("tinyint(1)"); - - b.Property("Key") - .HasMaxLength(150) - .HasColumnType("varchar(150)"); - - b.HasKey("Id"); - - b.ToTable("Installation", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Organization", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("BillingEmail") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("BusinessAddress1") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("BusinessAddress2") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("BusinessAddress3") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("BusinessCountry") - .HasMaxLength(2) - .HasColumnType("varchar(2)"); - - b.Property("BusinessName") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("BusinessTaxNumber") - .HasMaxLength(30) - .HasColumnType("varchar(30)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Enabled") - .HasColumnType("tinyint(1)"); - - b.Property("ExpirationDate") - .HasColumnType("datetime(6)"); - - b.Property("Gateway") - .HasColumnType("tinyint unsigned"); - - b.Property("GatewayCustomerId") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("GatewaySubscriptionId") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("Identifier") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("LicenseKey") - .HasMaxLength(100) - .HasColumnType("varchar(100)"); - - b.Property("MaxAutoscaleSeats") - .HasColumnType("int"); - - b.Property("MaxCollections") - .HasColumnType("smallint"); - - b.Property("MaxStorageGb") - .HasColumnType("smallint"); - - b.Property("Name") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("OwnersNotifiedOfAutoscaling") - .HasColumnType("datetime(6)"); - - b.Property("Plan") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("PlanType") - .HasColumnType("tinyint unsigned"); - - b.Property("PrivateKey") - .HasColumnType("longtext"); - - b.Property("PublicKey") - .HasColumnType("longtext"); - - b.Property("ReferenceData") - .HasColumnType("longtext"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Seats") - .HasColumnType("int"); - - b.Property("SelfHost") - .HasColumnType("tinyint(1)"); - - b.Property("Storage") - .HasColumnType("bigint"); - - b.Property("TwoFactorProviders") - .HasColumnType("longtext"); - - b.Property("Use2fa") - .HasColumnType("tinyint(1)"); - - b.Property("UseApi") - .HasColumnType("tinyint(1)"); - - b.Property("UseDirectory") - .HasColumnType("tinyint(1)"); - - b.Property("UseEvents") - .HasColumnType("tinyint(1)"); - - b.Property("UseGroups") - .HasColumnType("tinyint(1)"); - - b.Property("UseKeyConnector") - .HasColumnType("tinyint(1)"); - - b.Property("UsePolicies") - .HasColumnType("tinyint(1)"); - - b.Property("UseResetPassword") - .HasColumnType("tinyint(1)"); - - b.Property("UseScim") - .HasColumnType("tinyint(1)"); - - b.Property("UseSecretsManager") - .HasColumnType("tinyint(1)"); - - b.Property("UseSso") - .HasColumnType("tinyint(1)"); - - b.Property("UseTotp") - .HasColumnType("tinyint(1)"); - - b.Property("UsersGetPremium") - .HasColumnType("tinyint(1)"); - - b.HasKey("Id"); - - b.ToTable("Organization", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationApiKey", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("ApiKey") - .HasMaxLength(30) - .HasColumnType("varchar(30)"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Type") - .HasColumnType("tinyint unsigned"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.ToTable("OrganizationApiKey", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationConnection", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("Config") - .HasColumnType("longtext"); - - b.Property("Enabled") - .HasColumnType("tinyint(1)"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("Type") - .HasColumnType("tinyint unsigned"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.ToTable("OrganizationConnection", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationSponsorship", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("FriendlyName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("LastSyncDate") - .HasColumnType("datetime(6)"); - - b.Property("OfferedToEmail") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("PlanSponsorshipType") - .HasColumnType("tinyint unsigned"); - - b.Property("SponsoredOrganizationId") - .HasColumnType("char(36)"); - - b.Property("SponsoringOrganizationId") - .HasColumnType("char(36)"); - - b.Property("SponsoringOrganizationUserId") - .HasColumnType("char(36)"); - - b.Property("ToDelete") - .HasColumnType("tinyint(1)"); - - b.Property("ValidUntil") - .HasColumnType("datetime(6)"); - - b.HasKey("Id"); - - b.HasIndex("SponsoredOrganizationId"); - - b.HasIndex("SponsoringOrganizationId"); - - b.ToTable("OrganizationSponsorship", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("AccessAll") - .HasColumnType("tinyint(1)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("ExternalId") - .HasMaxLength(300) - .HasColumnType("varchar(300)"); - - b.Property("Key") - .HasColumnType("longtext"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("Permissions") - .HasColumnType("longtext"); - - b.Property("ResetPasswordKey") - .HasColumnType("longtext"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Status") - .HasColumnType("smallint"); - - b.Property("Type") - .HasColumnType("tinyint unsigned"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("UserId"); - - b.ToTable("OrganizationUser", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Policy", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Data") - .HasColumnType("longtext"); - - b.Property("Enabled") - .HasColumnType("tinyint(1)"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Type") - .HasColumnType("tinyint unsigned"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.ToTable("Policy", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Project", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("DeletedDate") - .HasColumnType("datetime(6)"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.HasKey("Id") - .HasAnnotation("SqlServer:Clustered", true); - - b.HasIndex("DeletedDate") - .HasAnnotation("SqlServer:Clustered", false); - - b.HasIndex("OrganizationId") - .HasAnnotation("SqlServer:Clustered", false); - - b.ToTable("Project", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Provider", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("BillingEmail") - .HasColumnType("longtext"); - - b.Property("BusinessAddress1") - .HasColumnType("longtext"); - - b.Property("BusinessAddress2") - .HasColumnType("longtext"); - - b.Property("BusinessAddress3") - .HasColumnType("longtext"); - - b.Property("BusinessCountry") - .HasColumnType("longtext"); - - b.Property("BusinessName") - .HasColumnType("longtext"); - - b.Property("BusinessTaxNumber") - .HasColumnType("longtext"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Enabled") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Status") - .HasColumnType("tinyint unsigned"); - - b.Property("UseEvents") - .HasColumnType("tinyint(1)"); - - b.HasKey("Id"); - - b.ToTable("Provider", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ProviderOrganization", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Key") - .HasColumnType("longtext"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("ProviderId") - .HasColumnType("char(36)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Settings") - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("ProviderId"); - - b.ToTable("ProviderOrganization", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ProviderUser", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Email") - .HasColumnType("longtext"); - - b.Property("Key") - .HasColumnType("longtext"); - - b.Property("Permissions") - .HasColumnType("longtext"); - - b.Property("ProviderId") - .HasColumnType("char(36)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Status") - .HasColumnType("tinyint unsigned"); - - b.Property("Type") - .HasColumnType("tinyint unsigned"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("ProviderId"); - - b.HasIndex("UserId"); - - b.ToTable("ProviderUser", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Secret", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("DeletedDate") - .HasColumnType("datetime(6)"); - - b.Property("Key") - .HasColumnType("longtext"); - - b.Property("Note") - .HasColumnType("longtext"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Value") - .HasColumnType("longtext"); - - b.HasKey("Id") - .HasAnnotation("SqlServer:Clustered", true); - - b.HasIndex("DeletedDate") - .HasAnnotation("SqlServer:Clustered", false); - - b.HasIndex("OrganizationId") - .HasAnnotation("SqlServer:Clustered", false); - - b.ToTable("Secret", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Send", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("AccessCount") - .HasColumnType("int"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Data") - .HasColumnType("longtext"); - - b.Property("DeletionDate") - .HasColumnType("datetime(6)"); - - b.Property("Disabled") - .HasColumnType("tinyint(1)"); - - b.Property("ExpirationDate") - .HasColumnType("datetime(6)"); - - b.Property("HideEmail") - .HasColumnType("tinyint(1)"); - - b.Property("Key") - .HasColumnType("longtext"); - - b.Property("MaxAccessCount") - .HasColumnType("int"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("Password") - .HasMaxLength(300) - .HasColumnType("varchar(300)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("Type") - .HasColumnType("tinyint unsigned"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("UserId"); - - b.ToTable("Send", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ServiceAccount", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.HasKey("Id") - .HasAnnotation("SqlServer:Clustered", true); - - b.HasIndex("OrganizationId") - .HasAnnotation("SqlServer:Clustered", false); - - b.ToTable("ServiceAccount", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.SsoConfig", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Data") - .HasColumnType("longtext"); - - b.Property("Enabled") - .HasColumnType("tinyint(1)"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.ToTable("SsoConfig", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.SsoUser", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("ExternalId") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("UserId"); - - b.ToTable("SsoUser", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.TaxRate", b => - { - b.Property("Id") - .HasMaxLength(40) - .HasColumnType("varchar(40)"); - - b.Property("Active") - .HasColumnType("tinyint(1)"); - - b.Property("Country") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("PostalCode") - .HasMaxLength(10) - .HasColumnType("varchar(10)"); - - b.Property("Rate") - .HasColumnType("decimal(65,30)"); - - b.Property("State") - .HasMaxLength(2) - .HasColumnType("varchar(2)"); - - b.HasKey("Id"); - - b.ToTable("TaxRate", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Transaction", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("Amount") - .HasColumnType("decimal(65,30)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Details") - .HasMaxLength(100) - .HasColumnType("varchar(100)"); - - b.Property("Gateway") - .HasColumnType("tinyint unsigned"); - - b.Property("GatewayId") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("OrganizationId") - .HasColumnType("char(36)"); - - b.Property("PaymentMethodType") - .HasColumnType("tinyint unsigned"); - - b.Property("Refunded") - .HasColumnType("tinyint(1)"); - - b.Property("RefundedAmount") - .HasColumnType("decimal(65,30)"); - - b.Property("Type") - .HasColumnType("tinyint unsigned"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("UserId"); - - b.ToTable("Transaction", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.User", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("AccountRevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("ApiKey") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("varchar(30)"); - - b.Property("CreationDate") - .HasColumnType("datetime(6)"); - - b.Property("Culture") - .HasMaxLength(10) - .HasColumnType("varchar(10)"); - - b.Property("Email") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("EmailVerified") - .HasColumnType("tinyint(1)"); - - b.Property("EquivalentDomains") - .HasColumnType("longtext"); - - b.Property("ExcludedGlobalEquivalentDomains") - .HasColumnType("longtext"); - - b.Property("FailedLoginCount") - .HasColumnType("int"); - - b.Property("ForcePasswordReset") - .HasColumnType("tinyint(1)"); - - b.Property("Gateway") - .HasColumnType("tinyint unsigned"); - - b.Property("GatewayCustomerId") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("GatewaySubscriptionId") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("Kdf") - .HasColumnType("tinyint unsigned"); - - b.Property("KdfIterations") - .HasColumnType("int"); - - b.Property("Key") - .HasColumnType("longtext"); - - b.Property("LastFailedLoginDate") - .HasColumnType("datetime(6)"); - - b.Property("LicenseKey") - .HasMaxLength(100) - .HasColumnType("varchar(100)"); - - b.Property("MasterPassword") - .HasMaxLength(300) - .HasColumnType("varchar(300)"); - - b.Property("MasterPasswordHint") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("MaxStorageGb") - .HasColumnType("smallint"); - - b.Property("Name") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("Premium") - .HasColumnType("tinyint(1)"); - - b.Property("PremiumExpirationDate") - .HasColumnType("datetime(6)"); - - b.Property("PrivateKey") - .HasColumnType("longtext"); - - b.Property("PublicKey") - .HasColumnType("longtext"); - - b.Property("ReferenceData") - .HasColumnType("longtext"); - - b.Property("RenewalReminderDate") - .HasColumnType("datetime(6)"); - - b.Property("RevisionDate") - .HasColumnType("datetime(6)"); - - b.Property("SecurityStamp") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("Storage") - .HasColumnType("bigint"); - - b.Property("TwoFactorProviders") - .HasColumnType("longtext"); - - b.Property("TwoFactorRecoveryCode") - .HasMaxLength(32) - .HasColumnType("varchar(32)"); - - b.Property("UnknownDeviceVerificationEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("UsesKeyConnector") - .HasColumnType("tinyint(1)"); - - b.HasKey("Id"); - - b.ToTable("User", (string)null); - }); - - modelBuilder.Entity("ProjectSecret", b => - { - b.Property("ProjectsId") - .HasColumnType("char(36)"); - - b.Property("SecretsId") - .HasColumnType("char(36)"); - - b.HasKey("ProjectsId", "SecretsId"); - - b.HasIndex("SecretsId"); - - b.ToTable("ProjectSecret"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ApiKey", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.ServiceAccount", "ServiceAccount") - .WithMany() - .HasForeignKey("ServiceAccountId"); - - b.Navigation("ServiceAccount"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.AuthRequest", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Device", "ResponseDevice") - .WithMany() - .HasForeignKey("ResponseDeviceId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ResponseDevice"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Cipher", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("Ciphers") - .HasForeignKey("OrganizationId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany("Ciphers") - .HasForeignKey("UserId"); - - b.Navigation("Organization"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Collection", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany() - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionCipher", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Cipher", "Cipher") - .WithMany("CollectionCiphers") - .HasForeignKey("CipherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Collection", "Collection") - .WithMany("CollectionCiphers") - .HasForeignKey("CollectionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Cipher"); - - b.Navigation("Collection"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionGroup", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Collection", "Collection") - .WithMany("CollectionGroups") - .HasForeignKey("CollectionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Group", "Group") - .WithMany() - .HasForeignKey("GroupId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Collection"); - - b.Navigation("Group"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionUser", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Collection", "Collection") - .WithMany("CollectionUsers") - .HasForeignKey("CollectionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", "OrganizationUser") - .WithMany("CollectionUsers") - .HasForeignKey("OrganizationUserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", null) - .WithMany("CollectionUsers") - .HasForeignKey("UserId"); - - b.Navigation("Collection"); - - b.Navigation("OrganizationUser"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Device", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.EmergencyAccess", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "Grantee") - .WithMany() - .HasForeignKey("GranteeId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "Grantor") - .WithMany() - .HasForeignKey("GrantorId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Grantee"); - - b.Navigation("Grantor"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Folder", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany("Folders") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Group", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("Groups") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.GroupUser", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Group", "Group") - .WithMany("GroupUsers") - .HasForeignKey("GroupId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", "OrganizationUser") - .WithMany() - .HasForeignKey("OrganizationUserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", null) - .WithMany("GroupUsers") - .HasForeignKey("UserId"); - - b.Navigation("Group"); - - b.Navigation("OrganizationUser"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationApiKey", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("ApiKeys") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationConnection", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("Connections") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationSponsorship", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "SponsoredOrganization") - .WithMany() - .HasForeignKey("SponsoredOrganizationId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "SponsoringOrganization") - .WithMany() - .HasForeignKey("SponsoringOrganizationId"); - - b.Navigation("SponsoredOrganization"); - - b.Navigation("SponsoringOrganization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("OrganizationUsers") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany("OrganizationUsers") - .HasForeignKey("UserId"); - - b.Navigation("Organization"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Policy", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("Policies") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Project", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany() - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ProviderOrganization", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany() - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Provider", "Provider") - .WithMany() - .HasForeignKey("ProviderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - - b.Navigation("Provider"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ProviderUser", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Provider", "Provider") - .WithMany() - .HasForeignKey("ProviderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany() - .HasForeignKey("UserId"); - - b.Navigation("Provider"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Secret", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany() - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Send", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany() - .HasForeignKey("OrganizationId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany() - .HasForeignKey("UserId"); - - b.Navigation("Organization"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ServiceAccount", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany() - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.SsoConfig", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("SsoConfigs") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.SsoUser", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("SsoUsers") - .HasForeignKey("OrganizationId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany("SsoUsers") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Transaction", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("Transactions") - .HasForeignKey("OrganizationId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany("Transactions") - .HasForeignKey("UserId"); - - b.Navigation("Organization"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ProjectSecret", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Project", null) - .WithMany() - .HasForeignKey("ProjectsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Secret", null) - .WithMany() - .HasForeignKey("SecretsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Cipher", b => - { - b.Navigation("CollectionCiphers"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Collection", b => - { - b.Navigation("CollectionCiphers"); - - b.Navigation("CollectionGroups"); - - b.Navigation("CollectionUsers"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Group", b => - { - b.Navigation("GroupUsers"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Organization", b => - { - b.Navigation("ApiKeys"); - - b.Navigation("Ciphers"); - - b.Navigation("Connections"); - - b.Navigation("Groups"); - - b.Navigation("OrganizationUsers"); - - b.Navigation("Policies"); - - b.Navigation("SsoConfigs"); - - b.Navigation("SsoUsers"); - - b.Navigation("Transactions"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", b => - { - b.Navigation("CollectionUsers"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.User", b => - { - b.Navigation("Ciphers"); - - b.Navigation("CollectionUsers"); - - b.Navigation("Folders"); - - b.Navigation("GroupUsers"); - - b.Navigation("OrganizationUsers"); - - b.Navigation("SsoUsers"); - - b.Navigation("Transactions"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/util/MySqlMigrations/Migrations/20221202104048_SecretsManagerFlag.cs b/util/MySqlMigrations/Migrations/20221202104048_SecretsManagerFlag.cs deleted file mode 100644 index 5ddce8d8f943..000000000000 --- a/util/MySqlMigrations/Migrations/20221202104048_SecretsManagerFlag.cs +++ /dev/null @@ -1,25 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Bit.MySqlMigrations.Migrations; - -public partial class SecretsManagerFlag : Migration -{ - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "UseSecretsManager", - table: "Organization", - type: "tinyint(1)", - nullable: false, - defaultValue: false); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "UseSecretsManager", - table: "Organization"); - } -} diff --git a/util/MySqlMigrations/Migrations/20221125153348_AccessPolicy.Designer.cs b/util/MySqlMigrations/Migrations/20230106122006_SecretsManager.Designer.cs similarity index 98% rename from util/MySqlMigrations/Migrations/20221125153348_AccessPolicy.Designer.cs rename to util/MySqlMigrations/Migrations/20230106122006_SecretsManager.Designer.cs index 9ff0de8e7bba..f01ac93a92cb 100644 --- a/util/MySqlMigrations/Migrations/20221125153348_AccessPolicy.Designer.cs +++ b/util/MySqlMigrations/Migrations/20230106122006_SecretsManager.Designer.cs @@ -11,14 +11,14 @@ namespace Bit.MySqlMigrations.Migrations { [DbContext(typeof(DatabaseContext))] - [Migration("20221125153348_AccessPolicy")] - partial class AccessPolicy + [Migration("20230106122006_SecretsManager")] + partial class SecretsManager { protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "6.0.4") + .HasAnnotation("ProductVersion", "6.0.12") .HasAnnotation("Relational:MaxIdentifierLength", 64); modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.AccessPolicy", b => @@ -66,7 +66,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasMaxLength(4000) .HasColumnType("varchar(4000)"); - b.Property("ExpireAt") + b.Property("ExpireAt") .HasColumnType("datetime(6)"); b.Property("Key") @@ -104,6 +104,9 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasMaxLength(25) .HasColumnType("varchar(25)"); + b.Property("Approved") + .HasColumnType("tinyint(1)"); + b.Property("AuthenticationDate") .HasColumnType("datetime(6)"); @@ -424,6 +427,9 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.Property("ProviderUserId") .HasColumnType("char(36)"); + b.Property("SystemUser") + .HasColumnType("tinyint unsigned"); + b.Property("Type") .HasColumnType("int"); @@ -692,6 +698,9 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.Property("UseApi") .HasColumnType("tinyint(1)"); + b.Property("UseCustomPermissions") + .HasColumnType("tinyint(1)"); + b.Property("UseDirectory") .HasColumnType("tinyint(1)"); @@ -713,6 +722,9 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.Property("UseScim") .HasColumnType("tinyint(1)"); + b.Property("UseSecretsManager") + .HasColumnType("tinyint(1)"); + b.Property("UseSso") .HasColumnType("tinyint(1)"); @@ -1323,6 +1335,10 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasMaxLength(30) .HasColumnType("varchar(30)"); + b.Property("AvatarColor") + .HasMaxLength(7) + .HasColumnType("varchar(7)"); + b.Property("CreationDate") .HasColumnType("datetime(6)"); diff --git a/util/MySqlMigrations/Migrations/20230106122006_SecretsManager.cs b/util/MySqlMigrations/Migrations/20230106122006_SecretsManager.cs new file mode 100644 index 000000000000..c14ccfe4e9cf --- /dev/null +++ b/util/MySqlMigrations/Migrations/20230106122006_SecretsManager.cs @@ -0,0 +1,282 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Bit.MySqlMigrations.Migrations; + +public partial class SecretsManager : Migration +{ + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "UseSecretsManager", + table: "Organization", + type: "tinyint(1)", + nullable: false, + defaultValue: false); + + migrationBuilder.CreateTable( + name: "Project", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + OrganizationId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + Name = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + CreationDate = table.Column(type: "datetime(6)", nullable: false), + RevisionDate = table.Column(type: "datetime(6)", nullable: false), + DeletedDate = table.Column(type: "datetime(6)", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Project", x => x.Id); + table.ForeignKey( + name: "FK_Project_Organization_OrganizationId", + column: x => x.OrganizationId, + principalTable: "Organization", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "Secret", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + OrganizationId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + Key = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + Value = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + Note = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + CreationDate = table.Column(type: "datetime(6)", nullable: false), + RevisionDate = table.Column(type: "datetime(6)", nullable: false), + DeletedDate = table.Column(type: "datetime(6)", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Secret", x => x.Id); + table.ForeignKey( + name: "FK_Secret_Organization_OrganizationId", + column: x => x.OrganizationId, + principalTable: "Organization", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "ServiceAccount", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + OrganizationId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + Name = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + CreationDate = table.Column(type: "datetime(6)", nullable: false), + RevisionDate = table.Column(type: "datetime(6)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ServiceAccount", x => x.Id); + table.ForeignKey( + name: "FK_ServiceAccount_Organization_OrganizationId", + column: x => x.OrganizationId, + principalTable: "Organization", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "ProjectSecret", + columns: table => new + { + ProjectsId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + SecretsId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_ProjectSecret", x => new { x.ProjectsId, x.SecretsId }); + table.ForeignKey( + name: "FK_ProjectSecret_Project_ProjectsId", + column: x => x.ProjectsId, + principalTable: "Project", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ProjectSecret_Secret_SecretsId", + column: x => x.SecretsId, + principalTable: "Secret", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "AccessPolicy", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + GroupId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), + GrantedProjectId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), + GrantedServiceAccountId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), + ServiceAccountId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), + OrganizationUserId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), + Read = table.Column(type: "tinyint(1)", nullable: false), + Write = table.Column(type: "tinyint(1)", nullable: false), + CreationDate = table.Column(type: "datetime(6)", nullable: false), + RevisionDate = table.Column(type: "datetime(6)", nullable: false), + Discriminator = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4") + }, + constraints: table => + { + table.PrimaryKey("PK_AccessPolicy", x => x.Id); + table.ForeignKey( + name: "FK_AccessPolicy_Group_GroupId", + column: x => x.GroupId, + principalTable: "Group", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_AccessPolicy_OrganizationUser_OrganizationUserId", + column: x => x.OrganizationUserId, + principalTable: "OrganizationUser", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_AccessPolicy_Project_GrantedProjectId", + column: x => x.GrantedProjectId, + principalTable: "Project", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_AccessPolicy_ServiceAccount_GrantedServiceAccountId", + column: x => x.GrantedServiceAccountId, + principalTable: "ServiceAccount", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_AccessPolicy_ServiceAccount_ServiceAccountId", + column: x => x.ServiceAccountId, + principalTable: "ServiceAccount", + principalColumn: "Id"); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "ApiKey", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + ServiceAccountId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), + Name = table.Column(type: "varchar(200)", maxLength: 200, nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + ClientSecret = table.Column(type: "varchar(30)", maxLength: 30, nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + Scope = table.Column(type: "varchar(4000)", maxLength: 4000, nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + EncryptedPayload = table.Column(type: "varchar(4000)", maxLength: 4000, nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + Key = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + ExpireAt = table.Column(type: "datetime(6)", nullable: true), + CreationDate = table.Column(type: "datetime(6)", nullable: false), + RevisionDate = table.Column(type: "datetime(6)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ApiKey", x => x.Id); + table.ForeignKey( + name: "FK_ApiKey_ServiceAccount_ServiceAccountId", + column: x => x.ServiceAccountId, + principalTable: "ServiceAccount", + principalColumn: "Id"); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateIndex( + name: "IX_AccessPolicy_GrantedProjectId", + table: "AccessPolicy", + column: "GrantedProjectId"); + + migrationBuilder.CreateIndex( + name: "IX_AccessPolicy_GrantedServiceAccountId", + table: "AccessPolicy", + column: "GrantedServiceAccountId"); + + migrationBuilder.CreateIndex( + name: "IX_AccessPolicy_GroupId", + table: "AccessPolicy", + column: "GroupId"); + + migrationBuilder.CreateIndex( + name: "IX_AccessPolicy_OrganizationUserId", + table: "AccessPolicy", + column: "OrganizationUserId"); + + migrationBuilder.CreateIndex( + name: "IX_AccessPolicy_ServiceAccountId", + table: "AccessPolicy", + column: "ServiceAccountId"); + + migrationBuilder.CreateIndex( + name: "IX_ApiKey_ServiceAccountId", + table: "ApiKey", + column: "ServiceAccountId"); + + migrationBuilder.CreateIndex( + name: "IX_Project_DeletedDate", + table: "Project", + column: "DeletedDate"); + + migrationBuilder.CreateIndex( + name: "IX_Project_OrganizationId", + table: "Project", + column: "OrganizationId"); + + migrationBuilder.CreateIndex( + name: "IX_ProjectSecret_SecretsId", + table: "ProjectSecret", + column: "SecretsId"); + + migrationBuilder.CreateIndex( + name: "IX_Secret_DeletedDate", + table: "Secret", + column: "DeletedDate"); + + migrationBuilder.CreateIndex( + name: "IX_Secret_OrganizationId", + table: "Secret", + column: "OrganizationId"); + + migrationBuilder.CreateIndex( + name: "IX_ServiceAccount_OrganizationId", + table: "ServiceAccount", + column: "OrganizationId"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "AccessPolicy"); + + migrationBuilder.DropTable( + name: "ApiKey"); + + migrationBuilder.DropTable( + name: "ProjectSecret"); + + migrationBuilder.DropTable( + name: "ServiceAccount"); + + migrationBuilder.DropTable( + name: "Project"); + + migrationBuilder.DropTable( + name: "Secret"); + + migrationBuilder.DropColumn( + name: "UseSecretsManager", + table: "Organization"); + } +} diff --git a/util/MySqlMigrations/Migrations/DatabaseContextModelSnapshot.cs b/util/MySqlMigrations/Migrations/DatabaseContextModelSnapshot.cs index 1ef2732851a8..b3c6c1220450 100644 --- a/util/MySqlMigrations/Migrations/DatabaseContextModelSnapshot.cs +++ b/util/MySqlMigrations/Migrations/DatabaseContextModelSnapshot.cs @@ -16,7 +16,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "6.0.4") + .HasAnnotation("ProductVersion", "6.0.12") .HasAnnotation("Relational:MaxIdentifierLength", 64); modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.AccessPolicy", b => diff --git a/util/MySqlMigrations/Scripts/2022-07-20_00_CreateSecretTable.sql b/util/MySqlMigrations/Scripts/2022-07-20_00_CreateSecretTable.sql deleted file mode 100644 index 75bf9c64ee54..000000000000 --- a/util/MySqlMigrations/Scripts/2022-07-20_00_CreateSecretTable.sql +++ /dev/null @@ -1,23 +0,0 @@ -START TRANSACTION; - -CREATE TABLE `Secret` ( - `Id` char(36) COLLATE ascii_general_ci NOT NULL, - `OrganizationId` char(36) COLLATE ascii_general_ci NOT NULL, - `Key` longtext CHARACTER SET utf8mb4 NULL, - `Value` longtext CHARACTER SET utf8mb4 NULL, - `Note` longtext CHARACTER SET utf8mb4 NULL, - `CreationDate` datetime(6) NOT NULL, - `RevisionDate` datetime(6) NOT NULL, - `DeletedDate` datetime(6) NULL, - CONSTRAINT `PK_Secret` PRIMARY KEY (`Id`), - CONSTRAINT `FK_Secret_Organization_OrganizationId` FOREIGN KEY (`OrganizationId`) REFERENCES `Organization` (`Id`) ON DELETE CASCADE -) CHARACTER SET=utf8mb4; - -CREATE INDEX `IX_Secret_DeletedDate` ON `Secret` (`DeletedDate`); - -CREATE INDEX `IX_Secret_OrganizationId` ON `Secret` (`OrganizationId`); - -INSERT INTO `__EFMigrationsHistory` (`MigrationId`, `ProductVersion`) -VALUES ('20220720222516_CreateSecretTable', '6.0.4'); - -COMMIT; \ No newline at end of file diff --git a/util/MySqlMigrations/Scripts/2022-08-18_00_CreateProjectTable.sql b/util/MySqlMigrations/Scripts/2022-08-18_00_CreateProjectTable.sql deleted file mode 100644 index ace474ffda75..000000000000 --- a/util/MySqlMigrations/Scripts/2022-08-18_00_CreateProjectTable.sql +++ /dev/null @@ -1,21 +0,0 @@ -START TRANSACTION; - -CREATE TABLE `Project` ( - `Id` char(36) COLLATE ascii_general_ci NOT NULL, - `OrganizationId` char(36) COLLATE ascii_general_ci NOT NULL, - `Name` longtext CHARACTER SET utf8mb4 NULL, - `CreationDate` datetime(6) NOT NULL, - `RevisionDate` datetime(6) NOT NULL, - `DeletedDate` datetime(6) NULL, - CONSTRAINT `PK_Project` PRIMARY KEY (`Id`), - CONSTRAINT `FK_Project_Organization_OrganizationId` FOREIGN KEY (`OrganizationId`) REFERENCES `Organization` (`Id`) ON DELETE CASCADE -) CHARACTER SET=utf8mb4; - -CREATE INDEX `IX_Project_DeletedDate` ON `Project` (`DeletedDate`); - -CREATE INDEX `IX_Project_OrganizationId` ON `Project` (`OrganizationId`); - -INSERT INTO `__EFMigrationsHistory` (`MigrationId`, `ProductVersion`) -VALUES ('20220830195738_CreateProjectTable', '6.0.4'); - -COMMIT; diff --git a/util/MySqlMigrations/Scripts/2022-09-26_00_SmServiceAccount.sql b/util/MySqlMigrations/Scripts/2022-09-26_00_SmServiceAccount.sql deleted file mode 100644 index a1f3be5af196..000000000000 --- a/util/MySqlMigrations/Scripts/2022-09-26_00_SmServiceAccount.sql +++ /dev/null @@ -1,18 +0,0 @@ -START TRANSACTION; - -CREATE TABLE `ServiceAccount` ( - `Id` char(36) COLLATE ascii_general_ci NOT NULL, - `OrganizationId` char(36) COLLATE ascii_general_ci NOT NULL, - `Name` longtext CHARACTER SET utf8mb4 NULL, - `CreationDate` datetime(6) NOT NULL, - `RevisionDate` datetime(6) NOT NULL, - CONSTRAINT `PK_ServiceAccount` PRIMARY KEY (`Id`), - CONSTRAINT `FK_ServiceAccount_Organization_OrganizationId` FOREIGN KEY (`OrganizationId`) REFERENCES `Organization` (`Id`) ON DELETE CASCADE -) CHARACTER SET=utf8mb4; - -CREATE INDEX `IX_ServiceAccount_OrganizationId` ON `ServiceAccount` (`OrganizationId`); - -INSERT INTO `__EFMigrationsHistory` (`MigrationId`, `ProductVersion`) -VALUES ('20220926191322_SmServiceAccount', '6.0.4'); - -COMMIT; diff --git a/util/MySqlMigrations/Scripts/2022-09-27_00_ApiKey.sql b/util/MySqlMigrations/Scripts/2022-09-27_00_ApiKey.sql deleted file mode 100644 index 0b8f7cfcbf25..000000000000 --- a/util/MySqlMigrations/Scripts/2022-09-27_00_ApiKey.sql +++ /dev/null @@ -1,23 +0,0 @@ -START TRANSACTION; - -CREATE TABLE `ApiKey` ( - `Id` char(36) COLLATE ascii_general_ci NOT NULL, - `ServiceAccountId` char(36) COLLATE ascii_general_ci NULL, - `Name` varchar(200) CHARACTER SET utf8mb4 NULL, - `ClientSecret` varchar(30) CHARACTER SET utf8mb4 NULL, - `Scope` varchar(4000) CHARACTER SET utf8mb4 NULL, - `EncryptedPayload` varchar(4000) CHARACTER SET utf8mb4 NULL, - `Key` longtext CHARACTER SET utf8mb4 NULL, - `ExpireAt` datetime(6) NOT NULL, - `CreationDate` datetime(6) NOT NULL, - `RevisionDate` datetime(6) NOT NULL, - CONSTRAINT `PK_ApiKey` PRIMARY KEY (`Id`), - CONSTRAINT `FK_ApiKey_ServiceAccount_ServiceAccountId` FOREIGN KEY (`ServiceAccountId`) REFERENCES `ServiceAccount` (`Id`) -) CHARACTER SET=utf8mb4; - -CREATE INDEX `IX_ApiKey_ServiceAccountId` ON `ApiKey` (`ServiceAccountId`); - -INSERT INTO `__EFMigrationsHistory` (`MigrationId`, `ProductVersion`) -VALUES ('20221010151710_ApiKey', '6.0.4'); - -COMMIT; diff --git a/util/MySqlMigrations/Scripts/2022-10-18_00_ProjectSecret.sql b/util/MySqlMigrations/Scripts/2022-10-18_00_ProjectSecret.sql deleted file mode 100644 index e5f1c3d8557f..000000000000 --- a/util/MySqlMigrations/Scripts/2022-10-18_00_ProjectSecret.sql +++ /dev/null @@ -1,16 +0,0 @@ -START TRANSACTION; - -CREATE TABLE `ProjectSecret` ( - `ProjectsId` char(36) COLLATE ascii_general_ci NOT NULL, - `SecretsId` char(36) COLLATE ascii_general_ci NOT NULL, - CONSTRAINT `PK_ProjectSecret` PRIMARY KEY (`ProjectsId`, `SecretsId`), - CONSTRAINT `FK_ProjectSecret_Project_ProjectsId` FOREIGN KEY (`ProjectsId`) REFERENCES `Project` (`Id`) ON DELETE CASCADE, - CONSTRAINT `FK_ProjectSecret_Secret_SecretsId` FOREIGN KEY (`SecretsId`) REFERENCES `Secret` (`Id`) ON DELETE CASCADE -) CHARACTER SET=utf8mb4; - -CREATE INDEX `IX_ProjectSecret_SecretsId` ON `ProjectSecret` (`SecretsId`); - -INSERT INTO `__EFMigrationsHistory` (`MigrationId`, `ProductVersion`) -VALUES ('20221018133046_ProjectSecret', '6.0.4'); - -COMMIT; diff --git a/util/MySqlMigrations/Scripts/2022-11-25_00_AccessPolicy.sql b/util/MySqlMigrations/Scripts/2022-11-25_00_AccessPolicy.sql deleted file mode 100644 index 887929902efd..000000000000 --- a/util/MySqlMigrations/Scripts/2022-11-25_00_AccessPolicy.sql +++ /dev/null @@ -1,36 +0,0 @@ -START TRANSACTION; - -CREATE TABLE `AccessPolicy` ( - `Id` char(36) COLLATE ascii_general_ci NOT NULL, - `GroupId` char(36) COLLATE ascii_general_ci NULL, - `GrantedProjectId` char(36) COLLATE ascii_general_ci NULL, - `GrantedServiceAccountId` char(36) COLLATE ascii_general_ci NULL, - `ServiceAccountId` char(36) COLLATE ascii_general_ci NULL, - `OrganizationUserId` char(36) COLLATE ascii_general_ci NULL, - `Read` tinyint(1) NOT NULL, - `Write` tinyint(1) NOT NULL, - `CreationDate` datetime(6) NOT NULL, - `RevisionDate` datetime(6) NOT NULL, - `Discriminator` longtext CHARACTER SET utf8mb4 NOT NULL, - CONSTRAINT `PK_AccessPolicy` PRIMARY KEY (`Id`), - CONSTRAINT `FK_AccessPolicy_Group_GroupId` FOREIGN KEY (`GroupId`) REFERENCES `Group` (`Id`), - CONSTRAINT `FK_AccessPolicy_OrganizationUser_OrganizationUserId` FOREIGN KEY (`OrganizationUserId`) REFERENCES `OrganizationUser` (`Id`), - CONSTRAINT `FK_AccessPolicy_Project_GrantedProjectId` FOREIGN KEY (`GrantedProjectId`) REFERENCES `Project` (`Id`), - CONSTRAINT `FK_AccessPolicy_ServiceAccount_GrantedServiceAccountId` FOREIGN KEY (`GrantedServiceAccountId`) REFERENCES `ServiceAccount` (`Id`), - CONSTRAINT `FK_AccessPolicy_ServiceAccount_ServiceAccountId` FOREIGN KEY (`ServiceAccountId`) REFERENCES `ServiceAccount` (`Id`) -) CHARACTER SET=utf8mb4; - -CREATE INDEX `IX_AccessPolicy_GrantedProjectId` ON `AccessPolicy` (`GrantedProjectId`); - -CREATE INDEX `IX_AccessPolicy_GrantedServiceAccountId` ON `AccessPolicy` (`GrantedServiceAccountId`); - -CREATE INDEX `IX_AccessPolicy_GroupId` ON `AccessPolicy` (`GroupId`); - -CREATE INDEX `IX_AccessPolicy_OrganizationUserId` ON `AccessPolicy` (`OrganizationUserId`); - -CREATE INDEX `IX_AccessPolicy_ServiceAccountId` ON `AccessPolicy` (`ServiceAccountId`); - -INSERT INTO `__EFMigrationsHistory` (`MigrationId`, `ProductVersion`) -VALUES ('20221125153348_AccessPolicy', '6.0.4'); - -COMMIT; diff --git a/util/MySqlMigrations/Scripts/2022-11-30_00_NeverExpireApiKey.sql b/util/MySqlMigrations/Scripts/2022-11-30_00_NeverExpireApiKey.sql deleted file mode 100644 index cf0bc60d027b..000000000000 --- a/util/MySqlMigrations/Scripts/2022-11-30_00_NeverExpireApiKey.sql +++ /dev/null @@ -1,8 +0,0 @@ -START TRANSACTION; - -ALTER TABLE `ApiKey` MODIFY COLUMN `ExpireAt` datetime(6) NULL; - -INSERT INTO `__EFMigrationsHistory` (`MigrationId`, `ProductVersion`) -VALUES ('20221130233348_NeverExpireApiKey', '6.0.4'); - -COMMIT; diff --git a/util/MySqlMigrations/Scripts/2022-12-02_00_SecretsManagerFlag.sql b/util/MySqlMigrations/Scripts/2022-12-02_00_SecretsManagerFlag.sql deleted file mode 100644 index 8d9604cf8d4c..000000000000 --- a/util/MySqlMigrations/Scripts/2022-12-02_00_SecretsManagerFlag.sql +++ /dev/null @@ -1,8 +0,0 @@ -START TRANSACTION; - -ALTER TABLE `Organization` ADD `UseSecretsManager` tinyint(1) NOT NULL DEFAULT FALSE; - -INSERT INTO `__EFMigrationsHistory` (`MigrationId`, `ProductVersion`) -VALUES ('20221202104048_SecretsManagerFlag', '6.0.4'); - -COMMIT; diff --git a/util/MySqlMigrations/Scripts/2023-01-06_00_SecretsManager.sql b/util/MySqlMigrations/Scripts/2023-01-06_00_SecretsManager.sql new file mode 100644 index 000000000000..42f12581eaa0 --- /dev/null +++ b/util/MySqlMigrations/Scripts/2023-01-06_00_SecretsManager.sql @@ -0,0 +1,109 @@ +START TRANSACTION; + +ALTER TABLE `Organization` ADD `UseSecretsManager` tinyint(1) NOT NULL DEFAULT FALSE; + +CREATE TABLE `Project` ( + `Id` char(36) COLLATE ascii_general_ci NOT NULL, + `OrganizationId` char(36) COLLATE ascii_general_ci NOT NULL, + `Name` longtext CHARACTER SET utf8mb4 NULL, + `CreationDate` datetime(6) NOT NULL, + `RevisionDate` datetime(6) NOT NULL, + `DeletedDate` datetime(6) NULL, + CONSTRAINT `PK_Project` PRIMARY KEY (`Id`), + CONSTRAINT `FK_Project_Organization_OrganizationId` FOREIGN KEY (`OrganizationId`) REFERENCES `Organization` (`Id`) ON DELETE CASCADE +) CHARACTER SET=utf8mb4; + +CREATE TABLE `Secret` ( + `Id` char(36) COLLATE ascii_general_ci NOT NULL, + `OrganizationId` char(36) COLLATE ascii_general_ci NOT NULL, + `Key` longtext CHARACTER SET utf8mb4 NULL, + `Value` longtext CHARACTER SET utf8mb4 NULL, + `Note` longtext CHARACTER SET utf8mb4 NULL, + `CreationDate` datetime(6) NOT NULL, + `RevisionDate` datetime(6) NOT NULL, + `DeletedDate` datetime(6) NULL, + CONSTRAINT `PK_Secret` PRIMARY KEY (`Id`), + CONSTRAINT `FK_Secret_Organization_OrganizationId` FOREIGN KEY (`OrganizationId`) REFERENCES `Organization` (`Id`) ON DELETE CASCADE +) CHARACTER SET=utf8mb4; + +CREATE TABLE `ServiceAccount` ( + `Id` char(36) COLLATE ascii_general_ci NOT NULL, + `OrganizationId` char(36) COLLATE ascii_general_ci NOT NULL, + `Name` longtext CHARACTER SET utf8mb4 NULL, + `CreationDate` datetime(6) NOT NULL, + `RevisionDate` datetime(6) NOT NULL, + CONSTRAINT `PK_ServiceAccount` PRIMARY KEY (`Id`), + CONSTRAINT `FK_ServiceAccount_Organization_OrganizationId` FOREIGN KEY (`OrganizationId`) REFERENCES `Organization` (`Id`) ON DELETE CASCADE +) CHARACTER SET=utf8mb4; + +CREATE TABLE `ProjectSecret` ( + `ProjectsId` char(36) COLLATE ascii_general_ci NOT NULL, + `SecretsId` char(36) COLLATE ascii_general_ci NOT NULL, + CONSTRAINT `PK_ProjectSecret` PRIMARY KEY (`ProjectsId`, `SecretsId`), + CONSTRAINT `FK_ProjectSecret_Project_ProjectsId` FOREIGN KEY (`ProjectsId`) REFERENCES `Project` (`Id`) ON DELETE CASCADE, + CONSTRAINT `FK_ProjectSecret_Secret_SecretsId` FOREIGN KEY (`SecretsId`) REFERENCES `Secret` (`Id`) ON DELETE CASCADE +) CHARACTER SET=utf8mb4; + +CREATE TABLE `AccessPolicy` ( + `Id` char(36) COLLATE ascii_general_ci NOT NULL, + `GroupId` char(36) COLLATE ascii_general_ci NULL, + `GrantedProjectId` char(36) COLLATE ascii_general_ci NULL, + `GrantedServiceAccountId` char(36) COLLATE ascii_general_ci NULL, + `ServiceAccountId` char(36) COLLATE ascii_general_ci NULL, + `OrganizationUserId` char(36) COLLATE ascii_general_ci NULL, + `Read` tinyint(1) NOT NULL, + `Write` tinyint(1) NOT NULL, + `CreationDate` datetime(6) NOT NULL, + `RevisionDate` datetime(6) NOT NULL, + `Discriminator` longtext CHARACTER SET utf8mb4 NOT NULL, + CONSTRAINT `PK_AccessPolicy` PRIMARY KEY (`Id`), + CONSTRAINT `FK_AccessPolicy_Group_GroupId` FOREIGN KEY (`GroupId`) REFERENCES `Group` (`Id`), + CONSTRAINT `FK_AccessPolicy_OrganizationUser_OrganizationUserId` FOREIGN KEY (`OrganizationUserId`) REFERENCES `OrganizationUser` (`Id`), + CONSTRAINT `FK_AccessPolicy_Project_GrantedProjectId` FOREIGN KEY (`GrantedProjectId`) REFERENCES `Project` (`Id`), + CONSTRAINT `FK_AccessPolicy_ServiceAccount_GrantedServiceAccountId` FOREIGN KEY (`GrantedServiceAccountId`) REFERENCES `ServiceAccount` (`Id`), + CONSTRAINT `FK_AccessPolicy_ServiceAccount_ServiceAccountId` FOREIGN KEY (`ServiceAccountId`) REFERENCES `ServiceAccount` (`Id`) +) CHARACTER SET=utf8mb4; + +CREATE TABLE `ApiKey` ( + `Id` char(36) COLLATE ascii_general_ci NOT NULL, + `ServiceAccountId` char(36) COLLATE ascii_general_ci NULL, + `Name` varchar(200) CHARACTER SET utf8mb4 NULL, + `ClientSecret` varchar(30) CHARACTER SET utf8mb4 NULL, + `Scope` varchar(4000) CHARACTER SET utf8mb4 NULL, + `EncryptedPayload` varchar(4000) CHARACTER SET utf8mb4 NULL, + `Key` longtext CHARACTER SET utf8mb4 NULL, + `ExpireAt` datetime(6) NULL, + `CreationDate` datetime(6) NOT NULL, + `RevisionDate` datetime(6) NOT NULL, + CONSTRAINT `PK_ApiKey` PRIMARY KEY (`Id`), + CONSTRAINT `FK_ApiKey_ServiceAccount_ServiceAccountId` FOREIGN KEY (`ServiceAccountId`) REFERENCES `ServiceAccount` (`Id`) +) CHARACTER SET=utf8mb4; + +CREATE INDEX `IX_AccessPolicy_GrantedProjectId` ON `AccessPolicy` (`GrantedProjectId`); + +CREATE INDEX `IX_AccessPolicy_GrantedServiceAccountId` ON `AccessPolicy` (`GrantedServiceAccountId`); + +CREATE INDEX `IX_AccessPolicy_GroupId` ON `AccessPolicy` (`GroupId`); + +CREATE INDEX `IX_AccessPolicy_OrganizationUserId` ON `AccessPolicy` (`OrganizationUserId`); + +CREATE INDEX `IX_AccessPolicy_ServiceAccountId` ON `AccessPolicy` (`ServiceAccountId`); + +CREATE INDEX `IX_ApiKey_ServiceAccountId` ON `ApiKey` (`ServiceAccountId`); + +CREATE INDEX `IX_Project_DeletedDate` ON `Project` (`DeletedDate`); + +CREATE INDEX `IX_Project_OrganizationId` ON `Project` (`OrganizationId`); + +CREATE INDEX `IX_ProjectSecret_SecretsId` ON `ProjectSecret` (`SecretsId`); + +CREATE INDEX `IX_Secret_DeletedDate` ON `Secret` (`DeletedDate`); + +CREATE INDEX `IX_Secret_OrganizationId` ON `Secret` (`OrganizationId`); + +CREATE INDEX `IX_ServiceAccount_OrganizationId` ON `ServiceAccount` (`OrganizationId`); + +INSERT INTO `__EFMigrationsHistory` (`MigrationId`, `ProductVersion`) +VALUES ('20230106122006_SecretsManager', '6.0.12'); + +COMMIT; diff --git a/util/PostgresMigrations/Migrations/20220720222109_CreateSecretTable.Designer.cs b/util/PostgresMigrations/Migrations/20220720222109_CreateSecretTable.Designer.cs deleted file mode 100644 index 4e0dcdc313cc..000000000000 --- a/util/PostgresMigrations/Migrations/20220720222109_CreateSecretTable.Designer.cs +++ /dev/null @@ -1,1654 +0,0 @@ -// -using System; -using Bit.Infrastructure.EntityFramework.Repositories; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace Bit.PostgresMigrations.Migrations -{ - [DbContext(typeof(DatabaseContext))] - [Migration("20220720222109_CreateSecretTable")] - partial class CreateSecretTable - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("Npgsql:CollationDefinition:postgresIndetermanisticCollation", "en-u-ks-primary,en-u-ks-primary,icu,False") - .HasAnnotation("ProductVersion", "6.0.4") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Cipher", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("Attachments") - .HasColumnType("text"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Data") - .HasColumnType("text"); - - b.Property("DeletedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Favorites") - .HasColumnType("text"); - - b.Property("Folders") - .HasColumnType("text"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("Reprompt") - .HasColumnType("smallint"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Type") - .HasColumnType("smallint"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("UserId"); - - b.ToTable("Cipher", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Collection", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("ExternalId") - .HasMaxLength(300) - .HasColumnType("character varying(300)"); - - b.Property("Name") - .HasColumnType("text"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.ToTable("Collection", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionCipher", b => - { - b.Property("CollectionId") - .HasColumnType("uuid"); - - b.Property("CipherId") - .HasColumnType("uuid"); - - b.HasKey("CollectionId", "CipherId"); - - b.HasIndex("CipherId"); - - b.ToTable("CollectionCipher", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionGroup", b => - { - b.Property("CollectionId") - .HasColumnType("uuid"); - - b.Property("GroupId") - .HasColumnType("uuid"); - - b.Property("HidePasswords") - .HasColumnType("boolean"); - - b.Property("ReadOnly") - .HasColumnType("boolean"); - - b.HasKey("CollectionId", "GroupId"); - - b.HasIndex("GroupId"); - - b.ToTable("CollectionGroups"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionUser", b => - { - b.Property("CollectionId") - .HasColumnType("uuid"); - - b.Property("OrganizationUserId") - .HasColumnType("uuid"); - - b.Property("HidePasswords") - .HasColumnType("boolean"); - - b.Property("ReadOnly") - .HasColumnType("boolean"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("CollectionId", "OrganizationUserId"); - - b.HasIndex("OrganizationUserId"); - - b.HasIndex("UserId"); - - b.ToTable("CollectionUsers"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Device", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Identifier") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Name") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("PushToken") - .HasMaxLength(255) - .HasColumnType("character varying(255)"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Type") - .HasColumnType("smallint"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Device", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.EmergencyAccess", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("GranteeId") - .HasColumnType("uuid"); - - b.Property("GrantorId") - .HasColumnType("uuid"); - - b.Property("KeyEncrypted") - .HasColumnType("text"); - - b.Property("LastNotificationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("RecoveryInitiatedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Status") - .HasColumnType("smallint"); - - b.Property("Type") - .HasColumnType("smallint"); - - b.Property("WaitTimeDays") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("GranteeId"); - - b.HasIndex("GrantorId"); - - b.ToTable("EmergencyAccess", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Event", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("ActingUserId") - .HasColumnType("uuid"); - - b.Property("CipherId") - .HasColumnType("uuid"); - - b.Property("CollectionId") - .HasColumnType("uuid"); - - b.Property("Date") - .HasColumnType("timestamp without time zone"); - - b.Property("DeviceType") - .HasColumnType("smallint"); - - b.Property("GroupId") - .HasColumnType("uuid"); - - b.Property("InstallationId") - .HasColumnType("uuid"); - - b.Property("IpAddress") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("OrganizationUserId") - .HasColumnType("uuid"); - - b.Property("PolicyId") - .HasColumnType("uuid"); - - b.Property("ProviderId") - .HasColumnType("uuid"); - - b.Property("ProviderOrganizationId") - .HasColumnType("uuid"); - - b.Property("ProviderUserId") - .HasColumnType("uuid"); - - b.Property("Type") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.ToTable("Event", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Folder", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Name") - .HasColumnType("text"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Folder", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Grant", b => - { - b.Property("Key") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ClientId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ConsumedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Data") - .HasColumnType("text"); - - b.Property("Description") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ExpirationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("SessionId") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SubjectId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Type") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("Key"); - - b.ToTable("Grant", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Group", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("AccessAll") - .HasColumnType("boolean"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("ExternalId") - .HasMaxLength(300) - .HasColumnType("character varying(300)"); - - b.Property("Name") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.ToTable("Group", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.GroupUser", b => - { - b.Property("GroupId") - .HasColumnType("uuid"); - - b.Property("OrganizationUserId") - .HasColumnType("uuid"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("GroupId", "OrganizationUserId"); - - b.HasIndex("OrganizationUserId"); - - b.HasIndex("UserId"); - - b.ToTable("GroupUser", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Installation", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("Enabled") - .HasColumnType("boolean"); - - b.Property("Key") - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.HasKey("Id"); - - b.ToTable("Installation", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Organization", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("BillingEmail") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("BusinessAddress1") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BusinessAddress2") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BusinessAddress3") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BusinessCountry") - .HasMaxLength(2) - .HasColumnType("character varying(2)"); - - b.Property("BusinessName") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BusinessTaxNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Enabled") - .HasColumnType("boolean"); - - b.Property("ExpirationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Gateway") - .HasColumnType("smallint"); - - b.Property("GatewayCustomerId") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("GatewaySubscriptionId") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Identifier") - .HasMaxLength(50) - .HasColumnType("character varying(50)") - .UseCollation("postgresIndetermanisticCollation"); - - b.Property("LicenseKey") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("MaxAutoscaleSeats") - .HasColumnType("integer"); - - b.Property("MaxCollections") - .HasColumnType("smallint"); - - b.Property("MaxStorageGb") - .HasColumnType("smallint"); - - b.Property("Name") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("OwnersNotifiedOfAutoscaling") - .HasColumnType("timestamp without time zone"); - - b.Property("Plan") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("PlanType") - .HasColumnType("smallint"); - - b.Property("PrivateKey") - .HasColumnType("text"); - - b.Property("PublicKey") - .HasColumnType("text"); - - b.Property("ReferenceData") - .HasColumnType("text"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Seats") - .HasColumnType("integer"); - - b.Property("SelfHost") - .HasColumnType("boolean"); - - b.Property("Storage") - .HasColumnType("bigint"); - - b.Property("TwoFactorProviders") - .HasColumnType("text"); - - b.Property("Use2fa") - .HasColumnType("boolean"); - - b.Property("UseApi") - .HasColumnType("boolean"); - - b.Property("UseDirectory") - .HasColumnType("boolean"); - - b.Property("UseEvents") - .HasColumnType("boolean"); - - b.Property("UseGroups") - .HasColumnType("boolean"); - - b.Property("UseKeyConnector") - .HasColumnType("boolean"); - - b.Property("UsePolicies") - .HasColumnType("boolean"); - - b.Property("UseResetPassword") - .HasColumnType("boolean"); - - b.Property("UseScim") - .HasColumnType("boolean"); - - b.Property("UseSso") - .HasColumnType("boolean"); - - b.Property("UseTotp") - .HasColumnType("boolean"); - - b.Property("UsersGetPremium") - .HasColumnType("boolean"); - - b.HasKey("Id"); - - b.ToTable("Organization", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationApiKey", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("ApiKey") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Type") - .HasColumnType("smallint"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.ToTable("OrganizationApiKey", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationConnection", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("Config") - .HasColumnType("text"); - - b.Property("Enabled") - .HasColumnType("boolean"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("Type") - .HasColumnType("smallint"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.ToTable("OrganizationConnection", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationSponsorship", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("FriendlyName") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("LastSyncDate") - .HasColumnType("timestamp without time zone"); - - b.Property("OfferedToEmail") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("PlanSponsorshipType") - .HasColumnType("smallint"); - - b.Property("SponsoredOrganizationId") - .HasColumnType("uuid"); - - b.Property("SponsoringOrganizationId") - .HasColumnType("uuid"); - - b.Property("SponsoringOrganizationUserId") - .HasColumnType("uuid"); - - b.Property("ToDelete") - .HasColumnType("boolean"); - - b.Property("ValidUntil") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id"); - - b.HasIndex("SponsoredOrganizationId"); - - b.HasIndex("SponsoringOrganizationId"); - - b.ToTable("OrganizationSponsorship", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("AccessAll") - .HasColumnType("boolean"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("ExternalId") - .HasMaxLength(300) - .HasColumnType("character varying(300)"); - - b.Property("Key") - .HasColumnType("text"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("Permissions") - .HasColumnType("text"); - - b.Property("ResetPasswordKey") - .HasColumnType("text"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Status") - .HasColumnType("smallint"); - - b.Property("Type") - .HasColumnType("smallint"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("UserId"); - - b.ToTable("OrganizationUser", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Policy", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Data") - .HasColumnType("text"); - - b.Property("Enabled") - .HasColumnType("boolean"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Type") - .HasColumnType("smallint"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.ToTable("Policy", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Provider", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("BillingEmail") - .HasColumnType("text"); - - b.Property("BusinessAddress1") - .HasColumnType("text"); - - b.Property("BusinessAddress2") - .HasColumnType("text"); - - b.Property("BusinessAddress3") - .HasColumnType("text"); - - b.Property("BusinessCountry") - .HasColumnType("text"); - - b.Property("BusinessName") - .HasColumnType("text"); - - b.Property("BusinessTaxNumber") - .HasColumnType("text"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Enabled") - .HasColumnType("boolean"); - - b.Property("Name") - .HasColumnType("text"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Status") - .HasColumnType("smallint"); - - b.Property("UseEvents") - .HasColumnType("boolean"); - - b.HasKey("Id"); - - b.ToTable("Provider", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ProviderOrganization", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Key") - .HasColumnType("text"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("ProviderId") - .HasColumnType("uuid"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Settings") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("ProviderId"); - - b.ToTable("ProviderOrganization", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ProviderUser", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Email") - .HasColumnType("text"); - - b.Property("Key") - .HasColumnType("text"); - - b.Property("Permissions") - .HasColumnType("text"); - - b.Property("ProviderId") - .HasColumnType("uuid"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Status") - .HasColumnType("smallint"); - - b.Property("Type") - .HasColumnType("smallint"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("ProviderId"); - - b.HasIndex("UserId"); - - b.ToTable("ProviderUser", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Secret", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("DeletedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Key") - .HasColumnType("text"); - - b.Property("Note") - .HasColumnType("text"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Value") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("DeletedDate") - .HasAnnotation("SqlServer:Clustered", false); - - b.HasIndex("OrganizationId"); - - b.ToTable("Secret", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Send", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("AccessCount") - .HasColumnType("integer"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Data") - .HasColumnType("text"); - - b.Property("DeletionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Disabled") - .HasColumnType("boolean"); - - b.Property("ExpirationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("HideEmail") - .HasColumnType("boolean"); - - b.Property("Key") - .HasColumnType("text"); - - b.Property("MaxAccessCount") - .HasColumnType("integer"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("Password") - .HasMaxLength(300) - .HasColumnType("character varying(300)"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Type") - .HasColumnType("smallint"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("UserId"); - - b.ToTable("Send", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.SsoConfig", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Data") - .HasColumnType("text"); - - b.Property("Enabled") - .HasColumnType("boolean"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.ToTable("SsoConfig", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.SsoUser", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("ExternalId") - .HasMaxLength(50) - .HasColumnType("character varying(50)") - .UseCollation("postgresIndetermanisticCollation"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("UserId"); - - b.ToTable("SsoUser", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.TaxRate", b => - { - b.Property("Id") - .HasMaxLength(40) - .HasColumnType("character varying(40)"); - - b.Property("Active") - .HasColumnType("boolean"); - - b.Property("Country") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("PostalCode") - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("Rate") - .HasColumnType("numeric"); - - b.Property("State") - .HasMaxLength(2) - .HasColumnType("character varying(2)"); - - b.HasKey("Id"); - - b.ToTable("TaxRate", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Transaction", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("Amount") - .HasColumnType("numeric"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Details") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Gateway") - .HasColumnType("smallint"); - - b.Property("GatewayId") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("PaymentMethodType") - .HasColumnType("smallint"); - - b.Property("Refunded") - .HasColumnType("boolean"); - - b.Property("RefundedAmount") - .HasColumnType("numeric"); - - b.Property("Type") - .HasColumnType("smallint"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("UserId"); - - b.ToTable("Transaction", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.User", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("AccountRevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("ApiKey") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Culture") - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("Email") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .UseCollation("postgresIndetermanisticCollation"); - - b.Property("EmailVerified") - .HasColumnType("boolean"); - - b.Property("EquivalentDomains") - .HasColumnType("text"); - - b.Property("ExcludedGlobalEquivalentDomains") - .HasColumnType("text"); - - b.Property("FailedLoginCount") - .HasColumnType("integer"); - - b.Property("ForcePasswordReset") - .HasColumnType("boolean"); - - b.Property("Gateway") - .HasColumnType("smallint"); - - b.Property("GatewayCustomerId") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("GatewaySubscriptionId") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Kdf") - .HasColumnType("smallint"); - - b.Property("KdfIterations") - .HasColumnType("integer"); - - b.Property("Key") - .HasColumnType("text"); - - b.Property("LastFailedLoginDate") - .HasColumnType("timestamp without time zone"); - - b.Property("LicenseKey") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("MasterPassword") - .HasMaxLength(300) - .HasColumnType("character varying(300)"); - - b.Property("MasterPasswordHint") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("MaxStorageGb") - .HasColumnType("smallint"); - - b.Property("Name") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Premium") - .HasColumnType("boolean"); - - b.Property("PremiumExpirationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("PrivateKey") - .HasColumnType("text"); - - b.Property("PublicKey") - .HasColumnType("text"); - - b.Property("ReferenceData") - .HasColumnType("text"); - - b.Property("RenewalReminderDate") - .HasColumnType("timestamp without time zone"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("SecurityStamp") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Storage") - .HasColumnType("bigint"); - - b.Property("TwoFactorProviders") - .HasColumnType("text"); - - b.Property("TwoFactorRecoveryCode") - .HasMaxLength(32) - .HasColumnType("character varying(32)"); - - b.Property("UnknownDeviceVerificationEnabled") - .HasColumnType("boolean"); - - b.Property("UsesKeyConnector") - .HasColumnType("boolean"); - - b.HasKey("Id"); - - b.ToTable("User", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Cipher", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("Ciphers") - .HasForeignKey("OrganizationId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany("Ciphers") - .HasForeignKey("UserId"); - - b.Navigation("Organization"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Collection", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany() - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionCipher", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Cipher", "Cipher") - .WithMany("CollectionCiphers") - .HasForeignKey("CipherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Collection", "Collection") - .WithMany("CollectionCiphers") - .HasForeignKey("CollectionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Cipher"); - - b.Navigation("Collection"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionGroup", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Collection", "Collection") - .WithMany("CollectionGroups") - .HasForeignKey("CollectionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Group", "Group") - .WithMany() - .HasForeignKey("GroupId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Collection"); - - b.Navigation("Group"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionUser", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Collection", "Collection") - .WithMany("CollectionUsers") - .HasForeignKey("CollectionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", "OrganizationUser") - .WithMany("CollectionUsers") - .HasForeignKey("OrganizationUserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", null) - .WithMany("CollectionUsers") - .HasForeignKey("UserId"); - - b.Navigation("Collection"); - - b.Navigation("OrganizationUser"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Device", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.EmergencyAccess", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "Grantee") - .WithMany() - .HasForeignKey("GranteeId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "Grantor") - .WithMany() - .HasForeignKey("GrantorId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Grantee"); - - b.Navigation("Grantor"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Folder", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany("Folders") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Group", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("Groups") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.GroupUser", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Group", "Group") - .WithMany("GroupUsers") - .HasForeignKey("GroupId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", "OrganizationUser") - .WithMany() - .HasForeignKey("OrganizationUserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", null) - .WithMany("GroupUsers") - .HasForeignKey("UserId"); - - b.Navigation("Group"); - - b.Navigation("OrganizationUser"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationApiKey", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("ApiKeys") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationConnection", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("Connections") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationSponsorship", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "SponsoredOrganization") - .WithMany() - .HasForeignKey("SponsoredOrganizationId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "SponsoringOrganization") - .WithMany() - .HasForeignKey("SponsoringOrganizationId"); - - b.Navigation("SponsoredOrganization"); - - b.Navigation("SponsoringOrganization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("OrganizationUsers") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany("OrganizationUsers") - .HasForeignKey("UserId"); - - b.Navigation("Organization"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Policy", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("Policies") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ProviderOrganization", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany() - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Provider", "Provider") - .WithMany() - .HasForeignKey("ProviderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - - b.Navigation("Provider"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ProviderUser", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Provider", "Provider") - .WithMany() - .HasForeignKey("ProviderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany() - .HasForeignKey("UserId"); - - b.Navigation("Provider"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Secret", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany() - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Send", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany() - .HasForeignKey("OrganizationId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany() - .HasForeignKey("UserId"); - - b.Navigation("Organization"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.SsoConfig", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("SsoConfigs") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.SsoUser", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("SsoUsers") - .HasForeignKey("OrganizationId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany("SsoUsers") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Transaction", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("Transactions") - .HasForeignKey("OrganizationId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany("Transactions") - .HasForeignKey("UserId"); - - b.Navigation("Organization"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Cipher", b => - { - b.Navigation("CollectionCiphers"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Collection", b => - { - b.Navigation("CollectionCiphers"); - - b.Navigation("CollectionGroups"); - - b.Navigation("CollectionUsers"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Group", b => - { - b.Navigation("GroupUsers"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Organization", b => - { - b.Navigation("ApiKeys"); - - b.Navigation("Ciphers"); - - b.Navigation("Connections"); - - b.Navigation("Groups"); - - b.Navigation("OrganizationUsers"); - - b.Navigation("Policies"); - - b.Navigation("SsoConfigs"); - - b.Navigation("SsoUsers"); - - b.Navigation("Transactions"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", b => - { - b.Navigation("CollectionUsers"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.User", b => - { - b.Navigation("Ciphers"); - - b.Navigation("CollectionUsers"); - - b.Navigation("Folders"); - - b.Navigation("GroupUsers"); - - b.Navigation("OrganizationUsers"); - - b.Navigation("SsoUsers"); - - b.Navigation("Transactions"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/util/PostgresMigrations/Migrations/20220720222109_CreateSecretTable.cs b/util/PostgresMigrations/Migrations/20220720222109_CreateSecretTable.cs deleted file mode 100644 index 31b190c9f4a4..000000000000 --- a/util/PostgresMigrations/Migrations/20220720222109_CreateSecretTable.cs +++ /dev/null @@ -1,51 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Bit.PostgresMigrations.Migrations; - -public partial class CreateSecretTable : Migration -{ - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "Secret", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - OrganizationId = table.Column(type: "uuid", nullable: false), - Key = table.Column(type: "text", nullable: true), - Value = table.Column(type: "text", nullable: true), - Note = table.Column(type: "text", nullable: true), - CreationDate = table.Column(type: "timestamp without time zone", nullable: false), - RevisionDate = table.Column(type: "timestamp without time zone", nullable: false), - DeletedDate = table.Column(type: "timestamp without time zone", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Secret", x => x.Id); - table.ForeignKey( - name: "FK_Secret_Organization_OrganizationId", - column: x => x.OrganizationId, - principalTable: "Organization", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_Secret_DeletedDate", - table: "Secret", - column: "DeletedDate"); - - migrationBuilder.CreateIndex( - name: "IX_Secret_OrganizationId", - table: "Secret", - column: "OrganizationId"); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "Secret"); - } -} diff --git a/util/PostgresMigrations/Migrations/20220830185238_CreateProjectTable.Designer.cs b/util/PostgresMigrations/Migrations/20220830185238_CreateProjectTable.Designer.cs deleted file mode 100644 index e224732f4ca5..000000000000 --- a/util/PostgresMigrations/Migrations/20220830185238_CreateProjectTable.Designer.cs +++ /dev/null @@ -1,1699 +0,0 @@ -// -using System; -using Bit.Infrastructure.EntityFramework.Repositories; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace Bit.PostgresMigrations.Migrations -{ - [DbContext(typeof(DatabaseContext))] - [Migration("20220830185238_CreateProjectTable")] - partial class CreateProjectTable - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("Npgsql:CollationDefinition:postgresIndetermanisticCollation", "en-u-ks-primary,en-u-ks-primary,icu,False") - .HasAnnotation("ProductVersion", "6.0.4") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Cipher", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("Attachments") - .HasColumnType("text"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Data") - .HasColumnType("text"); - - b.Property("DeletedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Favorites") - .HasColumnType("text"); - - b.Property("Folders") - .HasColumnType("text"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("Reprompt") - .HasColumnType("smallint"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Type") - .HasColumnType("smallint"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("UserId"); - - b.ToTable("Cipher", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Collection", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("ExternalId") - .HasMaxLength(300) - .HasColumnType("character varying(300)"); - - b.Property("Name") - .HasColumnType("text"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.ToTable("Collection", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionCipher", b => - { - b.Property("CollectionId") - .HasColumnType("uuid"); - - b.Property("CipherId") - .HasColumnType("uuid"); - - b.HasKey("CollectionId", "CipherId"); - - b.HasIndex("CipherId"); - - b.ToTable("CollectionCipher", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionGroup", b => - { - b.Property("CollectionId") - .HasColumnType("uuid"); - - b.Property("GroupId") - .HasColumnType("uuid"); - - b.Property("HidePasswords") - .HasColumnType("boolean"); - - b.Property("ReadOnly") - .HasColumnType("boolean"); - - b.HasKey("CollectionId", "GroupId"); - - b.HasIndex("GroupId"); - - b.ToTable("CollectionGroups"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionUser", b => - { - b.Property("CollectionId") - .HasColumnType("uuid"); - - b.Property("OrganizationUserId") - .HasColumnType("uuid"); - - b.Property("HidePasswords") - .HasColumnType("boolean"); - - b.Property("ReadOnly") - .HasColumnType("boolean"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("CollectionId", "OrganizationUserId"); - - b.HasIndex("OrganizationUserId"); - - b.HasIndex("UserId"); - - b.ToTable("CollectionUsers"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Device", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Identifier") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Name") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("PushToken") - .HasMaxLength(255) - .HasColumnType("character varying(255)"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Type") - .HasColumnType("smallint"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Device", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.EmergencyAccess", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("GranteeId") - .HasColumnType("uuid"); - - b.Property("GrantorId") - .HasColumnType("uuid"); - - b.Property("KeyEncrypted") - .HasColumnType("text"); - - b.Property("LastNotificationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("RecoveryInitiatedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Status") - .HasColumnType("smallint"); - - b.Property("Type") - .HasColumnType("smallint"); - - b.Property("WaitTimeDays") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("GranteeId"); - - b.HasIndex("GrantorId"); - - b.ToTable("EmergencyAccess", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Event", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("ActingUserId") - .HasColumnType("uuid"); - - b.Property("CipherId") - .HasColumnType("uuid"); - - b.Property("CollectionId") - .HasColumnType("uuid"); - - b.Property("Date") - .HasColumnType("timestamp without time zone"); - - b.Property("DeviceType") - .HasColumnType("smallint"); - - b.Property("GroupId") - .HasColumnType("uuid"); - - b.Property("InstallationId") - .HasColumnType("uuid"); - - b.Property("IpAddress") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("OrganizationUserId") - .HasColumnType("uuid"); - - b.Property("PolicyId") - .HasColumnType("uuid"); - - b.Property("ProviderId") - .HasColumnType("uuid"); - - b.Property("ProviderOrganizationId") - .HasColumnType("uuid"); - - b.Property("ProviderUserId") - .HasColumnType("uuid"); - - b.Property("Type") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.ToTable("Event", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Folder", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Name") - .HasColumnType("text"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Folder", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Grant", b => - { - b.Property("Key") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ClientId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ConsumedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Data") - .HasColumnType("text"); - - b.Property("Description") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ExpirationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("SessionId") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SubjectId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Type") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("Key"); - - b.ToTable("Grant", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Group", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("AccessAll") - .HasColumnType("boolean"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("ExternalId") - .HasMaxLength(300) - .HasColumnType("character varying(300)"); - - b.Property("Name") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.ToTable("Group", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.GroupUser", b => - { - b.Property("GroupId") - .HasColumnType("uuid"); - - b.Property("OrganizationUserId") - .HasColumnType("uuid"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("GroupId", "OrganizationUserId"); - - b.HasIndex("OrganizationUserId"); - - b.HasIndex("UserId"); - - b.ToTable("GroupUser", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Installation", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("Enabled") - .HasColumnType("boolean"); - - b.Property("Key") - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.HasKey("Id"); - - b.ToTable("Installation", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Organization", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("BillingEmail") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("BusinessAddress1") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BusinessAddress2") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BusinessAddress3") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BusinessCountry") - .HasMaxLength(2) - .HasColumnType("character varying(2)"); - - b.Property("BusinessName") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BusinessTaxNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Enabled") - .HasColumnType("boolean"); - - b.Property("ExpirationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Gateway") - .HasColumnType("smallint"); - - b.Property("GatewayCustomerId") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("GatewaySubscriptionId") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Identifier") - .HasMaxLength(50) - .HasColumnType("character varying(50)") - .UseCollation("postgresIndetermanisticCollation"); - - b.Property("LicenseKey") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("MaxAutoscaleSeats") - .HasColumnType("integer"); - - b.Property("MaxCollections") - .HasColumnType("smallint"); - - b.Property("MaxStorageGb") - .HasColumnType("smallint"); - - b.Property("Name") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("OwnersNotifiedOfAutoscaling") - .HasColumnType("timestamp without time zone"); - - b.Property("Plan") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("PlanType") - .HasColumnType("smallint"); - - b.Property("PrivateKey") - .HasColumnType("text"); - - b.Property("PublicKey") - .HasColumnType("text"); - - b.Property("ReferenceData") - .HasColumnType("text"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Seats") - .HasColumnType("integer"); - - b.Property("SelfHost") - .HasColumnType("boolean"); - - b.Property("Storage") - .HasColumnType("bigint"); - - b.Property("TwoFactorProviders") - .HasColumnType("text"); - - b.Property("Use2fa") - .HasColumnType("boolean"); - - b.Property("UseApi") - .HasColumnType("boolean"); - - b.Property("UseDirectory") - .HasColumnType("boolean"); - - b.Property("UseEvents") - .HasColumnType("boolean"); - - b.Property("UseGroups") - .HasColumnType("boolean"); - - b.Property("UseKeyConnector") - .HasColumnType("boolean"); - - b.Property("UsePolicies") - .HasColumnType("boolean"); - - b.Property("UseResetPassword") - .HasColumnType("boolean"); - - b.Property("UseScim") - .HasColumnType("boolean"); - - b.Property("UseSso") - .HasColumnType("boolean"); - - b.Property("UseTotp") - .HasColumnType("boolean"); - - b.Property("UsersGetPremium") - .HasColumnType("boolean"); - - b.HasKey("Id"); - - b.ToTable("Organization", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationApiKey", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("ApiKey") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Type") - .HasColumnType("smallint"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.ToTable("OrganizationApiKey", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationConnection", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("Config") - .HasColumnType("text"); - - b.Property("Enabled") - .HasColumnType("boolean"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("Type") - .HasColumnType("smallint"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.ToTable("OrganizationConnection", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationSponsorship", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("FriendlyName") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("LastSyncDate") - .HasColumnType("timestamp without time zone"); - - b.Property("OfferedToEmail") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("PlanSponsorshipType") - .HasColumnType("smallint"); - - b.Property("SponsoredOrganizationId") - .HasColumnType("uuid"); - - b.Property("SponsoringOrganizationId") - .HasColumnType("uuid"); - - b.Property("SponsoringOrganizationUserId") - .HasColumnType("uuid"); - - b.Property("ToDelete") - .HasColumnType("boolean"); - - b.Property("ValidUntil") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id"); - - b.HasIndex("SponsoredOrganizationId"); - - b.HasIndex("SponsoringOrganizationId"); - - b.ToTable("OrganizationSponsorship", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("AccessAll") - .HasColumnType("boolean"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("ExternalId") - .HasMaxLength(300) - .HasColumnType("character varying(300)"); - - b.Property("Key") - .HasColumnType("text"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("Permissions") - .HasColumnType("text"); - - b.Property("ResetPasswordKey") - .HasColumnType("text"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Status") - .HasColumnType("smallint"); - - b.Property("Type") - .HasColumnType("smallint"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("UserId"); - - b.ToTable("OrganizationUser", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Policy", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Data") - .HasColumnType("text"); - - b.Property("Enabled") - .HasColumnType("boolean"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Type") - .HasColumnType("smallint"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.ToTable("Policy", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Project", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("DeletedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Name") - .HasColumnType("text"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id") - .HasAnnotation("SqlServer:Clustered", true); - - b.HasIndex("DeletedDate") - .HasAnnotation("SqlServer:Clustered", false); - - b.HasIndex("OrganizationId") - .HasAnnotation("SqlServer:Clustered", false); - - b.ToTable("Project", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Provider", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("BillingEmail") - .HasColumnType("text"); - - b.Property("BusinessAddress1") - .HasColumnType("text"); - - b.Property("BusinessAddress2") - .HasColumnType("text"); - - b.Property("BusinessAddress3") - .HasColumnType("text"); - - b.Property("BusinessCountry") - .HasColumnType("text"); - - b.Property("BusinessName") - .HasColumnType("text"); - - b.Property("BusinessTaxNumber") - .HasColumnType("text"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Enabled") - .HasColumnType("boolean"); - - b.Property("Name") - .HasColumnType("text"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Status") - .HasColumnType("smallint"); - - b.Property("UseEvents") - .HasColumnType("boolean"); - - b.HasKey("Id"); - - b.ToTable("Provider", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ProviderOrganization", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Key") - .HasColumnType("text"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("ProviderId") - .HasColumnType("uuid"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Settings") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("ProviderId"); - - b.ToTable("ProviderOrganization", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ProviderUser", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Email") - .HasColumnType("text"); - - b.Property("Key") - .HasColumnType("text"); - - b.Property("Permissions") - .HasColumnType("text"); - - b.Property("ProviderId") - .HasColumnType("uuid"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Status") - .HasColumnType("smallint"); - - b.Property("Type") - .HasColumnType("smallint"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("ProviderId"); - - b.HasIndex("UserId"); - - b.ToTable("ProviderUser", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Secret", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("DeletedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Key") - .HasColumnType("text"); - - b.Property("Note") - .HasColumnType("text"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Value") - .HasColumnType("text"); - - b.HasKey("Id") - .HasAnnotation("SqlServer:Clustered", true); - - b.HasIndex("DeletedDate") - .HasAnnotation("SqlServer:Clustered", false); - - b.HasIndex("OrganizationId") - .HasAnnotation("SqlServer:Clustered", false); - - b.ToTable("Secret", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Send", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("AccessCount") - .HasColumnType("integer"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Data") - .HasColumnType("text"); - - b.Property("DeletionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Disabled") - .HasColumnType("boolean"); - - b.Property("ExpirationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("HideEmail") - .HasColumnType("boolean"); - - b.Property("Key") - .HasColumnType("text"); - - b.Property("MaxAccessCount") - .HasColumnType("integer"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("Password") - .HasMaxLength(300) - .HasColumnType("character varying(300)"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Type") - .HasColumnType("smallint"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("UserId"); - - b.ToTable("Send", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.SsoConfig", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Data") - .HasColumnType("text"); - - b.Property("Enabled") - .HasColumnType("boolean"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.ToTable("SsoConfig", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.SsoUser", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("ExternalId") - .HasMaxLength(50) - .HasColumnType("character varying(50)") - .UseCollation("postgresIndetermanisticCollation"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("UserId"); - - b.ToTable("SsoUser", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.TaxRate", b => - { - b.Property("Id") - .HasMaxLength(40) - .HasColumnType("character varying(40)"); - - b.Property("Active") - .HasColumnType("boolean"); - - b.Property("Country") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("PostalCode") - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("Rate") - .HasColumnType("numeric"); - - b.Property("State") - .HasMaxLength(2) - .HasColumnType("character varying(2)"); - - b.HasKey("Id"); - - b.ToTable("TaxRate", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Transaction", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("Amount") - .HasColumnType("numeric"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Details") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Gateway") - .HasColumnType("smallint"); - - b.Property("GatewayId") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("PaymentMethodType") - .HasColumnType("smallint"); - - b.Property("Refunded") - .HasColumnType("boolean"); - - b.Property("RefundedAmount") - .HasColumnType("numeric"); - - b.Property("Type") - .HasColumnType("smallint"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("UserId"); - - b.ToTable("Transaction", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.User", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("AccountRevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("ApiKey") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Culture") - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("Email") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .UseCollation("postgresIndetermanisticCollation"); - - b.Property("EmailVerified") - .HasColumnType("boolean"); - - b.Property("EquivalentDomains") - .HasColumnType("text"); - - b.Property("ExcludedGlobalEquivalentDomains") - .HasColumnType("text"); - - b.Property("FailedLoginCount") - .HasColumnType("integer"); - - b.Property("ForcePasswordReset") - .HasColumnType("boolean"); - - b.Property("Gateway") - .HasColumnType("smallint"); - - b.Property("GatewayCustomerId") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("GatewaySubscriptionId") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Kdf") - .HasColumnType("smallint"); - - b.Property("KdfIterations") - .HasColumnType("integer"); - - b.Property("Key") - .HasColumnType("text"); - - b.Property("LastFailedLoginDate") - .HasColumnType("timestamp without time zone"); - - b.Property("LicenseKey") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("MasterPassword") - .HasMaxLength(300) - .HasColumnType("character varying(300)"); - - b.Property("MasterPasswordHint") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("MaxStorageGb") - .HasColumnType("smallint"); - - b.Property("Name") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Premium") - .HasColumnType("boolean"); - - b.Property("PremiumExpirationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("PrivateKey") - .HasColumnType("text"); - - b.Property("PublicKey") - .HasColumnType("text"); - - b.Property("ReferenceData") - .HasColumnType("text"); - - b.Property("RenewalReminderDate") - .HasColumnType("timestamp without time zone"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("SecurityStamp") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Storage") - .HasColumnType("bigint"); - - b.Property("TwoFactorProviders") - .HasColumnType("text"); - - b.Property("TwoFactorRecoveryCode") - .HasMaxLength(32) - .HasColumnType("character varying(32)"); - - b.Property("UnknownDeviceVerificationEnabled") - .HasColumnType("boolean"); - - b.Property("UsesKeyConnector") - .HasColumnType("boolean"); - - b.HasKey("Id"); - - b.ToTable("User", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Cipher", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("Ciphers") - .HasForeignKey("OrganizationId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany("Ciphers") - .HasForeignKey("UserId"); - - b.Navigation("Organization"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Collection", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany() - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionCipher", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Cipher", "Cipher") - .WithMany("CollectionCiphers") - .HasForeignKey("CipherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Collection", "Collection") - .WithMany("CollectionCiphers") - .HasForeignKey("CollectionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Cipher"); - - b.Navigation("Collection"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionGroup", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Collection", "Collection") - .WithMany("CollectionGroups") - .HasForeignKey("CollectionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Group", "Group") - .WithMany() - .HasForeignKey("GroupId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Collection"); - - b.Navigation("Group"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionUser", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Collection", "Collection") - .WithMany("CollectionUsers") - .HasForeignKey("CollectionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", "OrganizationUser") - .WithMany("CollectionUsers") - .HasForeignKey("OrganizationUserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", null) - .WithMany("CollectionUsers") - .HasForeignKey("UserId"); - - b.Navigation("Collection"); - - b.Navigation("OrganizationUser"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Device", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.EmergencyAccess", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "Grantee") - .WithMany() - .HasForeignKey("GranteeId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "Grantor") - .WithMany() - .HasForeignKey("GrantorId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Grantee"); - - b.Navigation("Grantor"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Folder", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany("Folders") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Group", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("Groups") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.GroupUser", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Group", "Group") - .WithMany("GroupUsers") - .HasForeignKey("GroupId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", "OrganizationUser") - .WithMany() - .HasForeignKey("OrganizationUserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", null) - .WithMany("GroupUsers") - .HasForeignKey("UserId"); - - b.Navigation("Group"); - - b.Navigation("OrganizationUser"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationApiKey", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("ApiKeys") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationConnection", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("Connections") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationSponsorship", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "SponsoredOrganization") - .WithMany() - .HasForeignKey("SponsoredOrganizationId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "SponsoringOrganization") - .WithMany() - .HasForeignKey("SponsoringOrganizationId"); - - b.Navigation("SponsoredOrganization"); - - b.Navigation("SponsoringOrganization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("OrganizationUsers") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany("OrganizationUsers") - .HasForeignKey("UserId"); - - b.Navigation("Organization"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Policy", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("Policies") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Project", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany() - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ProviderOrganization", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany() - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Provider", "Provider") - .WithMany() - .HasForeignKey("ProviderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - - b.Navigation("Provider"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ProviderUser", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Provider", "Provider") - .WithMany() - .HasForeignKey("ProviderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany() - .HasForeignKey("UserId"); - - b.Navigation("Provider"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Secret", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany() - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Send", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany() - .HasForeignKey("OrganizationId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany() - .HasForeignKey("UserId"); - - b.Navigation("Organization"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.SsoConfig", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("SsoConfigs") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.SsoUser", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("SsoUsers") - .HasForeignKey("OrganizationId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany("SsoUsers") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Transaction", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("Transactions") - .HasForeignKey("OrganizationId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany("Transactions") - .HasForeignKey("UserId"); - - b.Navigation("Organization"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Cipher", b => - { - b.Navigation("CollectionCiphers"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Collection", b => - { - b.Navigation("CollectionCiphers"); - - b.Navigation("CollectionGroups"); - - b.Navigation("CollectionUsers"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Group", b => - { - b.Navigation("GroupUsers"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Organization", b => - { - b.Navigation("ApiKeys"); - - b.Navigation("Ciphers"); - - b.Navigation("Connections"); - - b.Navigation("Groups"); - - b.Navigation("OrganizationUsers"); - - b.Navigation("Policies"); - - b.Navigation("SsoConfigs"); - - b.Navigation("SsoUsers"); - - b.Navigation("Transactions"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", b => - { - b.Navigation("CollectionUsers"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.User", b => - { - b.Navigation("Ciphers"); - - b.Navigation("CollectionUsers"); - - b.Navigation("Folders"); - - b.Navigation("GroupUsers"); - - b.Navigation("OrganizationUsers"); - - b.Navigation("SsoUsers"); - - b.Navigation("Transactions"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/util/PostgresMigrations/Migrations/20220830185238_CreateProjectTable.cs b/util/PostgresMigrations/Migrations/20220830185238_CreateProjectTable.cs deleted file mode 100644 index 4df179c97b98..000000000000 --- a/util/PostgresMigrations/Migrations/20220830185238_CreateProjectTable.cs +++ /dev/null @@ -1,49 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Bit.PostgresMigrations.Migrations; - -public partial class CreateProjectTable : Migration -{ - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "Project", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - OrganizationId = table.Column(type: "uuid", nullable: false), - Name = table.Column(type: "text", nullable: true), - CreationDate = table.Column(type: "timestamp without time zone", nullable: false), - RevisionDate = table.Column(type: "timestamp without time zone", nullable: false), - DeletedDate = table.Column(type: "timestamp without time zone", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Project", x => x.Id); - table.ForeignKey( - name: "FK_Project_Organization_OrganizationId", - column: x => x.OrganizationId, - principalTable: "Organization", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_Project_DeletedDate", - table: "Project", - column: "DeletedDate"); - - migrationBuilder.CreateIndex( - name: "IX_Project_OrganizationId", - table: "Project", - column: "OrganizationId"); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "Project"); - } -} diff --git a/util/PostgresMigrations/Migrations/20220926190851_SmServiceAccount.Designer.cs b/util/PostgresMigrations/Migrations/20220926190851_SmServiceAccount.Designer.cs deleted file mode 100644 index 5e55c802c0f4..000000000000 --- a/util/PostgresMigrations/Migrations/20220926190851_SmServiceAccount.Designer.cs +++ /dev/null @@ -1,1736 +0,0 @@ -// -using System; -using Bit.Infrastructure.EntityFramework.Repositories; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace Bit.PostgresMigrations.Migrations -{ - [DbContext(typeof(DatabaseContext))] - [Migration("20220926190851_SmServiceAccount")] - partial class SmServiceAccount - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("Npgsql:CollationDefinition:postgresIndetermanisticCollation", "en-u-ks-primary,en-u-ks-primary,icu,False") - .HasAnnotation("ProductVersion", "6.0.4") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Cipher", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("Attachments") - .HasColumnType("text"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Data") - .HasColumnType("text"); - - b.Property("DeletedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Favorites") - .HasColumnType("text"); - - b.Property("Folders") - .HasColumnType("text"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("Reprompt") - .HasColumnType("smallint"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Type") - .HasColumnType("smallint"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("UserId"); - - b.ToTable("Cipher", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Collection", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("ExternalId") - .HasMaxLength(300) - .HasColumnType("character varying(300)"); - - b.Property("Name") - .HasColumnType("text"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.ToTable("Collection", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionCipher", b => - { - b.Property("CollectionId") - .HasColumnType("uuid"); - - b.Property("CipherId") - .HasColumnType("uuid"); - - b.HasKey("CollectionId", "CipherId"); - - b.HasIndex("CipherId"); - - b.ToTable("CollectionCipher", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionGroup", b => - { - b.Property("CollectionId") - .HasColumnType("uuid"); - - b.Property("GroupId") - .HasColumnType("uuid"); - - b.Property("HidePasswords") - .HasColumnType("boolean"); - - b.Property("ReadOnly") - .HasColumnType("boolean"); - - b.HasKey("CollectionId", "GroupId"); - - b.HasIndex("GroupId"); - - b.ToTable("CollectionGroups"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionUser", b => - { - b.Property("CollectionId") - .HasColumnType("uuid"); - - b.Property("OrganizationUserId") - .HasColumnType("uuid"); - - b.Property("HidePasswords") - .HasColumnType("boolean"); - - b.Property("ReadOnly") - .HasColumnType("boolean"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("CollectionId", "OrganizationUserId"); - - b.HasIndex("OrganizationUserId"); - - b.HasIndex("UserId"); - - b.ToTable("CollectionUsers"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Device", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Identifier") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Name") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("PushToken") - .HasMaxLength(255) - .HasColumnType("character varying(255)"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Type") - .HasColumnType("smallint"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Device", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.EmergencyAccess", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("GranteeId") - .HasColumnType("uuid"); - - b.Property("GrantorId") - .HasColumnType("uuid"); - - b.Property("KeyEncrypted") - .HasColumnType("text"); - - b.Property("LastNotificationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("RecoveryInitiatedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Status") - .HasColumnType("smallint"); - - b.Property("Type") - .HasColumnType("smallint"); - - b.Property("WaitTimeDays") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("GranteeId"); - - b.HasIndex("GrantorId"); - - b.ToTable("EmergencyAccess", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Event", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("ActingUserId") - .HasColumnType("uuid"); - - b.Property("CipherId") - .HasColumnType("uuid"); - - b.Property("CollectionId") - .HasColumnType("uuid"); - - b.Property("Date") - .HasColumnType("timestamp without time zone"); - - b.Property("DeviceType") - .HasColumnType("smallint"); - - b.Property("GroupId") - .HasColumnType("uuid"); - - b.Property("InstallationId") - .HasColumnType("uuid"); - - b.Property("IpAddress") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("OrganizationUserId") - .HasColumnType("uuid"); - - b.Property("PolicyId") - .HasColumnType("uuid"); - - b.Property("ProviderId") - .HasColumnType("uuid"); - - b.Property("ProviderOrganizationId") - .HasColumnType("uuid"); - - b.Property("ProviderUserId") - .HasColumnType("uuid"); - - b.Property("Type") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.ToTable("Event", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Folder", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Name") - .HasColumnType("text"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Folder", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Grant", b => - { - b.Property("Key") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ClientId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ConsumedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Data") - .HasColumnType("text"); - - b.Property("Description") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ExpirationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("SessionId") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SubjectId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Type") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("Key"); - - b.ToTable("Grant", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Group", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("AccessAll") - .HasColumnType("boolean"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("ExternalId") - .HasMaxLength(300) - .HasColumnType("character varying(300)"); - - b.Property("Name") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.ToTable("Group", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.GroupUser", b => - { - b.Property("GroupId") - .HasColumnType("uuid"); - - b.Property("OrganizationUserId") - .HasColumnType("uuid"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("GroupId", "OrganizationUserId"); - - b.HasIndex("OrganizationUserId"); - - b.HasIndex("UserId"); - - b.ToTable("GroupUser", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Installation", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("Enabled") - .HasColumnType("boolean"); - - b.Property("Key") - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.HasKey("Id"); - - b.ToTable("Installation", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Organization", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("BillingEmail") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("BusinessAddress1") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BusinessAddress2") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BusinessAddress3") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BusinessCountry") - .HasMaxLength(2) - .HasColumnType("character varying(2)"); - - b.Property("BusinessName") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BusinessTaxNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Enabled") - .HasColumnType("boolean"); - - b.Property("ExpirationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Gateway") - .HasColumnType("smallint"); - - b.Property("GatewayCustomerId") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("GatewaySubscriptionId") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Identifier") - .HasMaxLength(50) - .HasColumnType("character varying(50)") - .UseCollation("postgresIndetermanisticCollation"); - - b.Property("LicenseKey") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("MaxAutoscaleSeats") - .HasColumnType("integer"); - - b.Property("MaxCollections") - .HasColumnType("smallint"); - - b.Property("MaxStorageGb") - .HasColumnType("smallint"); - - b.Property("Name") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("OwnersNotifiedOfAutoscaling") - .HasColumnType("timestamp without time zone"); - - b.Property("Plan") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("PlanType") - .HasColumnType("smallint"); - - b.Property("PrivateKey") - .HasColumnType("text"); - - b.Property("PublicKey") - .HasColumnType("text"); - - b.Property("ReferenceData") - .HasColumnType("text"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Seats") - .HasColumnType("integer"); - - b.Property("SelfHost") - .HasColumnType("boolean"); - - b.Property("Storage") - .HasColumnType("bigint"); - - b.Property("TwoFactorProviders") - .HasColumnType("text"); - - b.Property("Use2fa") - .HasColumnType("boolean"); - - b.Property("UseApi") - .HasColumnType("boolean"); - - b.Property("UseDirectory") - .HasColumnType("boolean"); - - b.Property("UseEvents") - .HasColumnType("boolean"); - - b.Property("UseGroups") - .HasColumnType("boolean"); - - b.Property("UseKeyConnector") - .HasColumnType("boolean"); - - b.Property("UsePolicies") - .HasColumnType("boolean"); - - b.Property("UseResetPassword") - .HasColumnType("boolean"); - - b.Property("UseScim") - .HasColumnType("boolean"); - - b.Property("UseSso") - .HasColumnType("boolean"); - - b.Property("UseTotp") - .HasColumnType("boolean"); - - b.Property("UsersGetPremium") - .HasColumnType("boolean"); - - b.HasKey("Id"); - - b.ToTable("Organization", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationApiKey", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("ApiKey") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Type") - .HasColumnType("smallint"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.ToTable("OrganizationApiKey", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationConnection", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("Config") - .HasColumnType("text"); - - b.Property("Enabled") - .HasColumnType("boolean"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("Type") - .HasColumnType("smallint"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.ToTable("OrganizationConnection", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationSponsorship", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("FriendlyName") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("LastSyncDate") - .HasColumnType("timestamp without time zone"); - - b.Property("OfferedToEmail") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("PlanSponsorshipType") - .HasColumnType("smallint"); - - b.Property("SponsoredOrganizationId") - .HasColumnType("uuid"); - - b.Property("SponsoringOrganizationId") - .HasColumnType("uuid"); - - b.Property("SponsoringOrganizationUserId") - .HasColumnType("uuid"); - - b.Property("ToDelete") - .HasColumnType("boolean"); - - b.Property("ValidUntil") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id"); - - b.HasIndex("SponsoredOrganizationId"); - - b.HasIndex("SponsoringOrganizationId"); - - b.ToTable("OrganizationSponsorship", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("AccessAll") - .HasColumnType("boolean"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("ExternalId") - .HasMaxLength(300) - .HasColumnType("character varying(300)"); - - b.Property("Key") - .HasColumnType("text"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("Permissions") - .HasColumnType("text"); - - b.Property("ResetPasswordKey") - .HasColumnType("text"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Status") - .HasColumnType("smallint"); - - b.Property("Type") - .HasColumnType("smallint"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("UserId"); - - b.ToTable("OrganizationUser", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Policy", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Data") - .HasColumnType("text"); - - b.Property("Enabled") - .HasColumnType("boolean"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Type") - .HasColumnType("smallint"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.ToTable("Policy", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Project", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("DeletedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Name") - .HasColumnType("text"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id") - .HasAnnotation("SqlServer:Clustered", true); - - b.HasIndex("DeletedDate") - .HasAnnotation("SqlServer:Clustered", false); - - b.HasIndex("OrganizationId") - .HasAnnotation("SqlServer:Clustered", false); - - b.ToTable("Project", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Provider", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("BillingEmail") - .HasColumnType("text"); - - b.Property("BusinessAddress1") - .HasColumnType("text"); - - b.Property("BusinessAddress2") - .HasColumnType("text"); - - b.Property("BusinessAddress3") - .HasColumnType("text"); - - b.Property("BusinessCountry") - .HasColumnType("text"); - - b.Property("BusinessName") - .HasColumnType("text"); - - b.Property("BusinessTaxNumber") - .HasColumnType("text"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Enabled") - .HasColumnType("boolean"); - - b.Property("Name") - .HasColumnType("text"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Status") - .HasColumnType("smallint"); - - b.Property("UseEvents") - .HasColumnType("boolean"); - - b.HasKey("Id"); - - b.ToTable("Provider", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ProviderOrganization", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Key") - .HasColumnType("text"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("ProviderId") - .HasColumnType("uuid"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Settings") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("ProviderId"); - - b.ToTable("ProviderOrganization", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ProviderUser", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Email") - .HasColumnType("text"); - - b.Property("Key") - .HasColumnType("text"); - - b.Property("Permissions") - .HasColumnType("text"); - - b.Property("ProviderId") - .HasColumnType("uuid"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Status") - .HasColumnType("smallint"); - - b.Property("Type") - .HasColumnType("smallint"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("ProviderId"); - - b.HasIndex("UserId"); - - b.ToTable("ProviderUser", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Secret", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("DeletedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Key") - .HasColumnType("text"); - - b.Property("Note") - .HasColumnType("text"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Value") - .HasColumnType("text"); - - b.HasKey("Id") - .HasAnnotation("SqlServer:Clustered", true); - - b.HasIndex("DeletedDate") - .HasAnnotation("SqlServer:Clustered", false); - - b.HasIndex("OrganizationId") - .HasAnnotation("SqlServer:Clustered", false); - - b.ToTable("Secret", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Send", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("AccessCount") - .HasColumnType("integer"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Data") - .HasColumnType("text"); - - b.Property("DeletionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Disabled") - .HasColumnType("boolean"); - - b.Property("ExpirationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("HideEmail") - .HasColumnType("boolean"); - - b.Property("Key") - .HasColumnType("text"); - - b.Property("MaxAccessCount") - .HasColumnType("integer"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("Password") - .HasMaxLength(300) - .HasColumnType("character varying(300)"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Type") - .HasColumnType("smallint"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("UserId"); - - b.ToTable("Send", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ServiceAccount", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Name") - .HasColumnType("text"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id") - .HasAnnotation("SqlServer:Clustered", true); - - b.HasIndex("OrganizationId") - .HasAnnotation("SqlServer:Clustered", false); - - b.ToTable("ServiceAccount", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.SsoConfig", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Data") - .HasColumnType("text"); - - b.Property("Enabled") - .HasColumnType("boolean"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.ToTable("SsoConfig", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.SsoUser", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("ExternalId") - .HasMaxLength(50) - .HasColumnType("character varying(50)") - .UseCollation("postgresIndetermanisticCollation"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("UserId"); - - b.ToTable("SsoUser", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.TaxRate", b => - { - b.Property("Id") - .HasMaxLength(40) - .HasColumnType("character varying(40)"); - - b.Property("Active") - .HasColumnType("boolean"); - - b.Property("Country") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("PostalCode") - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("Rate") - .HasColumnType("numeric"); - - b.Property("State") - .HasMaxLength(2) - .HasColumnType("character varying(2)"); - - b.HasKey("Id"); - - b.ToTable("TaxRate", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Transaction", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("Amount") - .HasColumnType("numeric"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Details") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Gateway") - .HasColumnType("smallint"); - - b.Property("GatewayId") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("PaymentMethodType") - .HasColumnType("smallint"); - - b.Property("Refunded") - .HasColumnType("boolean"); - - b.Property("RefundedAmount") - .HasColumnType("numeric"); - - b.Property("Type") - .HasColumnType("smallint"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("UserId"); - - b.ToTable("Transaction", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.User", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("AccountRevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("ApiKey") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Culture") - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("Email") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .UseCollation("postgresIndetermanisticCollation"); - - b.Property("EmailVerified") - .HasColumnType("boolean"); - - b.Property("EquivalentDomains") - .HasColumnType("text"); - - b.Property("ExcludedGlobalEquivalentDomains") - .HasColumnType("text"); - - b.Property("FailedLoginCount") - .HasColumnType("integer"); - - b.Property("ForcePasswordReset") - .HasColumnType("boolean"); - - b.Property("Gateway") - .HasColumnType("smallint"); - - b.Property("GatewayCustomerId") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("GatewaySubscriptionId") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Kdf") - .HasColumnType("smallint"); - - b.Property("KdfIterations") - .HasColumnType("integer"); - - b.Property("Key") - .HasColumnType("text"); - - b.Property("LastFailedLoginDate") - .HasColumnType("timestamp without time zone"); - - b.Property("LicenseKey") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("MasterPassword") - .HasMaxLength(300) - .HasColumnType("character varying(300)"); - - b.Property("MasterPasswordHint") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("MaxStorageGb") - .HasColumnType("smallint"); - - b.Property("Name") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Premium") - .HasColumnType("boolean"); - - b.Property("PremiumExpirationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("PrivateKey") - .HasColumnType("text"); - - b.Property("PublicKey") - .HasColumnType("text"); - - b.Property("ReferenceData") - .HasColumnType("text"); - - b.Property("RenewalReminderDate") - .HasColumnType("timestamp without time zone"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("SecurityStamp") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Storage") - .HasColumnType("bigint"); - - b.Property("TwoFactorProviders") - .HasColumnType("text"); - - b.Property("TwoFactorRecoveryCode") - .HasMaxLength(32) - .HasColumnType("character varying(32)"); - - b.Property("UnknownDeviceVerificationEnabled") - .HasColumnType("boolean"); - - b.Property("UsesKeyConnector") - .HasColumnType("boolean"); - - b.HasKey("Id"); - - b.ToTable("User", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Cipher", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("Ciphers") - .HasForeignKey("OrganizationId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany("Ciphers") - .HasForeignKey("UserId"); - - b.Navigation("Organization"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Collection", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany() - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionCipher", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Cipher", "Cipher") - .WithMany("CollectionCiphers") - .HasForeignKey("CipherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Collection", "Collection") - .WithMany("CollectionCiphers") - .HasForeignKey("CollectionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Cipher"); - - b.Navigation("Collection"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionGroup", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Collection", "Collection") - .WithMany("CollectionGroups") - .HasForeignKey("CollectionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Group", "Group") - .WithMany() - .HasForeignKey("GroupId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Collection"); - - b.Navigation("Group"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionUser", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Collection", "Collection") - .WithMany("CollectionUsers") - .HasForeignKey("CollectionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", "OrganizationUser") - .WithMany("CollectionUsers") - .HasForeignKey("OrganizationUserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", null) - .WithMany("CollectionUsers") - .HasForeignKey("UserId"); - - b.Navigation("Collection"); - - b.Navigation("OrganizationUser"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Device", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.EmergencyAccess", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "Grantee") - .WithMany() - .HasForeignKey("GranteeId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "Grantor") - .WithMany() - .HasForeignKey("GrantorId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Grantee"); - - b.Navigation("Grantor"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Folder", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany("Folders") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Group", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("Groups") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.GroupUser", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Group", "Group") - .WithMany("GroupUsers") - .HasForeignKey("GroupId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", "OrganizationUser") - .WithMany() - .HasForeignKey("OrganizationUserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", null) - .WithMany("GroupUsers") - .HasForeignKey("UserId"); - - b.Navigation("Group"); - - b.Navigation("OrganizationUser"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationApiKey", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("ApiKeys") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationConnection", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("Connections") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationSponsorship", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "SponsoredOrganization") - .WithMany() - .HasForeignKey("SponsoredOrganizationId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "SponsoringOrganization") - .WithMany() - .HasForeignKey("SponsoringOrganizationId"); - - b.Navigation("SponsoredOrganization"); - - b.Navigation("SponsoringOrganization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("OrganizationUsers") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany("OrganizationUsers") - .HasForeignKey("UserId"); - - b.Navigation("Organization"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Policy", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("Policies") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Project", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany() - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ProviderOrganization", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany() - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Provider", "Provider") - .WithMany() - .HasForeignKey("ProviderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - - b.Navigation("Provider"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ProviderUser", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Provider", "Provider") - .WithMany() - .HasForeignKey("ProviderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany() - .HasForeignKey("UserId"); - - b.Navigation("Provider"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Secret", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany() - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Send", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany() - .HasForeignKey("OrganizationId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany() - .HasForeignKey("UserId"); - - b.Navigation("Organization"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ServiceAccount", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany() - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.SsoConfig", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("SsoConfigs") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.SsoUser", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("SsoUsers") - .HasForeignKey("OrganizationId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany("SsoUsers") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Transaction", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("Transactions") - .HasForeignKey("OrganizationId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany("Transactions") - .HasForeignKey("UserId"); - - b.Navigation("Organization"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Cipher", b => - { - b.Navigation("CollectionCiphers"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Collection", b => - { - b.Navigation("CollectionCiphers"); - - b.Navigation("CollectionGroups"); - - b.Navigation("CollectionUsers"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Group", b => - { - b.Navigation("GroupUsers"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Organization", b => - { - b.Navigation("ApiKeys"); - - b.Navigation("Ciphers"); - - b.Navigation("Connections"); - - b.Navigation("Groups"); - - b.Navigation("OrganizationUsers"); - - b.Navigation("Policies"); - - b.Navigation("SsoConfigs"); - - b.Navigation("SsoUsers"); - - b.Navigation("Transactions"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", b => - { - b.Navigation("CollectionUsers"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.User", b => - { - b.Navigation("Ciphers"); - - b.Navigation("CollectionUsers"); - - b.Navigation("Folders"); - - b.Navigation("GroupUsers"); - - b.Navigation("OrganizationUsers"); - - b.Navigation("SsoUsers"); - - b.Navigation("Transactions"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/util/PostgresMigrations/Migrations/20220926190851_SmServiceAccount.cs b/util/PostgresMigrations/Migrations/20220926190851_SmServiceAccount.cs deleted file mode 100644 index 31d515b95260..000000000000 --- a/util/PostgresMigrations/Migrations/20220926190851_SmServiceAccount.cs +++ /dev/null @@ -1,43 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Bit.PostgresMigrations.Migrations; - -public partial class SmServiceAccount : Migration -{ - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "ServiceAccount", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - OrganizationId = table.Column(type: "uuid", nullable: false), - Name = table.Column(type: "text", nullable: true), - CreationDate = table.Column(type: "timestamp without time zone", nullable: false), - RevisionDate = table.Column(type: "timestamp without time zone", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ServiceAccount", x => x.Id); - table.ForeignKey( - name: "FK_ServiceAccount_Organization_OrganizationId", - column: x => x.OrganizationId, - principalTable: "Organization", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_ServiceAccount_OrganizationId", - table: "ServiceAccount", - column: "OrganizationId"); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "ServiceAccount"); - } -} diff --git a/util/PostgresMigrations/Migrations/20221010151608_ApiKey.Designer.cs b/util/PostgresMigrations/Migrations/20221010151608_ApiKey.Designer.cs deleted file mode 100644 index a0732c950e66..000000000000 --- a/util/PostgresMigrations/Migrations/20221010151608_ApiKey.Designer.cs +++ /dev/null @@ -1,1866 +0,0 @@ -// -using System; -using Bit.Infrastructure.EntityFramework.Repositories; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace Bit.PostgresMigrations.Migrations -{ - [DbContext(typeof(DatabaseContext))] - [Migration("20221010151608_ApiKey")] - partial class ApiKey - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("Npgsql:CollationDefinition:postgresIndetermanisticCollation", "en-u-ks-primary,en-u-ks-primary,icu,False") - .HasAnnotation("ProductVersion", "6.0.4") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ApiKey", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("ClientSecret") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("EncryptedPayload") - .HasMaxLength(4000) - .HasColumnType("character varying(4000)"); - - b.Property("ExpireAt") - .HasColumnType("timestamp without time zone"); - - b.Property("Key") - .HasColumnType("text"); - - b.Property("Name") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Scope") - .HasMaxLength(4000) - .HasColumnType("character varying(4000)"); - - b.Property("ServiceAccountId") - .HasColumnType("uuid"); - - b.HasKey("Id") - .HasAnnotation("SqlServer:Clustered", true); - - b.HasIndex("ServiceAccountId") - .HasAnnotation("SqlServer:Clustered", false); - - b.ToTable("ApiKey", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.AuthRequest", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("AccessCode") - .HasMaxLength(25) - .HasColumnType("character varying(25)"); - - b.Property("AuthenticationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Key") - .HasColumnType("text"); - - b.Property("MasterPasswordHash") - .HasColumnType("text"); - - b.Property("PublicKey") - .HasColumnType("text"); - - b.Property("RequestDeviceIdentifier") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("RequestDeviceType") - .HasColumnType("smallint"); - - b.Property("RequestFingerprint") - .HasColumnType("text"); - - b.Property("RequestIpAddress") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("ResponseDate") - .HasColumnType("timestamp without time zone"); - - b.Property("ResponseDeviceId") - .HasColumnType("uuid"); - - b.Property("Type") - .HasColumnType("smallint"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("ResponseDeviceId"); - - b.HasIndex("UserId"); - - b.ToTable("AuthRequest", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Cipher", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("Attachments") - .HasColumnType("text"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Data") - .HasColumnType("text"); - - b.Property("DeletedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Favorites") - .HasColumnType("text"); - - b.Property("Folders") - .HasColumnType("text"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("Reprompt") - .HasColumnType("smallint"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Type") - .HasColumnType("smallint"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("UserId"); - - b.ToTable("Cipher", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Collection", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("ExternalId") - .HasMaxLength(300) - .HasColumnType("character varying(300)"); - - b.Property("Name") - .HasColumnType("text"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.ToTable("Collection", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionCipher", b => - { - b.Property("CollectionId") - .HasColumnType("uuid"); - - b.Property("CipherId") - .HasColumnType("uuid"); - - b.HasKey("CollectionId", "CipherId"); - - b.HasIndex("CipherId"); - - b.ToTable("CollectionCipher", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionGroup", b => - { - b.Property("CollectionId") - .HasColumnType("uuid"); - - b.Property("GroupId") - .HasColumnType("uuid"); - - b.Property("HidePasswords") - .HasColumnType("boolean"); - - b.Property("ReadOnly") - .HasColumnType("boolean"); - - b.HasKey("CollectionId", "GroupId"); - - b.HasIndex("GroupId"); - - b.ToTable("CollectionGroups"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionUser", b => - { - b.Property("CollectionId") - .HasColumnType("uuid"); - - b.Property("OrganizationUserId") - .HasColumnType("uuid"); - - b.Property("HidePasswords") - .HasColumnType("boolean"); - - b.Property("ReadOnly") - .HasColumnType("boolean"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("CollectionId", "OrganizationUserId"); - - b.HasIndex("OrganizationUserId"); - - b.HasIndex("UserId"); - - b.ToTable("CollectionUsers"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Device", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Identifier") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Name") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("PushToken") - .HasMaxLength(255) - .HasColumnType("character varying(255)"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Type") - .HasColumnType("smallint"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Device", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.EmergencyAccess", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("GranteeId") - .HasColumnType("uuid"); - - b.Property("GrantorId") - .HasColumnType("uuid"); - - b.Property("KeyEncrypted") - .HasColumnType("text"); - - b.Property("LastNotificationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("RecoveryInitiatedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Status") - .HasColumnType("smallint"); - - b.Property("Type") - .HasColumnType("smallint"); - - b.Property("WaitTimeDays") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("GranteeId"); - - b.HasIndex("GrantorId"); - - b.ToTable("EmergencyAccess", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Event", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("ActingUserId") - .HasColumnType("uuid"); - - b.Property("CipherId") - .HasColumnType("uuid"); - - b.Property("CollectionId") - .HasColumnType("uuid"); - - b.Property("Date") - .HasColumnType("timestamp without time zone"); - - b.Property("DeviceType") - .HasColumnType("smallint"); - - b.Property("GroupId") - .HasColumnType("uuid"); - - b.Property("InstallationId") - .HasColumnType("uuid"); - - b.Property("IpAddress") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("OrganizationUserId") - .HasColumnType("uuid"); - - b.Property("PolicyId") - .HasColumnType("uuid"); - - b.Property("ProviderId") - .HasColumnType("uuid"); - - b.Property("ProviderOrganizationId") - .HasColumnType("uuid"); - - b.Property("ProviderUserId") - .HasColumnType("uuid"); - - b.Property("Type") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.ToTable("Event", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Folder", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Name") - .HasColumnType("text"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Folder", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Grant", b => - { - b.Property("Key") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ClientId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ConsumedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Data") - .HasColumnType("text"); - - b.Property("Description") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ExpirationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("SessionId") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SubjectId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Type") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("Key"); - - b.ToTable("Grant", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Group", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("AccessAll") - .HasColumnType("boolean"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("ExternalId") - .HasMaxLength(300) - .HasColumnType("character varying(300)"); - - b.Property("Name") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.ToTable("Group", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.GroupUser", b => - { - b.Property("GroupId") - .HasColumnType("uuid"); - - b.Property("OrganizationUserId") - .HasColumnType("uuid"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("GroupId", "OrganizationUserId"); - - b.HasIndex("OrganizationUserId"); - - b.HasIndex("UserId"); - - b.ToTable("GroupUser", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Installation", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("Enabled") - .HasColumnType("boolean"); - - b.Property("Key") - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.HasKey("Id"); - - b.ToTable("Installation", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Organization", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("BillingEmail") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("BusinessAddress1") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BusinessAddress2") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BusinessAddress3") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BusinessCountry") - .HasMaxLength(2) - .HasColumnType("character varying(2)"); - - b.Property("BusinessName") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BusinessTaxNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Enabled") - .HasColumnType("boolean"); - - b.Property("ExpirationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Gateway") - .HasColumnType("smallint"); - - b.Property("GatewayCustomerId") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("GatewaySubscriptionId") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Identifier") - .HasMaxLength(50) - .HasColumnType("character varying(50)") - .UseCollation("postgresIndetermanisticCollation"); - - b.Property("LicenseKey") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("MaxAutoscaleSeats") - .HasColumnType("integer"); - - b.Property("MaxCollections") - .HasColumnType("smallint"); - - b.Property("MaxStorageGb") - .HasColumnType("smallint"); - - b.Property("Name") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("OwnersNotifiedOfAutoscaling") - .HasColumnType("timestamp without time zone"); - - b.Property("Plan") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("PlanType") - .HasColumnType("smallint"); - - b.Property("PrivateKey") - .HasColumnType("text"); - - b.Property("PublicKey") - .HasColumnType("text"); - - b.Property("ReferenceData") - .HasColumnType("text"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Seats") - .HasColumnType("integer"); - - b.Property("SelfHost") - .HasColumnType("boolean"); - - b.Property("Storage") - .HasColumnType("bigint"); - - b.Property("TwoFactorProviders") - .HasColumnType("text"); - - b.Property("Use2fa") - .HasColumnType("boolean"); - - b.Property("UseApi") - .HasColumnType("boolean"); - - b.Property("UseDirectory") - .HasColumnType("boolean"); - - b.Property("UseEvents") - .HasColumnType("boolean"); - - b.Property("UseGroups") - .HasColumnType("boolean"); - - b.Property("UseKeyConnector") - .HasColumnType("boolean"); - - b.Property("UsePolicies") - .HasColumnType("boolean"); - - b.Property("UseResetPassword") - .HasColumnType("boolean"); - - b.Property("UseScim") - .HasColumnType("boolean"); - - b.Property("UseSso") - .HasColumnType("boolean"); - - b.Property("UseTotp") - .HasColumnType("boolean"); - - b.Property("UsersGetPremium") - .HasColumnType("boolean"); - - b.HasKey("Id"); - - b.ToTable("Organization", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationApiKey", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("ApiKey") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Type") - .HasColumnType("smallint"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.ToTable("OrganizationApiKey", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationConnection", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("Config") - .HasColumnType("text"); - - b.Property("Enabled") - .HasColumnType("boolean"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("Type") - .HasColumnType("smallint"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.ToTable("OrganizationConnection", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationSponsorship", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("FriendlyName") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("LastSyncDate") - .HasColumnType("timestamp without time zone"); - - b.Property("OfferedToEmail") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("PlanSponsorshipType") - .HasColumnType("smallint"); - - b.Property("SponsoredOrganizationId") - .HasColumnType("uuid"); - - b.Property("SponsoringOrganizationId") - .HasColumnType("uuid"); - - b.Property("SponsoringOrganizationUserId") - .HasColumnType("uuid"); - - b.Property("ToDelete") - .HasColumnType("boolean"); - - b.Property("ValidUntil") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id"); - - b.HasIndex("SponsoredOrganizationId"); - - b.HasIndex("SponsoringOrganizationId"); - - b.ToTable("OrganizationSponsorship", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("AccessAll") - .HasColumnType("boolean"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("ExternalId") - .HasMaxLength(300) - .HasColumnType("character varying(300)"); - - b.Property("Key") - .HasColumnType("text"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("Permissions") - .HasColumnType("text"); - - b.Property("ResetPasswordKey") - .HasColumnType("text"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Status") - .HasColumnType("smallint"); - - b.Property("Type") - .HasColumnType("smallint"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("UserId"); - - b.ToTable("OrganizationUser", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Policy", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Data") - .HasColumnType("text"); - - b.Property("Enabled") - .HasColumnType("boolean"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Type") - .HasColumnType("smallint"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.ToTable("Policy", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Project", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("DeletedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Name") - .HasColumnType("text"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id") - .HasAnnotation("SqlServer:Clustered", true); - - b.HasIndex("DeletedDate") - .HasAnnotation("SqlServer:Clustered", false); - - b.HasIndex("OrganizationId") - .HasAnnotation("SqlServer:Clustered", false); - - b.ToTable("Project", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Provider", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("BillingEmail") - .HasColumnType("text"); - - b.Property("BusinessAddress1") - .HasColumnType("text"); - - b.Property("BusinessAddress2") - .HasColumnType("text"); - - b.Property("BusinessAddress3") - .HasColumnType("text"); - - b.Property("BusinessCountry") - .HasColumnType("text"); - - b.Property("BusinessName") - .HasColumnType("text"); - - b.Property("BusinessTaxNumber") - .HasColumnType("text"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Enabled") - .HasColumnType("boolean"); - - b.Property("Name") - .HasColumnType("text"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Status") - .HasColumnType("smallint"); - - b.Property("UseEvents") - .HasColumnType("boolean"); - - b.HasKey("Id"); - - b.ToTable("Provider", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ProviderOrganization", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Key") - .HasColumnType("text"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("ProviderId") - .HasColumnType("uuid"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Settings") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("ProviderId"); - - b.ToTable("ProviderOrganization", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ProviderUser", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Email") - .HasColumnType("text"); - - b.Property("Key") - .HasColumnType("text"); - - b.Property("Permissions") - .HasColumnType("text"); - - b.Property("ProviderId") - .HasColumnType("uuid"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Status") - .HasColumnType("smallint"); - - b.Property("Type") - .HasColumnType("smallint"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("ProviderId"); - - b.HasIndex("UserId"); - - b.ToTable("ProviderUser", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Secret", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("DeletedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Key") - .HasColumnType("text"); - - b.Property("Note") - .HasColumnType("text"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Value") - .HasColumnType("text"); - - b.HasKey("Id") - .HasAnnotation("SqlServer:Clustered", true); - - b.HasIndex("DeletedDate") - .HasAnnotation("SqlServer:Clustered", false); - - b.HasIndex("OrganizationId") - .HasAnnotation("SqlServer:Clustered", false); - - b.ToTable("Secret", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Send", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("AccessCount") - .HasColumnType("integer"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Data") - .HasColumnType("text"); - - b.Property("DeletionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Disabled") - .HasColumnType("boolean"); - - b.Property("ExpirationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("HideEmail") - .HasColumnType("boolean"); - - b.Property("Key") - .HasColumnType("text"); - - b.Property("MaxAccessCount") - .HasColumnType("integer"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("Password") - .HasMaxLength(300) - .HasColumnType("character varying(300)"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Type") - .HasColumnType("smallint"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("UserId"); - - b.ToTable("Send", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ServiceAccount", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Name") - .HasColumnType("text"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id") - .HasAnnotation("SqlServer:Clustered", true); - - b.HasIndex("OrganizationId") - .HasAnnotation("SqlServer:Clustered", false); - - b.ToTable("ServiceAccount", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.SsoConfig", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Data") - .HasColumnType("text"); - - b.Property("Enabled") - .HasColumnType("boolean"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.ToTable("SsoConfig", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.SsoUser", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("ExternalId") - .HasMaxLength(50) - .HasColumnType("character varying(50)") - .UseCollation("postgresIndetermanisticCollation"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("UserId"); - - b.ToTable("SsoUser", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.TaxRate", b => - { - b.Property("Id") - .HasMaxLength(40) - .HasColumnType("character varying(40)"); - - b.Property("Active") - .HasColumnType("boolean"); - - b.Property("Country") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("PostalCode") - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("Rate") - .HasColumnType("numeric"); - - b.Property("State") - .HasMaxLength(2) - .HasColumnType("character varying(2)"); - - b.HasKey("Id"); - - b.ToTable("TaxRate", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Transaction", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("Amount") - .HasColumnType("numeric"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Details") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Gateway") - .HasColumnType("smallint"); - - b.Property("GatewayId") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("PaymentMethodType") - .HasColumnType("smallint"); - - b.Property("Refunded") - .HasColumnType("boolean"); - - b.Property("RefundedAmount") - .HasColumnType("numeric"); - - b.Property("Type") - .HasColumnType("smallint"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("UserId"); - - b.ToTable("Transaction", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.User", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("AccountRevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("ApiKey") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Culture") - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("Email") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .UseCollation("postgresIndetermanisticCollation"); - - b.Property("EmailVerified") - .HasColumnType("boolean"); - - b.Property("EquivalentDomains") - .HasColumnType("text"); - - b.Property("ExcludedGlobalEquivalentDomains") - .HasColumnType("text"); - - b.Property("FailedLoginCount") - .HasColumnType("integer"); - - b.Property("ForcePasswordReset") - .HasColumnType("boolean"); - - b.Property("Gateway") - .HasColumnType("smallint"); - - b.Property("GatewayCustomerId") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("GatewaySubscriptionId") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Kdf") - .HasColumnType("smallint"); - - b.Property("KdfIterations") - .HasColumnType("integer"); - - b.Property("Key") - .HasColumnType("text"); - - b.Property("LastFailedLoginDate") - .HasColumnType("timestamp without time zone"); - - b.Property("LicenseKey") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("MasterPassword") - .HasMaxLength(300) - .HasColumnType("character varying(300)"); - - b.Property("MasterPasswordHint") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("MaxStorageGb") - .HasColumnType("smallint"); - - b.Property("Name") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Premium") - .HasColumnType("boolean"); - - b.Property("PremiumExpirationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("PrivateKey") - .HasColumnType("text"); - - b.Property("PublicKey") - .HasColumnType("text"); - - b.Property("ReferenceData") - .HasColumnType("text"); - - b.Property("RenewalReminderDate") - .HasColumnType("timestamp without time zone"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("SecurityStamp") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Storage") - .HasColumnType("bigint"); - - b.Property("TwoFactorProviders") - .HasColumnType("text"); - - b.Property("TwoFactorRecoveryCode") - .HasMaxLength(32) - .HasColumnType("character varying(32)"); - - b.Property("UnknownDeviceVerificationEnabled") - .HasColumnType("boolean"); - - b.Property("UsesKeyConnector") - .HasColumnType("boolean"); - - b.HasKey("Id"); - - b.ToTable("User", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ApiKey", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.ServiceAccount", "ServiceAccount") - .WithMany() - .HasForeignKey("ServiceAccountId"); - - b.Navigation("ServiceAccount"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.AuthRequest", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Device", "ResponseDevice") - .WithMany() - .HasForeignKey("ResponseDeviceId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ResponseDevice"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Cipher", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("Ciphers") - .HasForeignKey("OrganizationId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany("Ciphers") - .HasForeignKey("UserId"); - - b.Navigation("Organization"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Collection", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany() - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionCipher", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Cipher", "Cipher") - .WithMany("CollectionCiphers") - .HasForeignKey("CipherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Collection", "Collection") - .WithMany("CollectionCiphers") - .HasForeignKey("CollectionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Cipher"); - - b.Navigation("Collection"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionGroup", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Collection", "Collection") - .WithMany("CollectionGroups") - .HasForeignKey("CollectionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Group", "Group") - .WithMany() - .HasForeignKey("GroupId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Collection"); - - b.Navigation("Group"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionUser", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Collection", "Collection") - .WithMany("CollectionUsers") - .HasForeignKey("CollectionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", "OrganizationUser") - .WithMany("CollectionUsers") - .HasForeignKey("OrganizationUserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", null) - .WithMany("CollectionUsers") - .HasForeignKey("UserId"); - - b.Navigation("Collection"); - - b.Navigation("OrganizationUser"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Device", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.EmergencyAccess", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "Grantee") - .WithMany() - .HasForeignKey("GranteeId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "Grantor") - .WithMany() - .HasForeignKey("GrantorId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Grantee"); - - b.Navigation("Grantor"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Folder", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany("Folders") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Group", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("Groups") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.GroupUser", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Group", "Group") - .WithMany("GroupUsers") - .HasForeignKey("GroupId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", "OrganizationUser") - .WithMany() - .HasForeignKey("OrganizationUserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", null) - .WithMany("GroupUsers") - .HasForeignKey("UserId"); - - b.Navigation("Group"); - - b.Navigation("OrganizationUser"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationApiKey", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("ApiKeys") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationConnection", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("Connections") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationSponsorship", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "SponsoredOrganization") - .WithMany() - .HasForeignKey("SponsoredOrganizationId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "SponsoringOrganization") - .WithMany() - .HasForeignKey("SponsoringOrganizationId"); - - b.Navigation("SponsoredOrganization"); - - b.Navigation("SponsoringOrganization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("OrganizationUsers") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany("OrganizationUsers") - .HasForeignKey("UserId"); - - b.Navigation("Organization"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Policy", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("Policies") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Project", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany() - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ProviderOrganization", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany() - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Provider", "Provider") - .WithMany() - .HasForeignKey("ProviderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - - b.Navigation("Provider"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ProviderUser", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Provider", "Provider") - .WithMany() - .HasForeignKey("ProviderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany() - .HasForeignKey("UserId"); - - b.Navigation("Provider"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Secret", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany() - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Send", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany() - .HasForeignKey("OrganizationId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany() - .HasForeignKey("UserId"); - - b.Navigation("Organization"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ServiceAccount", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany() - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.SsoConfig", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("SsoConfigs") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.SsoUser", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("SsoUsers") - .HasForeignKey("OrganizationId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany("SsoUsers") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Transaction", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("Transactions") - .HasForeignKey("OrganizationId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany("Transactions") - .HasForeignKey("UserId"); - - b.Navigation("Organization"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Cipher", b => - { - b.Navigation("CollectionCiphers"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Collection", b => - { - b.Navigation("CollectionCiphers"); - - b.Navigation("CollectionGroups"); - - b.Navigation("CollectionUsers"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Group", b => - { - b.Navigation("GroupUsers"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Organization", b => - { - b.Navigation("ApiKeys"); - - b.Navigation("Ciphers"); - - b.Navigation("Connections"); - - b.Navigation("Groups"); - - b.Navigation("OrganizationUsers"); - - b.Navigation("Policies"); - - b.Navigation("SsoConfigs"); - - b.Navigation("SsoUsers"); - - b.Navigation("Transactions"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", b => - { - b.Navigation("CollectionUsers"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.User", b => - { - b.Navigation("Ciphers"); - - b.Navigation("CollectionUsers"); - - b.Navigation("Folders"); - - b.Navigation("GroupUsers"); - - b.Navigation("OrganizationUsers"); - - b.Navigation("SsoUsers"); - - b.Navigation("Transactions"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/util/PostgresMigrations/Migrations/20221010151608_ApiKey.cs b/util/PostgresMigrations/Migrations/20221010151608_ApiKey.cs deleted file mode 100644 index b4eb6dcfb21a..000000000000 --- a/util/PostgresMigrations/Migrations/20221010151608_ApiKey.cs +++ /dev/null @@ -1,159 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Bit.PostgresMigrations.Migrations; - -public partial class ApiKey : Migration -{ - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "ResponseDate", - table: "AuthRequest", - type: "timestamp without time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "RequestIpAddress", - table: "AuthRequest", - type: "character varying(50)", - maxLength: 50, - nullable: true, - oldClrType: typeof(string), - oldType: "text", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "RequestDeviceIdentifier", - table: "AuthRequest", - type: "character varying(50)", - maxLength: 50, - nullable: true, - oldClrType: typeof(string), - oldType: "text", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreationDate", - table: "AuthRequest", - type: "timestamp without time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AlterColumn( - name: "AuthenticationDate", - table: "AuthRequest", - type: "timestamp without time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "AccessCode", - table: "AuthRequest", - type: "character varying(25)", - maxLength: 25, - nullable: true, - oldClrType: typeof(string), - oldType: "text", - oldNullable: true); - - migrationBuilder.CreateTable( - name: "ApiKey", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - ServiceAccountId = table.Column(type: "uuid", nullable: true), - Name = table.Column(type: "character varying(200)", maxLength: 200, nullable: true), - ClientSecret = table.Column(type: "character varying(30)", maxLength: 30, nullable: true), - Scope = table.Column(type: "character varying(4000)", maxLength: 4000, nullable: true), - EncryptedPayload = table.Column(type: "character varying(4000)", maxLength: 4000, nullable: true), - Key = table.Column(type: "text", nullable: true), - ExpireAt = table.Column(type: "timestamp without time zone", nullable: false), - CreationDate = table.Column(type: "timestamp without time zone", nullable: false), - RevisionDate = table.Column(type: "timestamp without time zone", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ApiKey", x => x.Id); - table.ForeignKey( - name: "FK_ApiKey_ServiceAccount_ServiceAccountId", - column: x => x.ServiceAccountId, - principalTable: "ServiceAccount", - principalColumn: "Id"); - }); - - migrationBuilder.CreateIndex( - name: "IX_ApiKey_ServiceAccountId", - table: "ApiKey", - column: "ServiceAccountId"); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "ApiKey"); - - migrationBuilder.AlterColumn( - name: "ResponseDate", - table: "AuthRequest", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp without time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "RequestIpAddress", - table: "AuthRequest", - type: "text", - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(50)", - oldMaxLength: 50, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "RequestDeviceIdentifier", - table: "AuthRequest", - type: "text", - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(50)", - oldMaxLength: 50, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreationDate", - table: "AuthRequest", - type: "timestamp with time zone", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "timestamp without time zone"); - - migrationBuilder.AlterColumn( - name: "AuthenticationDate", - table: "AuthRequest", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp without time zone", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "AccessCode", - table: "AuthRequest", - type: "text", - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(25)", - oldMaxLength: 25, - oldNullable: true); - } -} diff --git a/util/PostgresMigrations/Migrations/20221018155821_ProjectSecret.Designer.cs b/util/PostgresMigrations/Migrations/20221018155821_ProjectSecret.Designer.cs deleted file mode 100644 index 9f4c71464b58..000000000000 --- a/util/PostgresMigrations/Migrations/20221018155821_ProjectSecret.Designer.cs +++ /dev/null @@ -1,1896 +0,0 @@ -// -using System; -using Bit.Infrastructure.EntityFramework.Repositories; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace Bit.PostgresMigrations.Migrations -{ - [DbContext(typeof(DatabaseContext))] - [Migration("20221018155821_ProjectSecret")] - partial class ProjectSecret - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("Npgsql:CollationDefinition:postgresIndetermanisticCollation", "en-u-ks-primary,en-u-ks-primary,icu,False") - .HasAnnotation("ProductVersion", "6.0.4") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ApiKey", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("ClientSecret") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("EncryptedPayload") - .HasMaxLength(4000) - .HasColumnType("character varying(4000)"); - - b.Property("ExpireAt") - .HasColumnType("timestamp without time zone"); - - b.Property("Key") - .HasColumnType("text"); - - b.Property("Name") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Scope") - .HasMaxLength(4000) - .HasColumnType("character varying(4000)"); - - b.Property("ServiceAccountId") - .HasColumnType("uuid"); - - b.HasKey("Id") - .HasAnnotation("SqlServer:Clustered", true); - - b.HasIndex("ServiceAccountId") - .HasAnnotation("SqlServer:Clustered", false); - - b.ToTable("ApiKey", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.AuthRequest", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("AccessCode") - .HasMaxLength(25) - .HasColumnType("character varying(25)"); - - b.Property("AuthenticationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Key") - .HasColumnType("text"); - - b.Property("MasterPasswordHash") - .HasColumnType("text"); - - b.Property("PublicKey") - .HasColumnType("text"); - - b.Property("RequestDeviceIdentifier") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("RequestDeviceType") - .HasColumnType("smallint"); - - b.Property("RequestFingerprint") - .HasColumnType("text"); - - b.Property("RequestIpAddress") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("ResponseDate") - .HasColumnType("timestamp without time zone"); - - b.Property("ResponseDeviceId") - .HasColumnType("uuid"); - - b.Property("Type") - .HasColumnType("smallint"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("ResponseDeviceId"); - - b.HasIndex("UserId"); - - b.ToTable("AuthRequest", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Cipher", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("Attachments") - .HasColumnType("text"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Data") - .HasColumnType("text"); - - b.Property("DeletedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Favorites") - .HasColumnType("text"); - - b.Property("Folders") - .HasColumnType("text"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("Reprompt") - .HasColumnType("smallint"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Type") - .HasColumnType("smallint"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("UserId"); - - b.ToTable("Cipher", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Collection", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("ExternalId") - .HasMaxLength(300) - .HasColumnType("character varying(300)"); - - b.Property("Name") - .HasColumnType("text"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.ToTable("Collection", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionCipher", b => - { - b.Property("CollectionId") - .HasColumnType("uuid"); - - b.Property("CipherId") - .HasColumnType("uuid"); - - b.HasKey("CollectionId", "CipherId"); - - b.HasIndex("CipherId"); - - b.ToTable("CollectionCipher", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionGroup", b => - { - b.Property("CollectionId") - .HasColumnType("uuid"); - - b.Property("GroupId") - .HasColumnType("uuid"); - - b.Property("HidePasswords") - .HasColumnType("boolean"); - - b.Property("ReadOnly") - .HasColumnType("boolean"); - - b.HasKey("CollectionId", "GroupId"); - - b.HasIndex("GroupId"); - - b.ToTable("CollectionGroups"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionUser", b => - { - b.Property("CollectionId") - .HasColumnType("uuid"); - - b.Property("OrganizationUserId") - .HasColumnType("uuid"); - - b.Property("HidePasswords") - .HasColumnType("boolean"); - - b.Property("ReadOnly") - .HasColumnType("boolean"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("CollectionId", "OrganizationUserId"); - - b.HasIndex("OrganizationUserId"); - - b.HasIndex("UserId"); - - b.ToTable("CollectionUsers"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Device", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Identifier") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Name") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("PushToken") - .HasMaxLength(255) - .HasColumnType("character varying(255)"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Type") - .HasColumnType("smallint"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Device", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.EmergencyAccess", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("GranteeId") - .HasColumnType("uuid"); - - b.Property("GrantorId") - .HasColumnType("uuid"); - - b.Property("KeyEncrypted") - .HasColumnType("text"); - - b.Property("LastNotificationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("RecoveryInitiatedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Status") - .HasColumnType("smallint"); - - b.Property("Type") - .HasColumnType("smallint"); - - b.Property("WaitTimeDays") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("GranteeId"); - - b.HasIndex("GrantorId"); - - b.ToTable("EmergencyAccess", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Event", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("ActingUserId") - .HasColumnType("uuid"); - - b.Property("CipherId") - .HasColumnType("uuid"); - - b.Property("CollectionId") - .HasColumnType("uuid"); - - b.Property("Date") - .HasColumnType("timestamp without time zone"); - - b.Property("DeviceType") - .HasColumnType("smallint"); - - b.Property("GroupId") - .HasColumnType("uuid"); - - b.Property("InstallationId") - .HasColumnType("uuid"); - - b.Property("IpAddress") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("OrganizationUserId") - .HasColumnType("uuid"); - - b.Property("PolicyId") - .HasColumnType("uuid"); - - b.Property("ProviderId") - .HasColumnType("uuid"); - - b.Property("ProviderOrganizationId") - .HasColumnType("uuid"); - - b.Property("ProviderUserId") - .HasColumnType("uuid"); - - b.Property("Type") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.ToTable("Event", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Folder", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Name") - .HasColumnType("text"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Folder", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Grant", b => - { - b.Property("Key") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ClientId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ConsumedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Data") - .HasColumnType("text"); - - b.Property("Description") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ExpirationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("SessionId") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SubjectId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Type") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("Key"); - - b.ToTable("Grant", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Group", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("AccessAll") - .HasColumnType("boolean"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("ExternalId") - .HasMaxLength(300) - .HasColumnType("character varying(300)"); - - b.Property("Name") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.ToTable("Group", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.GroupUser", b => - { - b.Property("GroupId") - .HasColumnType("uuid"); - - b.Property("OrganizationUserId") - .HasColumnType("uuid"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("GroupId", "OrganizationUserId"); - - b.HasIndex("OrganizationUserId"); - - b.HasIndex("UserId"); - - b.ToTable("GroupUser", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Installation", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("Enabled") - .HasColumnType("boolean"); - - b.Property("Key") - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.HasKey("Id"); - - b.ToTable("Installation", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Organization", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("BillingEmail") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("BusinessAddress1") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BusinessAddress2") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BusinessAddress3") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BusinessCountry") - .HasMaxLength(2) - .HasColumnType("character varying(2)"); - - b.Property("BusinessName") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BusinessTaxNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Enabled") - .HasColumnType("boolean"); - - b.Property("ExpirationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Gateway") - .HasColumnType("smallint"); - - b.Property("GatewayCustomerId") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("GatewaySubscriptionId") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Identifier") - .HasMaxLength(50) - .HasColumnType("character varying(50)") - .UseCollation("postgresIndetermanisticCollation"); - - b.Property("LicenseKey") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("MaxAutoscaleSeats") - .HasColumnType("integer"); - - b.Property("MaxCollections") - .HasColumnType("smallint"); - - b.Property("MaxStorageGb") - .HasColumnType("smallint"); - - b.Property("Name") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("OwnersNotifiedOfAutoscaling") - .HasColumnType("timestamp without time zone"); - - b.Property("Plan") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("PlanType") - .HasColumnType("smallint"); - - b.Property("PrivateKey") - .HasColumnType("text"); - - b.Property("PublicKey") - .HasColumnType("text"); - - b.Property("ReferenceData") - .HasColumnType("text"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Seats") - .HasColumnType("integer"); - - b.Property("SelfHost") - .HasColumnType("boolean"); - - b.Property("Storage") - .HasColumnType("bigint"); - - b.Property("TwoFactorProviders") - .HasColumnType("text"); - - b.Property("Use2fa") - .HasColumnType("boolean"); - - b.Property("UseApi") - .HasColumnType("boolean"); - - b.Property("UseDirectory") - .HasColumnType("boolean"); - - b.Property("UseEvents") - .HasColumnType("boolean"); - - b.Property("UseGroups") - .HasColumnType("boolean"); - - b.Property("UseKeyConnector") - .HasColumnType("boolean"); - - b.Property("UsePolicies") - .HasColumnType("boolean"); - - b.Property("UseResetPassword") - .HasColumnType("boolean"); - - b.Property("UseScim") - .HasColumnType("boolean"); - - b.Property("UseSso") - .HasColumnType("boolean"); - - b.Property("UseTotp") - .HasColumnType("boolean"); - - b.Property("UsersGetPremium") - .HasColumnType("boolean"); - - b.HasKey("Id"); - - b.ToTable("Organization", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationApiKey", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("ApiKey") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Type") - .HasColumnType("smallint"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.ToTable("OrganizationApiKey", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationConnection", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("Config") - .HasColumnType("text"); - - b.Property("Enabled") - .HasColumnType("boolean"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("Type") - .HasColumnType("smallint"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.ToTable("OrganizationConnection", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationSponsorship", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("FriendlyName") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("LastSyncDate") - .HasColumnType("timestamp without time zone"); - - b.Property("OfferedToEmail") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("PlanSponsorshipType") - .HasColumnType("smallint"); - - b.Property("SponsoredOrganizationId") - .HasColumnType("uuid"); - - b.Property("SponsoringOrganizationId") - .HasColumnType("uuid"); - - b.Property("SponsoringOrganizationUserId") - .HasColumnType("uuid"); - - b.Property("ToDelete") - .HasColumnType("boolean"); - - b.Property("ValidUntil") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id"); - - b.HasIndex("SponsoredOrganizationId"); - - b.HasIndex("SponsoringOrganizationId"); - - b.ToTable("OrganizationSponsorship", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("AccessAll") - .HasColumnType("boolean"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("ExternalId") - .HasMaxLength(300) - .HasColumnType("character varying(300)"); - - b.Property("Key") - .HasColumnType("text"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("Permissions") - .HasColumnType("text"); - - b.Property("ResetPasswordKey") - .HasColumnType("text"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Status") - .HasColumnType("smallint"); - - b.Property("Type") - .HasColumnType("smallint"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("UserId"); - - b.ToTable("OrganizationUser", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Policy", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Data") - .HasColumnType("text"); - - b.Property("Enabled") - .HasColumnType("boolean"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Type") - .HasColumnType("smallint"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.ToTable("Policy", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Project", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("DeletedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Name") - .HasColumnType("text"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id") - .HasAnnotation("SqlServer:Clustered", true); - - b.HasIndex("DeletedDate") - .HasAnnotation("SqlServer:Clustered", false); - - b.HasIndex("OrganizationId") - .HasAnnotation("SqlServer:Clustered", false); - - b.ToTable("Project", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Provider", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("BillingEmail") - .HasColumnType("text"); - - b.Property("BusinessAddress1") - .HasColumnType("text"); - - b.Property("BusinessAddress2") - .HasColumnType("text"); - - b.Property("BusinessAddress3") - .HasColumnType("text"); - - b.Property("BusinessCountry") - .HasColumnType("text"); - - b.Property("BusinessName") - .HasColumnType("text"); - - b.Property("BusinessTaxNumber") - .HasColumnType("text"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Enabled") - .HasColumnType("boolean"); - - b.Property("Name") - .HasColumnType("text"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Status") - .HasColumnType("smallint"); - - b.Property("UseEvents") - .HasColumnType("boolean"); - - b.HasKey("Id"); - - b.ToTable("Provider", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ProviderOrganization", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Key") - .HasColumnType("text"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("ProviderId") - .HasColumnType("uuid"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Settings") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("ProviderId"); - - b.ToTable("ProviderOrganization", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ProviderUser", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Email") - .HasColumnType("text"); - - b.Property("Key") - .HasColumnType("text"); - - b.Property("Permissions") - .HasColumnType("text"); - - b.Property("ProviderId") - .HasColumnType("uuid"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Status") - .HasColumnType("smallint"); - - b.Property("Type") - .HasColumnType("smallint"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("ProviderId"); - - b.HasIndex("UserId"); - - b.ToTable("ProviderUser", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Secret", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("DeletedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Key") - .HasColumnType("text"); - - b.Property("Note") - .HasColumnType("text"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Value") - .HasColumnType("text"); - - b.HasKey("Id") - .HasAnnotation("SqlServer:Clustered", true); - - b.HasIndex("DeletedDate") - .HasAnnotation("SqlServer:Clustered", false); - - b.HasIndex("OrganizationId") - .HasAnnotation("SqlServer:Clustered", false); - - b.ToTable("Secret", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Send", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("AccessCount") - .HasColumnType("integer"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Data") - .HasColumnType("text"); - - b.Property("DeletionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Disabled") - .HasColumnType("boolean"); - - b.Property("ExpirationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("HideEmail") - .HasColumnType("boolean"); - - b.Property("Key") - .HasColumnType("text"); - - b.Property("MaxAccessCount") - .HasColumnType("integer"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("Password") - .HasMaxLength(300) - .HasColumnType("character varying(300)"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Type") - .HasColumnType("smallint"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("UserId"); - - b.ToTable("Send", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ServiceAccount", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Name") - .HasColumnType("text"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id") - .HasAnnotation("SqlServer:Clustered", true); - - b.HasIndex("OrganizationId") - .HasAnnotation("SqlServer:Clustered", false); - - b.ToTable("ServiceAccount", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.SsoConfig", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Data") - .HasColumnType("text"); - - b.Property("Enabled") - .HasColumnType("boolean"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.ToTable("SsoConfig", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.SsoUser", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("ExternalId") - .HasMaxLength(50) - .HasColumnType("character varying(50)") - .UseCollation("postgresIndetermanisticCollation"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("UserId"); - - b.ToTable("SsoUser", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.TaxRate", b => - { - b.Property("Id") - .HasMaxLength(40) - .HasColumnType("character varying(40)"); - - b.Property("Active") - .HasColumnType("boolean"); - - b.Property("Country") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("PostalCode") - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("Rate") - .HasColumnType("numeric"); - - b.Property("State") - .HasMaxLength(2) - .HasColumnType("character varying(2)"); - - b.HasKey("Id"); - - b.ToTable("TaxRate", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Transaction", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("Amount") - .HasColumnType("numeric"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Details") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Gateway") - .HasColumnType("smallint"); - - b.Property("GatewayId") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("PaymentMethodType") - .HasColumnType("smallint"); - - b.Property("Refunded") - .HasColumnType("boolean"); - - b.Property("RefundedAmount") - .HasColumnType("numeric"); - - b.Property("Type") - .HasColumnType("smallint"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("UserId"); - - b.ToTable("Transaction", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.User", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("AccountRevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("ApiKey") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Culture") - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("Email") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .UseCollation("postgresIndetermanisticCollation"); - - b.Property("EmailVerified") - .HasColumnType("boolean"); - - b.Property("EquivalentDomains") - .HasColumnType("text"); - - b.Property("ExcludedGlobalEquivalentDomains") - .HasColumnType("text"); - - b.Property("FailedLoginCount") - .HasColumnType("integer"); - - b.Property("ForcePasswordReset") - .HasColumnType("boolean"); - - b.Property("Gateway") - .HasColumnType("smallint"); - - b.Property("GatewayCustomerId") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("GatewaySubscriptionId") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Kdf") - .HasColumnType("smallint"); - - b.Property("KdfIterations") - .HasColumnType("integer"); - - b.Property("Key") - .HasColumnType("text"); - - b.Property("LastFailedLoginDate") - .HasColumnType("timestamp without time zone"); - - b.Property("LicenseKey") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("MasterPassword") - .HasMaxLength(300) - .HasColumnType("character varying(300)"); - - b.Property("MasterPasswordHint") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("MaxStorageGb") - .HasColumnType("smallint"); - - b.Property("Name") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Premium") - .HasColumnType("boolean"); - - b.Property("PremiumExpirationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("PrivateKey") - .HasColumnType("text"); - - b.Property("PublicKey") - .HasColumnType("text"); - - b.Property("ReferenceData") - .HasColumnType("text"); - - b.Property("RenewalReminderDate") - .HasColumnType("timestamp without time zone"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("SecurityStamp") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Storage") - .HasColumnType("bigint"); - - b.Property("TwoFactorProviders") - .HasColumnType("text"); - - b.Property("TwoFactorRecoveryCode") - .HasMaxLength(32) - .HasColumnType("character varying(32)"); - - b.Property("UnknownDeviceVerificationEnabled") - .HasColumnType("boolean"); - - b.Property("UsesKeyConnector") - .HasColumnType("boolean"); - - b.HasKey("Id"); - - b.ToTable("User", (string)null); - }); - - modelBuilder.Entity("ProjectSecret", b => - { - b.Property("ProjectsId") - .HasColumnType("uuid"); - - b.Property("SecretsId") - .HasColumnType("uuid"); - - b.HasKey("ProjectsId", "SecretsId"); - - b.HasIndex("SecretsId"); - - b.ToTable("ProjectSecret"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ApiKey", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.ServiceAccount", "ServiceAccount") - .WithMany() - .HasForeignKey("ServiceAccountId"); - - b.Navigation("ServiceAccount"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.AuthRequest", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Device", "ResponseDevice") - .WithMany() - .HasForeignKey("ResponseDeviceId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ResponseDevice"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Cipher", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("Ciphers") - .HasForeignKey("OrganizationId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany("Ciphers") - .HasForeignKey("UserId"); - - b.Navigation("Organization"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Collection", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany() - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionCipher", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Cipher", "Cipher") - .WithMany("CollectionCiphers") - .HasForeignKey("CipherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Collection", "Collection") - .WithMany("CollectionCiphers") - .HasForeignKey("CollectionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Cipher"); - - b.Navigation("Collection"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionGroup", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Collection", "Collection") - .WithMany("CollectionGroups") - .HasForeignKey("CollectionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Group", "Group") - .WithMany() - .HasForeignKey("GroupId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Collection"); - - b.Navigation("Group"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionUser", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Collection", "Collection") - .WithMany("CollectionUsers") - .HasForeignKey("CollectionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", "OrganizationUser") - .WithMany("CollectionUsers") - .HasForeignKey("OrganizationUserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", null) - .WithMany("CollectionUsers") - .HasForeignKey("UserId"); - - b.Navigation("Collection"); - - b.Navigation("OrganizationUser"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Device", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.EmergencyAccess", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "Grantee") - .WithMany() - .HasForeignKey("GranteeId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "Grantor") - .WithMany() - .HasForeignKey("GrantorId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Grantee"); - - b.Navigation("Grantor"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Folder", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany("Folders") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Group", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("Groups") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.GroupUser", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Group", "Group") - .WithMany("GroupUsers") - .HasForeignKey("GroupId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", "OrganizationUser") - .WithMany() - .HasForeignKey("OrganizationUserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", null) - .WithMany("GroupUsers") - .HasForeignKey("UserId"); - - b.Navigation("Group"); - - b.Navigation("OrganizationUser"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationApiKey", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("ApiKeys") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationConnection", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("Connections") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationSponsorship", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "SponsoredOrganization") - .WithMany() - .HasForeignKey("SponsoredOrganizationId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "SponsoringOrganization") - .WithMany() - .HasForeignKey("SponsoringOrganizationId"); - - b.Navigation("SponsoredOrganization"); - - b.Navigation("SponsoringOrganization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("OrganizationUsers") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany("OrganizationUsers") - .HasForeignKey("UserId"); - - b.Navigation("Organization"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Policy", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("Policies") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Project", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany() - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ProviderOrganization", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany() - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Provider", "Provider") - .WithMany() - .HasForeignKey("ProviderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - - b.Navigation("Provider"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ProviderUser", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Provider", "Provider") - .WithMany() - .HasForeignKey("ProviderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany() - .HasForeignKey("UserId"); - - b.Navigation("Provider"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Secret", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany() - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Send", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany() - .HasForeignKey("OrganizationId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany() - .HasForeignKey("UserId"); - - b.Navigation("Organization"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ServiceAccount", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany() - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.SsoConfig", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("SsoConfigs") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.SsoUser", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("SsoUsers") - .HasForeignKey("OrganizationId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany("SsoUsers") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Transaction", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("Transactions") - .HasForeignKey("OrganizationId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany("Transactions") - .HasForeignKey("UserId"); - - b.Navigation("Organization"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ProjectSecret", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Project", null) - .WithMany() - .HasForeignKey("ProjectsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Secret", null) - .WithMany() - .HasForeignKey("SecretsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Cipher", b => - { - b.Navigation("CollectionCiphers"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Collection", b => - { - b.Navigation("CollectionCiphers"); - - b.Navigation("CollectionGroups"); - - b.Navigation("CollectionUsers"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Group", b => - { - b.Navigation("GroupUsers"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Organization", b => - { - b.Navigation("ApiKeys"); - - b.Navigation("Ciphers"); - - b.Navigation("Connections"); - - b.Navigation("Groups"); - - b.Navigation("OrganizationUsers"); - - b.Navigation("Policies"); - - b.Navigation("SsoConfigs"); - - b.Navigation("SsoUsers"); - - b.Navigation("Transactions"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", b => - { - b.Navigation("CollectionUsers"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.User", b => - { - b.Navigation("Ciphers"); - - b.Navigation("CollectionUsers"); - - b.Navigation("Folders"); - - b.Navigation("GroupUsers"); - - b.Navigation("OrganizationUsers"); - - b.Navigation("SsoUsers"); - - b.Navigation("Transactions"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/util/PostgresMigrations/Migrations/20221018155821_ProjectSecret.cs b/util/PostgresMigrations/Migrations/20221018155821_ProjectSecret.cs deleted file mode 100644 index c75589b697d6..000000000000 --- a/util/PostgresMigrations/Migrations/20221018155821_ProjectSecret.cs +++ /dev/null @@ -1,46 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Bit.PostgresMigrations.Migrations; - -public partial class ProjectSecret : Migration -{ - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "ProjectSecret", - columns: table => new - { - ProjectsId = table.Column(type: "uuid", nullable: false), - SecretsId = table.Column(type: "uuid", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ProjectSecret", x => new { x.ProjectsId, x.SecretsId }); - table.ForeignKey( - name: "FK_ProjectSecret_Project_ProjectsId", - column: x => x.ProjectsId, - principalTable: "Project", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_ProjectSecret_Secret_SecretsId", - column: x => x.SecretsId, - principalTable: "Secret", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_ProjectSecret_SecretsId", - table: "ProjectSecret", - column: "SecretsId"); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "ProjectSecret"); - } -} diff --git a/util/PostgresMigrations/Migrations/20221125155541_AccessPolicy.cs b/util/PostgresMigrations/Migrations/20221125155541_AccessPolicy.cs deleted file mode 100644 index 809750532839..000000000000 --- a/util/PostgresMigrations/Migrations/20221125155541_AccessPolicy.cs +++ /dev/null @@ -1,88 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Bit.PostgresMigrations.Migrations; - -public partial class AccessPolicy : Migration -{ - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "AccessPolicy", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - GroupId = table.Column(type: "uuid", nullable: true), - GrantedProjectId = table.Column(type: "uuid", nullable: true), - GrantedServiceAccountId = table.Column(type: "uuid", nullable: true), - ServiceAccountId = table.Column(type: "uuid", nullable: true), - OrganizationUserId = table.Column(type: "uuid", nullable: true), - Read = table.Column(type: "boolean", nullable: false), - Write = table.Column(type: "boolean", nullable: false), - CreationDate = table.Column(type: "timestamp without time zone", nullable: false), - RevisionDate = table.Column(type: "timestamp without time zone", nullable: false), - Discriminator = table.Column(type: "text", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_AccessPolicy", x => x.Id); - table.ForeignKey( - name: "FK_AccessPolicy_Group_GroupId", - column: x => x.GroupId, - principalTable: "Group", - principalColumn: "Id"); - table.ForeignKey( - name: "FK_AccessPolicy_OrganizationUser_OrganizationUserId", - column: x => x.OrganizationUserId, - principalTable: "OrganizationUser", - principalColumn: "Id"); - table.ForeignKey( - name: "FK_AccessPolicy_Project_GrantedProjectId", - column: x => x.GrantedProjectId, - principalTable: "Project", - principalColumn: "Id"); - table.ForeignKey( - name: "FK_AccessPolicy_ServiceAccount_GrantedServiceAccountId", - column: x => x.GrantedServiceAccountId, - principalTable: "ServiceAccount", - principalColumn: "Id"); - table.ForeignKey( - name: "FK_AccessPolicy_ServiceAccount_ServiceAccountId", - column: x => x.ServiceAccountId, - principalTable: "ServiceAccount", - principalColumn: "Id"); - }); - - migrationBuilder.CreateIndex( - name: "IX_AccessPolicy_GrantedProjectId", - table: "AccessPolicy", - column: "GrantedProjectId"); - - migrationBuilder.CreateIndex( - name: "IX_AccessPolicy_GrantedServiceAccountId", - table: "AccessPolicy", - column: "GrantedServiceAccountId"); - - migrationBuilder.CreateIndex( - name: "IX_AccessPolicy_GroupId", - table: "AccessPolicy", - column: "GroupId"); - - migrationBuilder.CreateIndex( - name: "IX_AccessPolicy_OrganizationUserId", - table: "AccessPolicy", - column: "OrganizationUserId"); - - migrationBuilder.CreateIndex( - name: "IX_AccessPolicy_ServiceAccountId", - table: "AccessPolicy", - column: "ServiceAccountId"); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "AccessPolicy"); - } -} diff --git a/util/PostgresMigrations/Migrations/20221130232731_NeverExpireApiKey.Designer.cs b/util/PostgresMigrations/Migrations/20221130232731_NeverExpireApiKey.Designer.cs deleted file mode 100644 index e56b31687197..000000000000 --- a/util/PostgresMigrations/Migrations/20221130232731_NeverExpireApiKey.Designer.cs +++ /dev/null @@ -1,1896 +0,0 @@ -// -using System; -using Bit.Infrastructure.EntityFramework.Repositories; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace Bit.PostgresMigrations.Migrations -{ - [DbContext(typeof(DatabaseContext))] - [Migration("20221130232731_NeverExpireApiKey")] - partial class NeverExpireApiKey - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("Npgsql:CollationDefinition:postgresIndetermanisticCollation", "en-u-ks-primary,en-u-ks-primary,icu,False") - .HasAnnotation("ProductVersion", "6.0.4") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ApiKey", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("ClientSecret") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("EncryptedPayload") - .HasMaxLength(4000) - .HasColumnType("character varying(4000)"); - - b.Property("ExpireAt") - .HasColumnType("timestamp without time zone"); - - b.Property("Key") - .HasColumnType("text"); - - b.Property("Name") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Scope") - .HasMaxLength(4000) - .HasColumnType("character varying(4000)"); - - b.Property("ServiceAccountId") - .HasColumnType("uuid"); - - b.HasKey("Id") - .HasAnnotation("SqlServer:Clustered", true); - - b.HasIndex("ServiceAccountId") - .HasAnnotation("SqlServer:Clustered", false); - - b.ToTable("ApiKey", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.AuthRequest", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("AccessCode") - .HasMaxLength(25) - .HasColumnType("character varying(25)"); - - b.Property("AuthenticationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Key") - .HasColumnType("text"); - - b.Property("MasterPasswordHash") - .HasColumnType("text"); - - b.Property("PublicKey") - .HasColumnType("text"); - - b.Property("RequestDeviceIdentifier") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("RequestDeviceType") - .HasColumnType("smallint"); - - b.Property("RequestFingerprint") - .HasColumnType("text"); - - b.Property("RequestIpAddress") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("ResponseDate") - .HasColumnType("timestamp without time zone"); - - b.Property("ResponseDeviceId") - .HasColumnType("uuid"); - - b.Property("Type") - .HasColumnType("smallint"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("ResponseDeviceId"); - - b.HasIndex("UserId"); - - b.ToTable("AuthRequest", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Cipher", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("Attachments") - .HasColumnType("text"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Data") - .HasColumnType("text"); - - b.Property("DeletedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Favorites") - .HasColumnType("text"); - - b.Property("Folders") - .HasColumnType("text"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("Reprompt") - .HasColumnType("smallint"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Type") - .HasColumnType("smallint"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("UserId"); - - b.ToTable("Cipher", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Collection", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("ExternalId") - .HasMaxLength(300) - .HasColumnType("character varying(300)"); - - b.Property("Name") - .HasColumnType("text"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.ToTable("Collection", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionCipher", b => - { - b.Property("CollectionId") - .HasColumnType("uuid"); - - b.Property("CipherId") - .HasColumnType("uuid"); - - b.HasKey("CollectionId", "CipherId"); - - b.HasIndex("CipherId"); - - b.ToTable("CollectionCipher", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionGroup", b => - { - b.Property("CollectionId") - .HasColumnType("uuid"); - - b.Property("GroupId") - .HasColumnType("uuid"); - - b.Property("HidePasswords") - .HasColumnType("boolean"); - - b.Property("ReadOnly") - .HasColumnType("boolean"); - - b.HasKey("CollectionId", "GroupId"); - - b.HasIndex("GroupId"); - - b.ToTable("CollectionGroups"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionUser", b => - { - b.Property("CollectionId") - .HasColumnType("uuid"); - - b.Property("OrganizationUserId") - .HasColumnType("uuid"); - - b.Property("HidePasswords") - .HasColumnType("boolean"); - - b.Property("ReadOnly") - .HasColumnType("boolean"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("CollectionId", "OrganizationUserId"); - - b.HasIndex("OrganizationUserId"); - - b.HasIndex("UserId"); - - b.ToTable("CollectionUsers"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Device", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Identifier") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Name") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("PushToken") - .HasMaxLength(255) - .HasColumnType("character varying(255)"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Type") - .HasColumnType("smallint"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Device", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.EmergencyAccess", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("GranteeId") - .HasColumnType("uuid"); - - b.Property("GrantorId") - .HasColumnType("uuid"); - - b.Property("KeyEncrypted") - .HasColumnType("text"); - - b.Property("LastNotificationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("RecoveryInitiatedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Status") - .HasColumnType("smallint"); - - b.Property("Type") - .HasColumnType("smallint"); - - b.Property("WaitTimeDays") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("GranteeId"); - - b.HasIndex("GrantorId"); - - b.ToTable("EmergencyAccess", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Event", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("ActingUserId") - .HasColumnType("uuid"); - - b.Property("CipherId") - .HasColumnType("uuid"); - - b.Property("CollectionId") - .HasColumnType("uuid"); - - b.Property("Date") - .HasColumnType("timestamp without time zone"); - - b.Property("DeviceType") - .HasColumnType("smallint"); - - b.Property("GroupId") - .HasColumnType("uuid"); - - b.Property("InstallationId") - .HasColumnType("uuid"); - - b.Property("IpAddress") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("OrganizationUserId") - .HasColumnType("uuid"); - - b.Property("PolicyId") - .HasColumnType("uuid"); - - b.Property("ProviderId") - .HasColumnType("uuid"); - - b.Property("ProviderOrganizationId") - .HasColumnType("uuid"); - - b.Property("ProviderUserId") - .HasColumnType("uuid"); - - b.Property("Type") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.ToTable("Event", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Folder", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Name") - .HasColumnType("text"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Folder", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Grant", b => - { - b.Property("Key") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ClientId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ConsumedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Data") - .HasColumnType("text"); - - b.Property("Description") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ExpirationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("SessionId") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SubjectId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Type") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("Key"); - - b.ToTable("Grant", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Group", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("AccessAll") - .HasColumnType("boolean"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("ExternalId") - .HasMaxLength(300) - .HasColumnType("character varying(300)"); - - b.Property("Name") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.ToTable("Group", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.GroupUser", b => - { - b.Property("GroupId") - .HasColumnType("uuid"); - - b.Property("OrganizationUserId") - .HasColumnType("uuid"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("GroupId", "OrganizationUserId"); - - b.HasIndex("OrganizationUserId"); - - b.HasIndex("UserId"); - - b.ToTable("GroupUser", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Installation", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("Enabled") - .HasColumnType("boolean"); - - b.Property("Key") - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.HasKey("Id"); - - b.ToTable("Installation", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Organization", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("BillingEmail") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("BusinessAddress1") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BusinessAddress2") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BusinessAddress3") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BusinessCountry") - .HasMaxLength(2) - .HasColumnType("character varying(2)"); - - b.Property("BusinessName") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BusinessTaxNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Enabled") - .HasColumnType("boolean"); - - b.Property("ExpirationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Gateway") - .HasColumnType("smallint"); - - b.Property("GatewayCustomerId") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("GatewaySubscriptionId") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Identifier") - .HasMaxLength(50) - .HasColumnType("character varying(50)") - .UseCollation("postgresIndetermanisticCollation"); - - b.Property("LicenseKey") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("MaxAutoscaleSeats") - .HasColumnType("integer"); - - b.Property("MaxCollections") - .HasColumnType("smallint"); - - b.Property("MaxStorageGb") - .HasColumnType("smallint"); - - b.Property("Name") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("OwnersNotifiedOfAutoscaling") - .HasColumnType("timestamp without time zone"); - - b.Property("Plan") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("PlanType") - .HasColumnType("smallint"); - - b.Property("PrivateKey") - .HasColumnType("text"); - - b.Property("PublicKey") - .HasColumnType("text"); - - b.Property("ReferenceData") - .HasColumnType("text"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Seats") - .HasColumnType("integer"); - - b.Property("SelfHost") - .HasColumnType("boolean"); - - b.Property("Storage") - .HasColumnType("bigint"); - - b.Property("TwoFactorProviders") - .HasColumnType("text"); - - b.Property("Use2fa") - .HasColumnType("boolean"); - - b.Property("UseApi") - .HasColumnType("boolean"); - - b.Property("UseDirectory") - .HasColumnType("boolean"); - - b.Property("UseEvents") - .HasColumnType("boolean"); - - b.Property("UseGroups") - .HasColumnType("boolean"); - - b.Property("UseKeyConnector") - .HasColumnType("boolean"); - - b.Property("UsePolicies") - .HasColumnType("boolean"); - - b.Property("UseResetPassword") - .HasColumnType("boolean"); - - b.Property("UseScim") - .HasColumnType("boolean"); - - b.Property("UseSso") - .HasColumnType("boolean"); - - b.Property("UseTotp") - .HasColumnType("boolean"); - - b.Property("UsersGetPremium") - .HasColumnType("boolean"); - - b.HasKey("Id"); - - b.ToTable("Organization", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationApiKey", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("ApiKey") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Type") - .HasColumnType("smallint"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.ToTable("OrganizationApiKey", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationConnection", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("Config") - .HasColumnType("text"); - - b.Property("Enabled") - .HasColumnType("boolean"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("Type") - .HasColumnType("smallint"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.ToTable("OrganizationConnection", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationSponsorship", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("FriendlyName") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("LastSyncDate") - .HasColumnType("timestamp without time zone"); - - b.Property("OfferedToEmail") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("PlanSponsorshipType") - .HasColumnType("smallint"); - - b.Property("SponsoredOrganizationId") - .HasColumnType("uuid"); - - b.Property("SponsoringOrganizationId") - .HasColumnType("uuid"); - - b.Property("SponsoringOrganizationUserId") - .HasColumnType("uuid"); - - b.Property("ToDelete") - .HasColumnType("boolean"); - - b.Property("ValidUntil") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id"); - - b.HasIndex("SponsoredOrganizationId"); - - b.HasIndex("SponsoringOrganizationId"); - - b.ToTable("OrganizationSponsorship", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("AccessAll") - .HasColumnType("boolean"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("ExternalId") - .HasMaxLength(300) - .HasColumnType("character varying(300)"); - - b.Property("Key") - .HasColumnType("text"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("Permissions") - .HasColumnType("text"); - - b.Property("ResetPasswordKey") - .HasColumnType("text"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Status") - .HasColumnType("smallint"); - - b.Property("Type") - .HasColumnType("smallint"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("UserId"); - - b.ToTable("OrganizationUser", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Policy", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Data") - .HasColumnType("text"); - - b.Property("Enabled") - .HasColumnType("boolean"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Type") - .HasColumnType("smallint"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.ToTable("Policy", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Project", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("DeletedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Name") - .HasColumnType("text"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id") - .HasAnnotation("SqlServer:Clustered", true); - - b.HasIndex("DeletedDate") - .HasAnnotation("SqlServer:Clustered", false); - - b.HasIndex("OrganizationId") - .HasAnnotation("SqlServer:Clustered", false); - - b.ToTable("Project", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Provider", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("BillingEmail") - .HasColumnType("text"); - - b.Property("BusinessAddress1") - .HasColumnType("text"); - - b.Property("BusinessAddress2") - .HasColumnType("text"); - - b.Property("BusinessAddress3") - .HasColumnType("text"); - - b.Property("BusinessCountry") - .HasColumnType("text"); - - b.Property("BusinessName") - .HasColumnType("text"); - - b.Property("BusinessTaxNumber") - .HasColumnType("text"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Enabled") - .HasColumnType("boolean"); - - b.Property("Name") - .HasColumnType("text"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Status") - .HasColumnType("smallint"); - - b.Property("UseEvents") - .HasColumnType("boolean"); - - b.HasKey("Id"); - - b.ToTable("Provider", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ProviderOrganization", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Key") - .HasColumnType("text"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("ProviderId") - .HasColumnType("uuid"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Settings") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("ProviderId"); - - b.ToTable("ProviderOrganization", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ProviderUser", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Email") - .HasColumnType("text"); - - b.Property("Key") - .HasColumnType("text"); - - b.Property("Permissions") - .HasColumnType("text"); - - b.Property("ProviderId") - .HasColumnType("uuid"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Status") - .HasColumnType("smallint"); - - b.Property("Type") - .HasColumnType("smallint"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("ProviderId"); - - b.HasIndex("UserId"); - - b.ToTable("ProviderUser", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Secret", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("DeletedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Key") - .HasColumnType("text"); - - b.Property("Note") - .HasColumnType("text"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Value") - .HasColumnType("text"); - - b.HasKey("Id") - .HasAnnotation("SqlServer:Clustered", true); - - b.HasIndex("DeletedDate") - .HasAnnotation("SqlServer:Clustered", false); - - b.HasIndex("OrganizationId") - .HasAnnotation("SqlServer:Clustered", false); - - b.ToTable("Secret", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Send", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("AccessCount") - .HasColumnType("integer"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Data") - .HasColumnType("text"); - - b.Property("DeletionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Disabled") - .HasColumnType("boolean"); - - b.Property("ExpirationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("HideEmail") - .HasColumnType("boolean"); - - b.Property("Key") - .HasColumnType("text"); - - b.Property("MaxAccessCount") - .HasColumnType("integer"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("Password") - .HasMaxLength(300) - .HasColumnType("character varying(300)"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Type") - .HasColumnType("smallint"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("UserId"); - - b.ToTable("Send", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ServiceAccount", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Name") - .HasColumnType("text"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id") - .HasAnnotation("SqlServer:Clustered", true); - - b.HasIndex("OrganizationId") - .HasAnnotation("SqlServer:Clustered", false); - - b.ToTable("ServiceAccount", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.SsoConfig", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Data") - .HasColumnType("text"); - - b.Property("Enabled") - .HasColumnType("boolean"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.ToTable("SsoConfig", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.SsoUser", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("ExternalId") - .HasMaxLength(50) - .HasColumnType("character varying(50)") - .UseCollation("postgresIndetermanisticCollation"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("UserId"); - - b.ToTable("SsoUser", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.TaxRate", b => - { - b.Property("Id") - .HasMaxLength(40) - .HasColumnType("character varying(40)"); - - b.Property("Active") - .HasColumnType("boolean"); - - b.Property("Country") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("PostalCode") - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("Rate") - .HasColumnType("numeric"); - - b.Property("State") - .HasMaxLength(2) - .HasColumnType("character varying(2)"); - - b.HasKey("Id"); - - b.ToTable("TaxRate", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Transaction", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("Amount") - .HasColumnType("numeric"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Details") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Gateway") - .HasColumnType("smallint"); - - b.Property("GatewayId") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("OrganizationId") - .HasColumnType("uuid"); - - b.Property("PaymentMethodType") - .HasColumnType("smallint"); - - b.Property("Refunded") - .HasColumnType("boolean"); - - b.Property("RefundedAmount") - .HasColumnType("numeric"); - - b.Property("Type") - .HasColumnType("smallint"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("UserId"); - - b.ToTable("Transaction", (string)null); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.User", b => - { - b.Property("Id") - .HasColumnType("uuid"); - - b.Property("AccountRevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("ApiKey") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Culture") - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("Email") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .UseCollation("postgresIndetermanisticCollation"); - - b.Property("EmailVerified") - .HasColumnType("boolean"); - - b.Property("EquivalentDomains") - .HasColumnType("text"); - - b.Property("ExcludedGlobalEquivalentDomains") - .HasColumnType("text"); - - b.Property("FailedLoginCount") - .HasColumnType("integer"); - - b.Property("ForcePasswordReset") - .HasColumnType("boolean"); - - b.Property("Gateway") - .HasColumnType("smallint"); - - b.Property("GatewayCustomerId") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("GatewaySubscriptionId") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Kdf") - .HasColumnType("smallint"); - - b.Property("KdfIterations") - .HasColumnType("integer"); - - b.Property("Key") - .HasColumnType("text"); - - b.Property("LastFailedLoginDate") - .HasColumnType("timestamp without time zone"); - - b.Property("LicenseKey") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("MasterPassword") - .HasMaxLength(300) - .HasColumnType("character varying(300)"); - - b.Property("MasterPasswordHint") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("MaxStorageGb") - .HasColumnType("smallint"); - - b.Property("Name") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Premium") - .HasColumnType("boolean"); - - b.Property("PremiumExpirationDate") - .HasColumnType("timestamp without time zone"); - - b.Property("PrivateKey") - .HasColumnType("text"); - - b.Property("PublicKey") - .HasColumnType("text"); - - b.Property("ReferenceData") - .HasColumnType("text"); - - b.Property("RenewalReminderDate") - .HasColumnType("timestamp without time zone"); - - b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); - - b.Property("SecurityStamp") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Storage") - .HasColumnType("bigint"); - - b.Property("TwoFactorProviders") - .HasColumnType("text"); - - b.Property("TwoFactorRecoveryCode") - .HasMaxLength(32) - .HasColumnType("character varying(32)"); - - b.Property("UnknownDeviceVerificationEnabled") - .HasColumnType("boolean"); - - b.Property("UsesKeyConnector") - .HasColumnType("boolean"); - - b.HasKey("Id"); - - b.ToTable("User", (string)null); - }); - - modelBuilder.Entity("ProjectSecret", b => - { - b.Property("ProjectsId") - .HasColumnType("uuid"); - - b.Property("SecretsId") - .HasColumnType("uuid"); - - b.HasKey("ProjectsId", "SecretsId"); - - b.HasIndex("SecretsId"); - - b.ToTable("ProjectSecret"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ApiKey", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.ServiceAccount", "ServiceAccount") - .WithMany() - .HasForeignKey("ServiceAccountId"); - - b.Navigation("ServiceAccount"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.AuthRequest", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Device", "ResponseDevice") - .WithMany() - .HasForeignKey("ResponseDeviceId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ResponseDevice"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Cipher", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("Ciphers") - .HasForeignKey("OrganizationId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany("Ciphers") - .HasForeignKey("UserId"); - - b.Navigation("Organization"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Collection", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany() - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionCipher", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Cipher", "Cipher") - .WithMany("CollectionCiphers") - .HasForeignKey("CipherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Collection", "Collection") - .WithMany("CollectionCiphers") - .HasForeignKey("CollectionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Cipher"); - - b.Navigation("Collection"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionGroup", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Collection", "Collection") - .WithMany("CollectionGroups") - .HasForeignKey("CollectionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Group", "Group") - .WithMany() - .HasForeignKey("GroupId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Collection"); - - b.Navigation("Group"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionUser", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Collection", "Collection") - .WithMany("CollectionUsers") - .HasForeignKey("CollectionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", "OrganizationUser") - .WithMany("CollectionUsers") - .HasForeignKey("OrganizationUserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", null) - .WithMany("CollectionUsers") - .HasForeignKey("UserId"); - - b.Navigation("Collection"); - - b.Navigation("OrganizationUser"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Device", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.EmergencyAccess", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "Grantee") - .WithMany() - .HasForeignKey("GranteeId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "Grantor") - .WithMany() - .HasForeignKey("GrantorId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Grantee"); - - b.Navigation("Grantor"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Folder", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany("Folders") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Group", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("Groups") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.GroupUser", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Group", "Group") - .WithMany("GroupUsers") - .HasForeignKey("GroupId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", "OrganizationUser") - .WithMany() - .HasForeignKey("OrganizationUserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", null) - .WithMany("GroupUsers") - .HasForeignKey("UserId"); - - b.Navigation("Group"); - - b.Navigation("OrganizationUser"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationApiKey", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("ApiKeys") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationConnection", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("Connections") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationSponsorship", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "SponsoredOrganization") - .WithMany() - .HasForeignKey("SponsoredOrganizationId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "SponsoringOrganization") - .WithMany() - .HasForeignKey("SponsoringOrganizationId"); - - b.Navigation("SponsoredOrganization"); - - b.Navigation("SponsoringOrganization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("OrganizationUsers") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany("OrganizationUsers") - .HasForeignKey("UserId"); - - b.Navigation("Organization"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Policy", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("Policies") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Project", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany() - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ProviderOrganization", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany() - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Provider", "Provider") - .WithMany() - .HasForeignKey("ProviderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - - b.Navigation("Provider"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ProviderUser", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Provider", "Provider") - .WithMany() - .HasForeignKey("ProviderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany() - .HasForeignKey("UserId"); - - b.Navigation("Provider"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Secret", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany() - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Send", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany() - .HasForeignKey("OrganizationId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany() - .HasForeignKey("UserId"); - - b.Navigation("Organization"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ServiceAccount", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany() - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.SsoConfig", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("SsoConfigs") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.SsoUser", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("SsoUsers") - .HasForeignKey("OrganizationId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany("SsoUsers") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Transaction", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") - .WithMany("Transactions") - .HasForeignKey("OrganizationId"); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User") - .WithMany("Transactions") - .HasForeignKey("UserId"); - - b.Navigation("Organization"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ProjectSecret", b => - { - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Project", null) - .WithMany() - .HasForeignKey("ProjectsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Bit.Infrastructure.EntityFramework.Models.Secret", null) - .WithMany() - .HasForeignKey("SecretsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Cipher", b => - { - b.Navigation("CollectionCiphers"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Collection", b => - { - b.Navigation("CollectionCiphers"); - - b.Navigation("CollectionGroups"); - - b.Navigation("CollectionUsers"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Group", b => - { - b.Navigation("GroupUsers"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Organization", b => - { - b.Navigation("ApiKeys"); - - b.Navigation("Ciphers"); - - b.Navigation("Connections"); - - b.Navigation("Groups"); - - b.Navigation("OrganizationUsers"); - - b.Navigation("Policies"); - - b.Navigation("SsoConfigs"); - - b.Navigation("SsoUsers"); - - b.Navigation("Transactions"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", b => - { - b.Navigation("CollectionUsers"); - }); - - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.User", b => - { - b.Navigation("Ciphers"); - - b.Navigation("CollectionUsers"); - - b.Navigation("Folders"); - - b.Navigation("GroupUsers"); - - b.Navigation("OrganizationUsers"); - - b.Navigation("SsoUsers"); - - b.Navigation("Transactions"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/util/PostgresMigrations/Migrations/20221130232731_NeverExpireApiKey.cs b/util/PostgresMigrations/Migrations/20221130232731_NeverExpireApiKey.cs deleted file mode 100644 index 9c568a80c55e..000000000000 --- a/util/PostgresMigrations/Migrations/20221130232731_NeverExpireApiKey.cs +++ /dev/null @@ -1,32 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Bit.PostgresMigrations.Migrations; - -public partial class NeverExpireApiKey : Migration -{ - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "ExpireAt", - table: "ApiKey", - type: "timestamp without time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp without time zone"); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "ExpireAt", - table: "ApiKey", - type: "timestamp without time zone", - nullable: false, - defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), - oldClrType: typeof(DateTime), - oldType: "timestamp without time zone", - oldNullable: true); - } -} diff --git a/util/PostgresMigrations/Migrations/20221202103309_SecretsManagerFlag.cs b/util/PostgresMigrations/Migrations/20221202103309_SecretsManagerFlag.cs deleted file mode 100644 index ef3746790adf..000000000000 --- a/util/PostgresMigrations/Migrations/20221202103309_SecretsManagerFlag.cs +++ /dev/null @@ -1,25 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Bit.PostgresMigrations.Migrations; - -public partial class SecretsManagerFlag : Migration -{ - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "UseSecretsManager", - table: "Organization", - type: "boolean", - nullable: false, - defaultValue: false); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "UseSecretsManager", - table: "Organization"); - } -} diff --git a/util/PostgresMigrations/Migrations/20221125155541_AccessPolicy.Designer.cs b/util/PostgresMigrations/Migrations/20230106153838_SecretsManager.Designer.cs similarity index 93% rename from util/PostgresMigrations/Migrations/20221125155541_AccessPolicy.Designer.cs rename to util/PostgresMigrations/Migrations/20230106153838_SecretsManager.Designer.cs index 98fe58305a6b..114d17325480 100644 --- a/util/PostgresMigrations/Migrations/20221125155541_AccessPolicy.Designer.cs +++ b/util/PostgresMigrations/Migrations/20230106153838_SecretsManager.Designer.cs @@ -12,15 +12,15 @@ namespace Bit.PostgresMigrations.Migrations { [DbContext(typeof(DatabaseContext))] - [Migration("20221125155541_AccessPolicy")] - partial class AccessPolicy + [Migration("20230106153838_SecretsManager")] + partial class SecretsManager { protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder .HasAnnotation("Npgsql:CollationDefinition:postgresIndetermanisticCollation", "en-u-ks-primary,en-u-ks-primary,icu,False") - .HasAnnotation("ProductVersion", "6.0.4") + .HasAnnotation("ProductVersion", "6.0.12") .HasAnnotation("Relational:MaxIdentifierLength", 63); NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); @@ -31,7 +31,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasColumnType("uuid"); b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("Discriminator") .IsRequired() @@ -41,7 +41,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasColumnType("boolean"); b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("Write") .HasColumnType("boolean"); @@ -64,14 +64,14 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasColumnType("character varying(30)"); b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("EncryptedPayload") .HasMaxLength(4000) .HasColumnType("character varying(4000)"); - b.Property("ExpireAt") - .HasColumnType("timestamp without time zone"); + b.Property("ExpireAt") + .HasColumnType("timestamp with time zone"); b.Property("Key") .HasColumnType("text"); @@ -81,7 +81,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasColumnType("character varying(200)"); b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("Scope") .HasMaxLength(4000) @@ -108,11 +108,14 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasMaxLength(25) .HasColumnType("character varying(25)"); + b.Property("Approved") + .HasColumnType("boolean"); + b.Property("AuthenticationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("Key") .HasColumnType("text"); @@ -138,7 +141,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasColumnType("character varying(50)"); b.Property("ResponseDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("ResponseDeviceId") .HasColumnType("uuid"); @@ -167,13 +170,13 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasColumnType("text"); b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("Data") .HasColumnType("text"); b.Property("DeletedDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("Favorites") .HasColumnType("text"); @@ -188,7 +191,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasColumnType("smallint"); b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("Type") .HasColumnType("smallint"); @@ -211,7 +214,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasColumnType("uuid"); b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("ExternalId") .HasMaxLength(300) @@ -224,7 +227,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasColumnType("uuid"); b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.HasKey("Id"); @@ -302,7 +305,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasColumnType("uuid"); b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("Identifier") .HasMaxLength(50) @@ -317,7 +320,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasColumnType("character varying(255)"); b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("Type") .HasColumnType("smallint"); @@ -338,7 +341,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasColumnType("uuid"); b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("Email") .HasMaxLength(256) @@ -354,13 +357,13 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasColumnType("text"); b.Property("LastNotificationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("RecoveryInitiatedDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("Status") .HasColumnType("smallint"); @@ -395,7 +398,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasColumnType("uuid"); b.Property("Date") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("DeviceType") .HasColumnType("smallint"); @@ -428,6 +431,9 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.Property("ProviderUserId") .HasColumnType("uuid"); + b.Property("SystemUser") + .HasColumnType("smallint"); + b.Property("Type") .HasColumnType("integer"); @@ -445,13 +451,13 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasColumnType("uuid"); b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("Name") .HasColumnType("text"); b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("UserId") .HasColumnType("uuid"); @@ -474,10 +480,10 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasColumnType("character varying(200)"); b.Property("ConsumedDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("Data") .HasColumnType("text"); @@ -487,7 +493,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasColumnType("character varying(200)"); b.Property("ExpirationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("SessionId") .HasMaxLength(100) @@ -515,7 +521,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasColumnType("boolean"); b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("ExternalId") .HasMaxLength(300) @@ -529,7 +535,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasColumnType("uuid"); b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.HasKey("Id"); @@ -564,7 +570,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasColumnType("uuid"); b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("Email") .HasMaxLength(256) @@ -616,13 +622,13 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasColumnType("character varying(30)"); b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("Enabled") .HasColumnType("boolean"); b.Property("ExpirationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("Gateway") .HasColumnType("smallint"); @@ -658,7 +664,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasColumnType("character varying(50)"); b.Property("OwnersNotifiedOfAutoscaling") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("Plan") .HasMaxLength(50) @@ -677,7 +683,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasColumnType("text"); b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("Seats") .HasColumnType("integer"); @@ -697,6 +703,9 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.Property("UseApi") .HasColumnType("boolean"); + b.Property("UseCustomPermissions") + .HasColumnType("boolean"); + b.Property("UseDirectory") .HasColumnType("boolean"); @@ -718,6 +727,9 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.Property("UseScim") .HasColumnType("boolean"); + b.Property("UseSecretsManager") + .HasColumnType("boolean"); + b.Property("UseSso") .HasColumnType("boolean"); @@ -745,7 +757,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasColumnType("uuid"); b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("Type") .HasColumnType("smallint"); @@ -791,7 +803,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasColumnType("character varying(256)"); b.Property("LastSyncDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("OfferedToEmail") .HasMaxLength(256) @@ -813,7 +825,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasColumnType("boolean"); b.Property("ValidUntil") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.HasKey("Id"); @@ -833,7 +845,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasColumnType("boolean"); b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("Email") .HasMaxLength(256) @@ -856,7 +868,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasColumnType("text"); b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("Status") .HasColumnType("smallint"); @@ -882,7 +894,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasColumnType("uuid"); b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("Data") .HasColumnType("text"); @@ -894,7 +906,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasColumnType("uuid"); b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("Type") .HasColumnType("smallint"); @@ -912,10 +924,10 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasColumnType("uuid"); b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("DeletedDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("Name") .HasColumnType("text"); @@ -924,7 +936,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasColumnType("uuid"); b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.HasKey("Id") .HasAnnotation("SqlServer:Clustered", true); @@ -965,7 +977,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasColumnType("text"); b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("Enabled") .HasColumnType("boolean"); @@ -974,7 +986,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasColumnType("text"); b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("Status") .HasColumnType("smallint"); @@ -993,7 +1005,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasColumnType("uuid"); b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("Key") .HasColumnType("text"); @@ -1005,7 +1017,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasColumnType("uuid"); b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("Settings") .HasColumnType("text"); @@ -1025,7 +1037,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasColumnType("uuid"); b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("Email") .HasColumnType("text"); @@ -1040,7 +1052,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasColumnType("uuid"); b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("Status") .HasColumnType("smallint"); @@ -1066,10 +1078,10 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasColumnType("uuid"); b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("DeletedDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("Key") .HasColumnType("text"); @@ -1081,7 +1093,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasColumnType("uuid"); b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("Value") .HasColumnType("text"); @@ -1107,19 +1119,19 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasColumnType("integer"); b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("Data") .HasColumnType("text"); b.Property("DeletionDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("Disabled") .HasColumnType("boolean"); b.Property("ExpirationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("HideEmail") .HasColumnType("boolean"); @@ -1138,7 +1150,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasColumnType("character varying(300)"); b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("Type") .HasColumnType("smallint"); @@ -1161,7 +1173,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasColumnType("uuid"); b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("Name") .HasColumnType("text"); @@ -1170,7 +1182,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasColumnType("uuid"); b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.HasKey("Id") .HasAnnotation("SqlServer:Clustered", true); @@ -1190,7 +1202,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("Data") .HasColumnType("text"); @@ -1202,7 +1214,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasColumnType("uuid"); b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.HasKey("Id"); @@ -1220,7 +1232,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("ExternalId") .HasMaxLength(50) @@ -1280,7 +1292,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasColumnType("numeric"); b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("Details") .HasMaxLength(100) @@ -1326,15 +1338,19 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasColumnType("uuid"); b.Property("AccountRevisionDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("ApiKey") .IsRequired() .HasMaxLength(30) .HasColumnType("character varying(30)"); + b.Property("AvatarColor") + .HasMaxLength(7) + .HasColumnType("character varying(7)"); + b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("Culture") .HasMaxLength(10) @@ -1382,7 +1398,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasColumnType("text"); b.Property("LastFailedLoginDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("LicenseKey") .HasMaxLength(100) @@ -1407,7 +1423,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasColumnType("boolean"); b.Property("PremiumExpirationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("PrivateKey") .HasColumnType("text"); @@ -1419,10 +1435,10 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasColumnType("text"); b.Property("RenewalReminderDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("SecurityStamp") .IsRequired() diff --git a/util/PostgresMigrations/Migrations/20230106153838_SecretsManager.cs b/util/PostgresMigrations/Migrations/20230106153838_SecretsManager.cs new file mode 100644 index 000000000000..49f3763b662b --- /dev/null +++ b/util/PostgresMigrations/Migrations/20230106153838_SecretsManager.cs @@ -0,0 +1,325 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Bit.PostgresMigrations.Migrations; + +public partial class SecretsManager : Migration +{ + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "UseSecretsManager", + table: "Organization", + type: "boolean", + nullable: false, + defaultValue: false); + + migrationBuilder.AlterColumn( + name: "RequestIpAddress", + table: "AuthRequest", + type: "character varying(50)", + maxLength: 50, + nullable: true, + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "RequestDeviceIdentifier", + table: "AuthRequest", + type: "character varying(50)", + maxLength: 50, + nullable: true, + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "AccessCode", + table: "AuthRequest", + type: "character varying(25)", + maxLength: 25, + nullable: true, + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.CreateTable( + name: "Project", + columns: table => new + { + Id = table.Column(type: "uuid", nullable: false), + OrganizationId = table.Column(type: "uuid", nullable: false), + Name = table.Column(type: "text", nullable: true), + CreationDate = table.Column(type: "timestamp with time zone", nullable: false), + RevisionDate = table.Column(type: "timestamp with time zone", nullable: false), + DeletedDate = table.Column(type: "timestamp with time zone", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Project", x => x.Id); + table.ForeignKey( + name: "FK_Project_Organization_OrganizationId", + column: x => x.OrganizationId, + principalTable: "Organization", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Secret", + columns: table => new + { + Id = table.Column(type: "uuid", nullable: false), + OrganizationId = table.Column(type: "uuid", nullable: false), + Key = table.Column(type: "text", nullable: true), + Value = table.Column(type: "text", nullable: true), + Note = table.Column(type: "text", nullable: true), + CreationDate = table.Column(type: "timestamp with time zone", nullable: false), + RevisionDate = table.Column(type: "timestamp with time zone", nullable: false), + DeletedDate = table.Column(type: "timestamp with time zone", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Secret", x => x.Id); + table.ForeignKey( + name: "FK_Secret_Organization_OrganizationId", + column: x => x.OrganizationId, + principalTable: "Organization", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ServiceAccount", + columns: table => new + { + Id = table.Column(type: "uuid", nullable: false), + OrganizationId = table.Column(type: "uuid", nullable: false), + Name = table.Column(type: "text", nullable: true), + CreationDate = table.Column(type: "timestamp with time zone", nullable: false), + RevisionDate = table.Column(type: "timestamp with time zone", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ServiceAccount", x => x.Id); + table.ForeignKey( + name: "FK_ServiceAccount_Organization_OrganizationId", + column: x => x.OrganizationId, + principalTable: "Organization", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ProjectSecret", + columns: table => new + { + ProjectsId = table.Column(type: "uuid", nullable: false), + SecretsId = table.Column(type: "uuid", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ProjectSecret", x => new { x.ProjectsId, x.SecretsId }); + table.ForeignKey( + name: "FK_ProjectSecret_Project_ProjectsId", + column: x => x.ProjectsId, + principalTable: "Project", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ProjectSecret_Secret_SecretsId", + column: x => x.SecretsId, + principalTable: "Secret", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "AccessPolicy", + columns: table => new + { + Id = table.Column(type: "uuid", nullable: false), + GroupId = table.Column(type: "uuid", nullable: true), + GrantedProjectId = table.Column(type: "uuid", nullable: true), + GrantedServiceAccountId = table.Column(type: "uuid", nullable: true), + ServiceAccountId = table.Column(type: "uuid", nullable: true), + OrganizationUserId = table.Column(type: "uuid", nullable: true), + Read = table.Column(type: "boolean", nullable: false), + Write = table.Column(type: "boolean", nullable: false), + CreationDate = table.Column(type: "timestamp with time zone", nullable: false), + RevisionDate = table.Column(type: "timestamp with time zone", nullable: false), + Discriminator = table.Column(type: "text", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AccessPolicy", x => x.Id); + table.ForeignKey( + name: "FK_AccessPolicy_Group_GroupId", + column: x => x.GroupId, + principalTable: "Group", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_AccessPolicy_OrganizationUser_OrganizationUserId", + column: x => x.OrganizationUserId, + principalTable: "OrganizationUser", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_AccessPolicy_Project_GrantedProjectId", + column: x => x.GrantedProjectId, + principalTable: "Project", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_AccessPolicy_ServiceAccount_GrantedServiceAccountId", + column: x => x.GrantedServiceAccountId, + principalTable: "ServiceAccount", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_AccessPolicy_ServiceAccount_ServiceAccountId", + column: x => x.ServiceAccountId, + principalTable: "ServiceAccount", + principalColumn: "Id"); + }); + + migrationBuilder.CreateTable( + name: "ApiKey", + columns: table => new + { + Id = table.Column(type: "uuid", nullable: false), + ServiceAccountId = table.Column(type: "uuid", nullable: true), + Name = table.Column(type: "character varying(200)", maxLength: 200, nullable: true), + ClientSecret = table.Column(type: "character varying(30)", maxLength: 30, nullable: true), + Scope = table.Column(type: "character varying(4000)", maxLength: 4000, nullable: true), + EncryptedPayload = table.Column(type: "character varying(4000)", maxLength: 4000, nullable: true), + Key = table.Column(type: "text", nullable: true), + ExpireAt = table.Column(type: "timestamp with time zone", nullable: true), + CreationDate = table.Column(type: "timestamp with time zone", nullable: false), + RevisionDate = table.Column(type: "timestamp with time zone", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ApiKey", x => x.Id); + table.ForeignKey( + name: "FK_ApiKey_ServiceAccount_ServiceAccountId", + column: x => x.ServiceAccountId, + principalTable: "ServiceAccount", + principalColumn: "Id"); + }); + + migrationBuilder.CreateIndex( + name: "IX_AccessPolicy_GrantedProjectId", + table: "AccessPolicy", + column: "GrantedProjectId"); + + migrationBuilder.CreateIndex( + name: "IX_AccessPolicy_GrantedServiceAccountId", + table: "AccessPolicy", + column: "GrantedServiceAccountId"); + + migrationBuilder.CreateIndex( + name: "IX_AccessPolicy_GroupId", + table: "AccessPolicy", + column: "GroupId"); + + migrationBuilder.CreateIndex( + name: "IX_AccessPolicy_OrganizationUserId", + table: "AccessPolicy", + column: "OrganizationUserId"); + + migrationBuilder.CreateIndex( + name: "IX_AccessPolicy_ServiceAccountId", + table: "AccessPolicy", + column: "ServiceAccountId"); + + migrationBuilder.CreateIndex( + name: "IX_ApiKey_ServiceAccountId", + table: "ApiKey", + column: "ServiceAccountId"); + + migrationBuilder.CreateIndex( + name: "IX_Project_DeletedDate", + table: "Project", + column: "DeletedDate"); + + migrationBuilder.CreateIndex( + name: "IX_Project_OrganizationId", + table: "Project", + column: "OrganizationId"); + + migrationBuilder.CreateIndex( + name: "IX_ProjectSecret_SecretsId", + table: "ProjectSecret", + column: "SecretsId"); + + migrationBuilder.CreateIndex( + name: "IX_Secret_DeletedDate", + table: "Secret", + column: "DeletedDate"); + + migrationBuilder.CreateIndex( + name: "IX_Secret_OrganizationId", + table: "Secret", + column: "OrganizationId"); + + migrationBuilder.CreateIndex( + name: "IX_ServiceAccount_OrganizationId", + table: "ServiceAccount", + column: "OrganizationId"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "AccessPolicy"); + + migrationBuilder.DropTable( + name: "ApiKey"); + + migrationBuilder.DropTable( + name: "ProjectSecret"); + + migrationBuilder.DropTable( + name: "ServiceAccount"); + + migrationBuilder.DropTable( + name: "Project"); + + migrationBuilder.DropTable( + name: "Secret"); + + migrationBuilder.DropColumn( + name: "UseSecretsManager", + table: "Organization"); + + migrationBuilder.AlterColumn( + name: "RequestIpAddress", + table: "AuthRequest", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "character varying(50)", + oldMaxLength: 50, + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "RequestDeviceIdentifier", + table: "AuthRequest", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "character varying(50)", + oldMaxLength: 50, + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "AccessCode", + table: "AuthRequest", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "character varying(25)", + oldMaxLength: 25, + oldNullable: true); + } +} diff --git a/util/PostgresMigrations/Migrations/DatabaseContextModelSnapshot.cs b/util/PostgresMigrations/Migrations/DatabaseContextModelSnapshot.cs index bc965c3710f2..dbfde000da3f 100644 --- a/util/PostgresMigrations/Migrations/DatabaseContextModelSnapshot.cs +++ b/util/PostgresMigrations/Migrations/DatabaseContextModelSnapshot.cs @@ -18,7 +18,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) #pragma warning disable 612, 618 modelBuilder .HasAnnotation("Npgsql:CollationDefinition:postgresIndetermanisticCollation", "en-u-ks-primary,en-u-ks-primary,icu,False") - .HasAnnotation("ProductVersion", "6.0.4") + .HasAnnotation("ProductVersion", "6.0.12") .HasAnnotation("Relational:MaxIdentifierLength", 63); NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); @@ -29,7 +29,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("uuid"); b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("Discriminator") .IsRequired() @@ -39,7 +39,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("boolean"); b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("Write") .HasColumnType("boolean"); @@ -62,14 +62,14 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("character varying(30)"); b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("EncryptedPayload") .HasMaxLength(4000) .HasColumnType("character varying(4000)"); b.Property("ExpireAt") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("Key") .HasColumnType("text"); @@ -79,7 +79,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("character varying(200)"); b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("Scope") .HasMaxLength(4000) @@ -103,16 +103,17 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("uuid"); b.Property("AccessCode") - .HasColumnType("text"); - + .HasMaxLength(25) + .HasColumnType("character varying(25)"); + b.Property("Approved") .HasColumnType("boolean"); b.Property("AuthenticationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("Key") .HasColumnType("text"); @@ -138,7 +139,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("character varying(50)"); b.Property("ResponseDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("ResponseDeviceId") .HasColumnType("uuid"); @@ -167,13 +168,13 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("text"); b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("Data") .HasColumnType("text"); b.Property("DeletedDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("Favorites") .HasColumnType("text"); @@ -188,7 +189,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("smallint"); b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("Type") .HasColumnType("smallint"); @@ -211,7 +212,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("uuid"); b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("ExternalId") .HasMaxLength(300) @@ -224,7 +225,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("uuid"); b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.HasKey("Id"); @@ -266,7 +267,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("GroupId"); - b.ToTable("CollectionGroups", (string)null); + b.ToTable("CollectionGroups"); }); modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionUser", b => @@ -292,7 +293,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("UserId"); - b.ToTable("CollectionUsers", (string)null); + b.ToTable("CollectionUsers"); }); modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Device", b => @@ -302,7 +303,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("uuid"); b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("Identifier") .HasMaxLength(50) @@ -317,7 +318,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("character varying(255)"); b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("Type") .HasColumnType("smallint"); @@ -338,7 +339,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("uuid"); b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("Email") .HasMaxLength(256) @@ -354,13 +355,13 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("text"); b.Property("LastNotificationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("RecoveryInitiatedDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("Status") .HasColumnType("smallint"); @@ -395,7 +396,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("uuid"); b.Property("Date") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("DeviceType") .HasColumnType("smallint"); @@ -448,13 +449,13 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("uuid"); b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("Name") .HasColumnType("text"); b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("UserId") .HasColumnType("uuid"); @@ -477,10 +478,10 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("character varying(200)"); b.Property("ConsumedDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("Data") .HasColumnType("text"); @@ -490,7 +491,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("character varying(200)"); b.Property("ExpirationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("SessionId") .HasMaxLength(100) @@ -518,7 +519,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("boolean"); b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("ExternalId") .HasMaxLength(300) @@ -532,7 +533,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("uuid"); b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.HasKey("Id"); @@ -567,7 +568,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("uuid"); b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("Email") .HasMaxLength(256) @@ -619,13 +620,13 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("character varying(30)"); b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("Enabled") .HasColumnType("boolean"); b.Property("ExpirationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("Gateway") .HasColumnType("smallint"); @@ -661,7 +662,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("character varying(50)"); b.Property("OwnersNotifiedOfAutoscaling") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("Plan") .HasMaxLength(50) @@ -680,7 +681,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("text"); b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("Seats") .HasColumnType("integer"); @@ -754,7 +755,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("uuid"); b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("Type") .HasColumnType("smallint"); @@ -800,7 +801,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("character varying(256)"); b.Property("LastSyncDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("OfferedToEmail") .HasMaxLength(256) @@ -822,7 +823,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("boolean"); b.Property("ValidUntil") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.HasKey("Id"); @@ -842,7 +843,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("boolean"); b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("Email") .HasMaxLength(256) @@ -865,7 +866,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("text"); b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("Status") .HasColumnType("smallint"); @@ -891,7 +892,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("uuid"); b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("Data") .HasColumnType("text"); @@ -903,7 +904,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("uuid"); b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("Type") .HasColumnType("smallint"); @@ -921,10 +922,10 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("uuid"); b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("DeletedDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("Name") .HasColumnType("text"); @@ -933,7 +934,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("uuid"); b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.HasKey("Id") .HasAnnotation("SqlServer:Clustered", true); @@ -974,7 +975,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("text"); b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("Enabled") .HasColumnType("boolean"); @@ -983,7 +984,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("text"); b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("Status") .HasColumnType("smallint"); @@ -1002,7 +1003,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("uuid"); b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("Key") .HasColumnType("text"); @@ -1014,7 +1015,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("uuid"); b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("Settings") .HasColumnType("text"); @@ -1034,7 +1035,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("uuid"); b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("Email") .HasColumnType("text"); @@ -1049,7 +1050,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("uuid"); b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("Status") .HasColumnType("smallint"); @@ -1075,10 +1076,10 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("uuid"); b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("DeletedDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("Key") .HasColumnType("text"); @@ -1090,7 +1091,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("uuid"); b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("Value") .HasColumnType("text"); @@ -1116,19 +1117,19 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("integer"); b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("Data") .HasColumnType("text"); b.Property("DeletionDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("Disabled") .HasColumnType("boolean"); b.Property("ExpirationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("HideEmail") .HasColumnType("boolean"); @@ -1147,7 +1148,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("character varying(300)"); b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("Type") .HasColumnType("smallint"); @@ -1170,7 +1171,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("uuid"); b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("Name") .HasColumnType("text"); @@ -1179,7 +1180,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("uuid"); b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.HasKey("Id") .HasAnnotation("SqlServer:Clustered", true); @@ -1199,7 +1200,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("Data") .HasColumnType("text"); @@ -1211,7 +1212,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("uuid"); b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.HasKey("Id"); @@ -1229,7 +1230,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("ExternalId") .HasMaxLength(50) @@ -1289,7 +1290,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("numeric"); b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("Details") .HasMaxLength(100) @@ -1335,7 +1336,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("uuid"); b.Property("AccountRevisionDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("ApiKey") .IsRequired() @@ -1347,7 +1348,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("character varying(7)"); b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("Culture") .HasMaxLength(10) @@ -1395,7 +1396,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("text"); b.Property("LastFailedLoginDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("LicenseKey") .HasMaxLength(100) @@ -1420,7 +1421,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("boolean"); b.Property("PremiumExpirationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("PrivateKey") .HasColumnType("text"); @@ -1432,10 +1433,10 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("text"); b.Property("RenewalReminderDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("SecurityStamp") .IsRequired() diff --git a/util/PostgresMigrations/Scripts/2022-07-20_00_CreateSecretTable.psql b/util/PostgresMigrations/Scripts/2022-07-20_00_CreateSecretTable.psql deleted file mode 100644 index 39e2b62793d5..000000000000 --- a/util/PostgresMigrations/Scripts/2022-07-20_00_CreateSecretTable.psql +++ /dev/null @@ -1,23 +0,0 @@ -START TRANSACTION; - -CREATE TABLE "Secret" ( - "Id" uuid NOT NULL, - "OrganizationId" uuid NOT NULL, - "Key" text NULL, - "Value" text NULL, - "Note" text NULL, - "CreationDate" timestamp without time zone NOT NULL, - "RevisionDate" timestamp without time zone NOT NULL, - "DeletedDate" timestamp without time zone NULL, - CONSTRAINT "PK_Secret" PRIMARY KEY ("Id"), - CONSTRAINT "FK_Secret_Organization_OrganizationId" FOREIGN KEY ("OrganizationId") REFERENCES "Organization" ("Id") ON DELETE CASCADE -); - -CREATE INDEX "IX_Secret_DeletedDate" ON "Secret" ("DeletedDate"); - -CREATE INDEX "IX_Secret_OrganizationId" ON "Secret" ("OrganizationId"); - -INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion") -VALUES ('20220720222109_CreateSecretTable', '6.0.4'); - -COMMIT; \ No newline at end of file diff --git a/util/PostgresMigrations/Scripts/2022-08-18_00_CreateProjectTable.psql b/util/PostgresMigrations/Scripts/2022-08-18_00_CreateProjectTable.psql deleted file mode 100644 index b60787d015eb..000000000000 --- a/util/PostgresMigrations/Scripts/2022-08-18_00_CreateProjectTable.psql +++ /dev/null @@ -1,21 +0,0 @@ -START TRANSACTION; - -CREATE TABLE "Project" ( - "Id" uuid NOT NULL, - "OrganizationId" uuid NOT NULL, - "Name" text NULL, - "CreationDate" timestamp without time zone NOT NULL, - "RevisionDate" timestamp without time zone NOT NULL, - "DeletedDate" timestamp without time zone NULL, - CONSTRAINT "PK_Project" PRIMARY KEY ("Id"), - CONSTRAINT "FK_Project_Organization_OrganizationId" FOREIGN KEY ("OrganizationId") REFERENCES "Organization" ("Id") ON DELETE CASCADE -); - -CREATE INDEX "IX_Project_DeletedDate" ON "Project" ("DeletedDate"); - -CREATE INDEX "IX_Project_OrganizationId" ON "Project" ("OrganizationId"); - -INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion") -VALUES ('20220830185238_CreateProjectTable', '6.0.4'); - -COMMIT; diff --git a/util/PostgresMigrations/Scripts/2022-09-26_00_SmServiceAccount.psql b/util/PostgresMigrations/Scripts/2022-09-26_00_SmServiceAccount.psql deleted file mode 100644 index 682c581b55d4..000000000000 --- a/util/PostgresMigrations/Scripts/2022-09-26_00_SmServiceAccount.psql +++ /dev/null @@ -1,18 +0,0 @@ -START TRANSACTION; - -CREATE TABLE "ServiceAccount" ( - "Id" uuid NOT NULL, - "OrganizationId" uuid NOT NULL, - "Name" text NULL, - "CreationDate" timestamp without time zone NOT NULL, - "RevisionDate" timestamp without time zone NOT NULL, - CONSTRAINT "PK_ServiceAccount" PRIMARY KEY ("Id"), - CONSTRAINT "FK_ServiceAccount_Organization_OrganizationId" FOREIGN KEY ("OrganizationId") REFERENCES "Organization" ("Id") ON DELETE CASCADE -); - -CREATE INDEX "IX_ServiceAccount_OrganizationId" ON "ServiceAccount" ("OrganizationId"); - -INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion") -VALUES ('20220926190851_SmServiceAccount', '6.0.4'); - -COMMIT; diff --git a/util/PostgresMigrations/Scripts/2022-09-27_00_ApiKey.psql b/util/PostgresMigrations/Scripts/2022-09-27_00_ApiKey.psql deleted file mode 100644 index aa858791dece..000000000000 --- a/util/PostgresMigrations/Scripts/2022-09-27_00_ApiKey.psql +++ /dev/null @@ -1,35 +0,0 @@ -START TRANSACTION; - -ALTER TABLE "AuthRequest" ALTER COLUMN "ResponseDate" TYPE timestamp without time zone; - -ALTER TABLE "AuthRequest" ALTER COLUMN "RequestIpAddress" TYPE character varying(50); - -ALTER TABLE "AuthRequest" ALTER COLUMN "RequestDeviceIdentifier" TYPE character varying(50); - -ALTER TABLE "AuthRequest" ALTER COLUMN "CreationDate" TYPE timestamp without time zone; - -ALTER TABLE "AuthRequest" ALTER COLUMN "AuthenticationDate" TYPE timestamp without time zone; - -ALTER TABLE "AuthRequest" ALTER COLUMN "AccessCode" TYPE character varying(25); - -CREATE TABLE "ApiKey" ( - "Id" uuid NOT NULL, - "ServiceAccountId" uuid NULL, - "Name" character varying(200) NULL, - "ClientSecret" character varying(30) NULL, - "Scope" character varying(4000) NULL, - "EncryptedPayload" character varying(4000) NULL, - "Key" text NULL, - "ExpireAt" timestamp without time zone NOT NULL, - "CreationDate" timestamp without time zone NOT NULL, - "RevisionDate" timestamp without time zone NOT NULL, - CONSTRAINT "PK_ApiKey" PRIMARY KEY ("Id"), - CONSTRAINT "FK_ApiKey_ServiceAccount_ServiceAccountId" FOREIGN KEY ("ServiceAccountId") REFERENCES "ServiceAccount" ("Id") -); - -CREATE INDEX "IX_ApiKey_ServiceAccountId" ON "ApiKey" ("ServiceAccountId"); - -INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion") -VALUES ('20221010151608_ApiKey', '6.0.4'); - -COMMIT; diff --git a/util/PostgresMigrations/Scripts/2022-10-18_00_ProjectSecret.psql b/util/PostgresMigrations/Scripts/2022-10-18_00_ProjectSecret.psql deleted file mode 100644 index 76a1777e7030..000000000000 --- a/util/PostgresMigrations/Scripts/2022-10-18_00_ProjectSecret.psql +++ /dev/null @@ -1,16 +0,0 @@ -START TRANSACTION; - -CREATE TABLE "ProjectSecret" ( - "ProjectsId" uuid NOT NULL, - "SecretsId" uuid NOT NULL, - CONSTRAINT "PK_ProjectSecret" PRIMARY KEY ("ProjectsId", "SecretsId"), - CONSTRAINT "FK_ProjectSecret_Project_ProjectsId" FOREIGN KEY ("ProjectsId") REFERENCES "Project" ("Id") ON DELETE CASCADE, - CONSTRAINT "FK_ProjectSecret_Secret_SecretsId" FOREIGN KEY ("SecretsId") REFERENCES "Secret" ("Id") ON DELETE CASCADE -); - -CREATE INDEX "IX_ProjectSecret_SecretsId" ON "ProjectSecret" ("SecretsId"); - -INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion") -VALUES ('20221018155821_ProjectSecret', '6.0.4'); - -COMMIT; diff --git a/util/PostgresMigrations/Scripts/2022-11-25_00_AccessPolicy.sql b/util/PostgresMigrations/Scripts/2022-11-25_00_AccessPolicy.sql deleted file mode 100644 index 8713695d5167..000000000000 --- a/util/PostgresMigrations/Scripts/2022-11-25_00_AccessPolicy.sql +++ /dev/null @@ -1,36 +0,0 @@ -START TRANSACTION; - -CREATE TABLE "AccessPolicy" ( - "Id" uuid NOT NULL, - "GroupId" uuid NULL, - "GrantedProjectId" uuid NULL, - "GrantedServiceAccountId" uuid NULL, - "ServiceAccountId" uuid NULL, - "OrganizationUserId" uuid NULL, - "Read" boolean NOT NULL, - "Write" boolean NOT NULL, - "CreationDate" timestamp without time zone NOT NULL, - "RevisionDate" timestamp without time zone NOT NULL, - "Discriminator" text NOT NULL, - CONSTRAINT "PK_AccessPolicy" PRIMARY KEY ("Id"), - CONSTRAINT "FK_AccessPolicy_Group_GroupId" FOREIGN KEY ("GroupId") REFERENCES "Group" ("Id"), - CONSTRAINT "FK_AccessPolicy_OrganizationUser_OrganizationUserId" FOREIGN KEY ("OrganizationUserId") REFERENCES "OrganizationUser" ("Id"), - CONSTRAINT "FK_AccessPolicy_Project_GrantedProjectId" FOREIGN KEY ("GrantedProjectId") REFERENCES "Project" ("Id"), - CONSTRAINT "FK_AccessPolicy_ServiceAccount_GrantedServiceAccountId" FOREIGN KEY ("GrantedServiceAccountId") REFERENCES "ServiceAccount" ("Id"), - CONSTRAINT "FK_AccessPolicy_ServiceAccount_ServiceAccountId" FOREIGN KEY ("ServiceAccountId") REFERENCES "ServiceAccount" ("Id") -); - -CREATE INDEX "IX_AccessPolicy_GrantedProjectId" ON "AccessPolicy" ("GrantedProjectId"); - -CREATE INDEX "IX_AccessPolicy_GrantedServiceAccountId" ON "AccessPolicy" ("GrantedServiceAccountId"); - -CREATE INDEX "IX_AccessPolicy_GroupId" ON "AccessPolicy" ("GroupId"); - -CREATE INDEX "IX_AccessPolicy_OrganizationUserId" ON "AccessPolicy" ("OrganizationUserId"); - -CREATE INDEX "IX_AccessPolicy_ServiceAccountId" ON "AccessPolicy" ("ServiceAccountId"); - -INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion") -VALUES ('20221125155541_AccessPolicy', '6.0.4'); - -COMMIT; diff --git a/util/PostgresMigrations/Scripts/2022-11-30_00_NeverExpireApiKey.psql b/util/PostgresMigrations/Scripts/2022-11-30_00_NeverExpireApiKey.psql deleted file mode 100644 index 7230cb9418dc..000000000000 --- a/util/PostgresMigrations/Scripts/2022-11-30_00_NeverExpireApiKey.psql +++ /dev/null @@ -1,8 +0,0 @@ -START TRANSACTION; - -ALTER TABLE "ApiKey" ALTER COLUMN "ExpireAt" DROP NOT NULL; - -INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion") -VALUES ('20221130232731_NeverExpireApiKey', '6.0.4'); - -COMMIT; diff --git a/util/PostgresMigrations/Scripts/2022-12-02_00_SecretsManagerFlag.psql b/util/PostgresMigrations/Scripts/2022-12-02_00_SecretsManagerFlag.psql deleted file mode 100644 index e2c3b5f6afeb..000000000000 --- a/util/PostgresMigrations/Scripts/2022-12-02_00_SecretsManagerFlag.psql +++ /dev/null @@ -1,8 +0,0 @@ -START TRANSACTION; - -ALTER TABLE "Organization" ADD "UseSecretsManager" boolean NOT NULL DEFAULT FALSE; - -INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion") -VALUES ('20221202103309_SecretsManagerFlag', '6.0.4'); - -COMMIT; diff --git a/util/PostgresMigrations/Scripts/2023-01-06_00_SecretsManager.psql b/util/PostgresMigrations/Scripts/2023-01-06_00_SecretsManager.psql new file mode 100644 index 000000000000..bb87a7560e89 --- /dev/null +++ b/util/PostgresMigrations/Scripts/2023-01-06_00_SecretsManager.psql @@ -0,0 +1,115 @@ +START TRANSACTION; + +ALTER TABLE "Organization" ADD "UseSecretsManager" boolean NOT NULL DEFAULT FALSE; + +ALTER TABLE "AuthRequest" ALTER COLUMN "RequestIpAddress" TYPE character varying(50); + +ALTER TABLE "AuthRequest" ALTER COLUMN "RequestDeviceIdentifier" TYPE character varying(50); + +ALTER TABLE "AuthRequest" ALTER COLUMN "AccessCode" TYPE character varying(25); + +CREATE TABLE "Project" ( + "Id" uuid NOT NULL, + "OrganizationId" uuid NOT NULL, + "Name" text NULL, + "CreationDate" timestamp with time zone NOT NULL, + "RevisionDate" timestamp with time zone NOT NULL, + "DeletedDate" timestamp with time zone NULL, + CONSTRAINT "PK_Project" PRIMARY KEY ("Id"), + CONSTRAINT "FK_Project_Organization_OrganizationId" FOREIGN KEY ("OrganizationId") REFERENCES "Organization" ("Id") ON DELETE CASCADE +); + +CREATE TABLE "Secret" ( + "Id" uuid NOT NULL, + "OrganizationId" uuid NOT NULL, + "Key" text NULL, + "Value" text NULL, + "Note" text NULL, + "CreationDate" timestamp with time zone NOT NULL, + "RevisionDate" timestamp with time zone NOT NULL, + "DeletedDate" timestamp with time zone NULL, + CONSTRAINT "PK_Secret" PRIMARY KEY ("Id"), + CONSTRAINT "FK_Secret_Organization_OrganizationId" FOREIGN KEY ("OrganizationId") REFERENCES "Organization" ("Id") ON DELETE CASCADE +); + +CREATE TABLE "ServiceAccount" ( + "Id" uuid NOT NULL, + "OrganizationId" uuid NOT NULL, + "Name" text NULL, + "CreationDate" timestamp with time zone NOT NULL, + "RevisionDate" timestamp with time zone NOT NULL, + CONSTRAINT "PK_ServiceAccount" PRIMARY KEY ("Id"), + CONSTRAINT "FK_ServiceAccount_Organization_OrganizationId" FOREIGN KEY ("OrganizationId") REFERENCES "Organization" ("Id") ON DELETE CASCADE +); + +CREATE TABLE "ProjectSecret" ( + "ProjectsId" uuid NOT NULL, + "SecretsId" uuid NOT NULL, + CONSTRAINT "PK_ProjectSecret" PRIMARY KEY ("ProjectsId", "SecretsId"), + CONSTRAINT "FK_ProjectSecret_Project_ProjectsId" FOREIGN KEY ("ProjectsId") REFERENCES "Project" ("Id") ON DELETE CASCADE, +CONSTRAINT "FK_ProjectSecret_Secret_SecretsId" FOREIGN KEY ("SecretsId") REFERENCES "Secret" ("Id") ON DELETE CASCADE +); + +CREATE TABLE "AccessPolicy" ( + "Id" uuid NOT NULL, + "GroupId" uuid NULL, + "GrantedProjectId" uuid NULL, + "GrantedServiceAccountId" uuid NULL, + "ServiceAccountId" uuid NULL, + "OrganizationUserId" uuid NULL, + "Read" boolean NOT NULL, + "Write" boolean NOT NULL, + "CreationDate" timestamp with time zone NOT NULL, + "RevisionDate" timestamp with time zone NOT NULL, + "Discriminator" text NOT NULL, + CONSTRAINT "PK_AccessPolicy" PRIMARY KEY ("Id"), + CONSTRAINT "FK_AccessPolicy_Group_GroupId" FOREIGN KEY ("GroupId") REFERENCES "Group" ("Id"), + CONSTRAINT "FK_AccessPolicy_OrganizationUser_OrganizationUserId" FOREIGN KEY ("OrganizationUserId") REFERENCES "OrganizationUser" ("Id"), + CONSTRAINT "FK_AccessPolicy_Project_GrantedProjectId" FOREIGN KEY ("GrantedProjectId") REFERENCES "Project" ("Id"), + CONSTRAINT "FK_AccessPolicy_ServiceAccount_GrantedServiceAccountId" FOREIGN KEY ("GrantedServiceAccountId") REFERENCES "ServiceAccount" ("Id"), + CONSTRAINT "FK_AccessPolicy_ServiceAccount_ServiceAccountId" FOREIGN KEY ("ServiceAccountId") REFERENCES "ServiceAccount" ("Id") +); + +CREATE TABLE "ApiKey" ( + "Id" uuid NOT NULL, + "ServiceAccountId" uuid NULL, + "Name" character varying(200) NULL, + "ClientSecret" character varying(30) NULL, + "Scope" character varying(4000) NULL, + "EncryptedPayload" character varying(4000) NULL, + "Key" text NULL, + "ExpireAt" timestamp with time zone NULL, + "CreationDate" timestamp with time zone NOT NULL, + "RevisionDate" timestamp with time zone NOT NULL, + CONSTRAINT "PK_ApiKey" PRIMARY KEY ("Id"), + CONSTRAINT "FK_ApiKey_ServiceAccount_ServiceAccountId" FOREIGN KEY ("ServiceAccountId") REFERENCES "ServiceAccount" ("Id") +); + +CREATE INDEX "IX_AccessPolicy_GrantedProjectId" ON "AccessPolicy" ("GrantedProjectId"); + +CREATE INDEX "IX_AccessPolicy_GrantedServiceAccountId" ON "AccessPolicy" ("GrantedServiceAccountId"); + +CREATE INDEX "IX_AccessPolicy_GroupId" ON "AccessPolicy" ("GroupId"); + +CREATE INDEX "IX_AccessPolicy_OrganizationUserId" ON "AccessPolicy" ("OrganizationUserId"); + +CREATE INDEX "IX_AccessPolicy_ServiceAccountId" ON "AccessPolicy" ("ServiceAccountId"); + +CREATE INDEX "IX_ApiKey_ServiceAccountId" ON "ApiKey" ("ServiceAccountId"); + +CREATE INDEX "IX_Project_DeletedDate" ON "Project" ("DeletedDate"); + +CREATE INDEX "IX_Project_OrganizationId" ON "Project" ("OrganizationId"); + +CREATE INDEX "IX_ProjectSecret_SecretsId" ON "ProjectSecret" ("SecretsId"); + +CREATE INDEX "IX_Secret_DeletedDate" ON "Secret" ("DeletedDate"); + +CREATE INDEX "IX_Secret_OrganizationId" ON "Secret" ("OrganizationId"); + +CREATE INDEX "IX_ServiceAccount_OrganizationId" ON "ServiceAccount" ("OrganizationId"); + +INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion") +VALUES ('20230106153838_SecretsManager', '6.0.12'); + +COMMIT; diff --git a/util/PostgresMigrations/Migrations/20221202103309_SecretsManagerFlag.Designer.cs b/util/SqliteMigrations/Migrations/20230106153919_SecretsManager.Designer.cs similarity index 65% rename from util/PostgresMigrations/Migrations/20221202103309_SecretsManagerFlag.Designer.cs rename to util/SqliteMigrations/Migrations/20230106153919_SecretsManager.Designer.cs index 8a0795f8c037..f7b4637ad32a 100644 --- a/util/PostgresMigrations/Migrations/20221202103309_SecretsManagerFlag.Designer.cs +++ b/util/SqliteMigrations/Migrations/20230106153919_SecretsManager.Designer.cs @@ -5,61 +5,84 @@ using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable -namespace Bit.PostgresMigrations.Migrations +namespace Bit.SqliteMigrations.Migrations { [DbContext(typeof(DatabaseContext))] - [Migration("20221202103309_SecretsManagerFlag")] - partial class SecretsManagerFlag + [Migration("20230106153919_SecretsManager")] + partial class SecretsManager { protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("Npgsql:CollationDefinition:postgresIndetermanisticCollation", "en-u-ks-primary,en-u-ks-primary,icu,False") - .HasAnnotation("ProductVersion", "6.0.4") - .HasAnnotation("Relational:MaxIdentifierLength", 63); + modelBuilder.HasAnnotation("ProductVersion", "6.0.12"); - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.AccessPolicy", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("CreationDate") + .HasColumnType("TEXT"); + + b.Property("Discriminator") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Read") + .HasColumnType("INTEGER"); + + b.Property("RevisionDate") + .HasColumnType("TEXT"); + + b.Property("Write") + .HasColumnType("INTEGER"); + + b.HasKey("Id") + .HasAnnotation("SqlServer:Clustered", true); + + b.ToTable("AccessPolicy", (string)null); + + b.HasDiscriminator("Discriminator").HasValue("AccessPolicy"); + }); modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ApiKey", b => { b.Property("Id") - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.Property("ClientSecret") .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("TEXT"); b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("TEXT"); b.Property("EncryptedPayload") .HasMaxLength(4000) - .HasColumnType("character varying(4000)"); + .HasColumnType("TEXT"); - b.Property("ExpireAt") - .HasColumnType("timestamp without time zone"); + b.Property("ExpireAt") + .HasColumnType("TEXT"); b.Property("Key") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("Name") .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("TEXT"); b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("TEXT"); b.Property("Scope") .HasMaxLength(4000) - .HasColumnType("character varying(4000)"); + .HasColumnType("TEXT"); b.Property("ServiceAccountId") - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.HasKey("Id") .HasAnnotation("SqlServer:Clustered", true); @@ -73,52 +96,55 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.AuthRequest", b => { b.Property("Id") - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.Property("AccessCode") .HasMaxLength(25) - .HasColumnType("character varying(25)"); + .HasColumnType("TEXT"); + + b.Property("Approved") + .HasColumnType("INTEGER"); b.Property("AuthenticationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("TEXT"); b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("TEXT"); b.Property("Key") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("MasterPasswordHash") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("PublicKey") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("RequestDeviceIdentifier") .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("TEXT"); b.Property("RequestDeviceType") - .HasColumnType("smallint"); + .HasColumnType("INTEGER"); b.Property("RequestFingerprint") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("RequestIpAddress") .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("TEXT"); b.Property("ResponseDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("TEXT"); b.Property("ResponseDeviceId") - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.Property("Type") - .HasColumnType("smallint"); + .HasColumnType("INTEGER"); b.Property("UserId") - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.HasKey("Id"); @@ -132,40 +158,40 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Cipher", b => { b.Property("Id") - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.Property("Attachments") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("TEXT"); b.Property("Data") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("DeletedDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("TEXT"); b.Property("Favorites") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("Folders") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("OrganizationId") - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.Property("Reprompt") - .HasColumnType("smallint"); + .HasColumnType("INTEGER"); b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("TEXT"); b.Property("Type") - .HasColumnType("smallint"); + .HasColumnType("INTEGER"); b.Property("UserId") - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.HasKey("Id"); @@ -179,23 +205,23 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Collection", b => { b.Property("Id") - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("TEXT"); b.Property("ExternalId") .HasMaxLength(300) - .HasColumnType("character varying(300)"); + .HasColumnType("TEXT"); b.Property("Name") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("OrganizationId") - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("TEXT"); b.HasKey("Id"); @@ -207,10 +233,10 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionCipher", b => { b.Property("CollectionId") - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.Property("CipherId") - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.HasKey("CollectionId", "CipherId"); @@ -222,16 +248,16 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionGroup", b => { b.Property("CollectionId") - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.Property("GroupId") - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.Property("HidePasswords") - .HasColumnType("boolean"); + .HasColumnType("INTEGER"); b.Property("ReadOnly") - .HasColumnType("boolean"); + .HasColumnType("INTEGER"); b.HasKey("CollectionId", "GroupId"); @@ -243,19 +269,19 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionUser", b => { b.Property("CollectionId") - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.Property("OrganizationUserId") - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.Property("HidePasswords") - .HasColumnType("boolean"); + .HasColumnType("INTEGER"); b.Property("ReadOnly") - .HasColumnType("boolean"); + .HasColumnType("INTEGER"); b.Property("UserId") - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.HasKey("CollectionId", "OrganizationUserId"); @@ -270,31 +296,31 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("TEXT"); b.Property("Identifier") .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("TEXT"); b.Property("Name") .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("TEXT"); b.Property("PushToken") .HasMaxLength(255) - .HasColumnType("character varying(255)"); + .HasColumnType("TEXT"); b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("TEXT"); b.Property("Type") - .HasColumnType("smallint"); + .HasColumnType("INTEGER"); b.Property("UserId") - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.HasKey("Id"); @@ -306,41 +332,41 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.EmergencyAccess", b => { b.Property("Id") - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("TEXT"); b.Property("Email") .HasMaxLength(256) - .HasColumnType("character varying(256)"); + .HasColumnType("TEXT"); b.Property("GranteeId") - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.Property("GrantorId") - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.Property("KeyEncrypted") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("LastNotificationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("TEXT"); b.Property("RecoveryInitiatedDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("TEXT"); b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("TEXT"); b.Property("Status") - .HasColumnType("smallint"); + .HasColumnType("INTEGER"); b.Property("Type") - .HasColumnType("smallint"); + .HasColumnType("INTEGER"); b.Property("WaitTimeDays") - .HasColumnType("integer"); + .HasColumnType("INTEGER"); b.HasKey("Id"); @@ -354,56 +380,59 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Event", b => { b.Property("Id") - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.Property("ActingUserId") - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.Property("CipherId") - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.Property("CollectionId") - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.Property("Date") - .HasColumnType("timestamp without time zone"); + .HasColumnType("TEXT"); b.Property("DeviceType") - .HasColumnType("smallint"); + .HasColumnType("INTEGER"); b.Property("GroupId") - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.Property("InstallationId") - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.Property("IpAddress") .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("TEXT"); b.Property("OrganizationId") - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.Property("OrganizationUserId") - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.Property("PolicyId") - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.Property("ProviderId") - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.Property("ProviderOrganizationId") - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.Property("ProviderUserId") - .HasColumnType("uuid"); + .HasColumnType("TEXT"); + + b.Property("SystemUser") + .HasColumnType("INTEGER"); b.Property("Type") - .HasColumnType("integer"); + .HasColumnType("INTEGER"); b.Property("UserId") - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.HasKey("Id"); @@ -413,19 +442,19 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Folder", b => { b.Property("Id") - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("TEXT"); b.Property("Name") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("TEXT"); b.Property("UserId") - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.HasKey("Id"); @@ -438,39 +467,39 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) { b.Property("Key") .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("TEXT"); b.Property("ClientId") .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("TEXT"); b.Property("ConsumedDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("TEXT"); b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("TEXT"); b.Property("Data") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("Description") .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("TEXT"); b.Property("ExpirationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("TEXT"); b.Property("SessionId") .HasMaxLength(100) - .HasColumnType("character varying(100)"); + .HasColumnType("TEXT"); b.Property("SubjectId") .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("TEXT"); b.Property("Type") .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("TEXT"); b.HasKey("Key"); @@ -480,27 +509,27 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Group", b => { b.Property("Id") - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.Property("AccessAll") - .HasColumnType("boolean"); + .HasColumnType("INTEGER"); b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("TEXT"); b.Property("ExternalId") .HasMaxLength(300) - .HasColumnType("character varying(300)"); + .HasColumnType("TEXT"); b.Property("Name") .HasMaxLength(100) - .HasColumnType("character varying(100)"); + .HasColumnType("TEXT"); b.Property("OrganizationId") - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("TEXT"); b.HasKey("Id"); @@ -512,13 +541,13 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.GroupUser", b => { b.Property("GroupId") - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.Property("OrganizationUserId") - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.Property("UserId") - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.HasKey("GroupId", "OrganizationUserId"); @@ -532,21 +561,21 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Installation", b => { b.Property("Id") - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("TEXT"); b.Property("Email") .HasMaxLength(256) - .HasColumnType("character varying(256)"); + .HasColumnType("TEXT"); b.Property("Enabled") - .HasColumnType("boolean"); + .HasColumnType("INTEGER"); b.Property("Key") .HasMaxLength(150) - .HasColumnType("character varying(150)"); + .HasColumnType("TEXT"); b.HasKey("Id"); @@ -556,150 +585,152 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Organization", b => { b.Property("Id") - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.Property("BillingEmail") .HasMaxLength(256) - .HasColumnType("character varying(256)"); + .HasColumnType("TEXT"); b.Property("BusinessAddress1") .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("TEXT"); b.Property("BusinessAddress2") .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("TEXT"); b.Property("BusinessAddress3") .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("TEXT"); b.Property("BusinessCountry") .HasMaxLength(2) - .HasColumnType("character varying(2)"); + .HasColumnType("TEXT"); b.Property("BusinessName") .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("TEXT"); b.Property("BusinessTaxNumber") .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("TEXT"); b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("TEXT"); b.Property("Enabled") - .HasColumnType("boolean"); + .HasColumnType("INTEGER"); b.Property("ExpirationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("TEXT"); b.Property("Gateway") - .HasColumnType("smallint"); + .HasColumnType("INTEGER"); b.Property("GatewayCustomerId") .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("TEXT"); b.Property("GatewaySubscriptionId") .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("TEXT"); b.Property("Identifier") .HasMaxLength(50) - .HasColumnType("character varying(50)") - .UseCollation("postgresIndetermanisticCollation"); + .HasColumnType("TEXT"); b.Property("LicenseKey") .HasMaxLength(100) - .HasColumnType("character varying(100)"); + .HasColumnType("TEXT"); b.Property("MaxAutoscaleSeats") - .HasColumnType("integer"); + .HasColumnType("INTEGER"); b.Property("MaxCollections") - .HasColumnType("smallint"); + .HasColumnType("INTEGER"); b.Property("MaxStorageGb") - .HasColumnType("smallint"); + .HasColumnType("INTEGER"); b.Property("Name") .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("TEXT"); b.Property("OwnersNotifiedOfAutoscaling") - .HasColumnType("timestamp without time zone"); + .HasColumnType("TEXT"); b.Property("Plan") .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("TEXT"); b.Property("PlanType") - .HasColumnType("smallint"); + .HasColumnType("INTEGER"); b.Property("PrivateKey") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("PublicKey") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("ReferenceData") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("TEXT"); b.Property("Seats") - .HasColumnType("integer"); + .HasColumnType("INTEGER"); b.Property("SelfHost") - .HasColumnType("boolean"); + .HasColumnType("INTEGER"); b.Property("Storage") - .HasColumnType("bigint"); + .HasColumnType("INTEGER"); b.Property("TwoFactorProviders") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("Use2fa") - .HasColumnType("boolean"); + .HasColumnType("INTEGER"); b.Property("UseApi") - .HasColumnType("boolean"); + .HasColumnType("INTEGER"); + + b.Property("UseCustomPermissions") + .HasColumnType("INTEGER"); b.Property("UseDirectory") - .HasColumnType("boolean"); + .HasColumnType("INTEGER"); b.Property("UseEvents") - .HasColumnType("boolean"); + .HasColumnType("INTEGER"); b.Property("UseGroups") - .HasColumnType("boolean"); + .HasColumnType("INTEGER"); b.Property("UseKeyConnector") - .HasColumnType("boolean"); + .HasColumnType("INTEGER"); b.Property("UsePolicies") - .HasColumnType("boolean"); + .HasColumnType("INTEGER"); b.Property("UseResetPassword") - .HasColumnType("boolean"); + .HasColumnType("INTEGER"); b.Property("UseScim") - .HasColumnType("boolean"); + .HasColumnType("INTEGER"); b.Property("UseSecretsManager") - .HasColumnType("boolean"); + .HasColumnType("INTEGER"); b.Property("UseSso") - .HasColumnType("boolean"); + .HasColumnType("INTEGER"); b.Property("UseTotp") - .HasColumnType("boolean"); + .HasColumnType("INTEGER"); b.Property("UsersGetPremium") - .HasColumnType("boolean"); + .HasColumnType("INTEGER"); b.HasKey("Id"); @@ -709,20 +740,20 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationApiKey", b => { b.Property("Id") - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.Property("ApiKey") .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("TEXT"); b.Property("OrganizationId") - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("TEXT"); b.Property("Type") - .HasColumnType("smallint"); + .HasColumnType("INTEGER"); b.HasKey("Id"); @@ -734,19 +765,19 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationConnection", b => { b.Property("Id") - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.Property("Config") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("Enabled") - .HasColumnType("boolean"); + .HasColumnType("INTEGER"); b.Property("OrganizationId") - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.Property("Type") - .HasColumnType("smallint"); + .HasColumnType("INTEGER"); b.HasKey("Id"); @@ -758,36 +789,36 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationSponsorship", b => { b.Property("Id") - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.Property("FriendlyName") .HasMaxLength(256) - .HasColumnType("character varying(256)"); + .HasColumnType("TEXT"); b.Property("LastSyncDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("TEXT"); b.Property("OfferedToEmail") .HasMaxLength(256) - .HasColumnType("character varying(256)"); + .HasColumnType("TEXT"); b.Property("PlanSponsorshipType") - .HasColumnType("smallint"); + .HasColumnType("INTEGER"); b.Property("SponsoredOrganizationId") - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.Property("SponsoringOrganizationId") - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.Property("SponsoringOrganizationUserId") - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.Property("ToDelete") - .HasColumnType("boolean"); + .HasColumnType("INTEGER"); b.Property("ValidUntil") - .HasColumnType("timestamp without time zone"); + .HasColumnType("TEXT"); b.HasKey("Id"); @@ -801,45 +832,45 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", b => { b.Property("Id") - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.Property("AccessAll") - .HasColumnType("boolean"); + .HasColumnType("INTEGER"); b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("TEXT"); b.Property("Email") .HasMaxLength(256) - .HasColumnType("character varying(256)"); + .HasColumnType("TEXT"); b.Property("ExternalId") .HasMaxLength(300) - .HasColumnType("character varying(300)"); + .HasColumnType("TEXT"); b.Property("Key") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("OrganizationId") - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.Property("Permissions") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("ResetPasswordKey") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("TEXT"); b.Property("Status") - .HasColumnType("smallint"); + .HasColumnType("INTEGER"); b.Property("Type") - .HasColumnType("smallint"); + .HasColumnType("INTEGER"); b.Property("UserId") - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.HasKey("Id"); @@ -853,25 +884,25 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Policy", b => { b.Property("Id") - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("TEXT"); b.Property("Data") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("Enabled") - .HasColumnType("boolean"); + .HasColumnType("INTEGER"); b.Property("OrganizationId") - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("TEXT"); b.Property("Type") - .HasColumnType("smallint"); + .HasColumnType("INTEGER"); b.HasKey("Id"); @@ -883,22 +914,22 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Project", b => { b.Property("Id") - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("TEXT"); b.Property("DeletedDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("TEXT"); b.Property("Name") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("OrganizationId") - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("TEXT"); b.HasKey("Id") .HasAnnotation("SqlServer:Clustered", true); @@ -915,46 +946,46 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Provider", b => { b.Property("Id") - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.Property("BillingEmail") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("BusinessAddress1") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("BusinessAddress2") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("BusinessAddress3") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("BusinessCountry") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("BusinessName") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("BusinessTaxNumber") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("TEXT"); b.Property("Enabled") - .HasColumnType("boolean"); + .HasColumnType("INTEGER"); b.Property("Name") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("TEXT"); b.Property("Status") - .HasColumnType("smallint"); + .HasColumnType("INTEGER"); b.Property("UseEvents") - .HasColumnType("boolean"); + .HasColumnType("INTEGER"); b.HasKey("Id"); @@ -964,25 +995,25 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ProviderOrganization", b => { b.Property("Id") - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("TEXT"); b.Property("Key") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("OrganizationId") - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.Property("ProviderId") - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("TEXT"); b.Property("Settings") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.HasKey("Id"); @@ -996,34 +1027,34 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ProviderUser", b => { b.Property("Id") - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("TEXT"); b.Property("Email") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("Key") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("Permissions") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("ProviderId") - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("TEXT"); b.Property("Status") - .HasColumnType("smallint"); + .HasColumnType("INTEGER"); b.Property("Type") - .HasColumnType("smallint"); + .HasColumnType("INTEGER"); b.Property("UserId") - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.HasKey("Id"); @@ -1037,28 +1068,28 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Secret", b => { b.Property("Id") - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("TEXT"); b.Property("DeletedDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("TEXT"); b.Property("Key") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("Note") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("OrganizationId") - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("TEXT"); b.Property("Value") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.HasKey("Id") .HasAnnotation("SqlServer:Clustered", true); @@ -1075,50 +1106,50 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Send", b => { b.Property("Id") - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.Property("AccessCount") - .HasColumnType("integer"); + .HasColumnType("INTEGER"); b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("TEXT"); b.Property("Data") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("DeletionDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("TEXT"); b.Property("Disabled") - .HasColumnType("boolean"); + .HasColumnType("INTEGER"); b.Property("ExpirationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("TEXT"); b.Property("HideEmail") - .HasColumnType("boolean"); + .HasColumnType("INTEGER"); b.Property("Key") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("MaxAccessCount") - .HasColumnType("integer"); + .HasColumnType("INTEGER"); b.Property("OrganizationId") - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.Property("Password") .HasMaxLength(300) - .HasColumnType("character varying(300)"); + .HasColumnType("TEXT"); b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("TEXT"); b.Property("Type") - .HasColumnType("smallint"); + .HasColumnType("INTEGER"); b.Property("UserId") - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.HasKey("Id"); @@ -1132,19 +1163,19 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ServiceAccount", b => { b.Property("Id") - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("TEXT"); b.Property("Name") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("OrganizationId") - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("TEXT"); b.HasKey("Id") .HasAnnotation("SqlServer:Clustered", true); @@ -1159,24 +1190,22 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + .HasColumnType("INTEGER"); b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("TEXT"); b.Property("Data") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("Enabled") - .HasColumnType("boolean"); + .HasColumnType("INTEGER"); b.Property("OrganizationId") - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("TEXT"); b.HasKey("Id"); @@ -1189,23 +1218,20 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + .HasColumnType("INTEGER"); b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("TEXT"); b.Property("ExternalId") .HasMaxLength(50) - .HasColumnType("character varying(50)") - .UseCollation("postgresIndetermanisticCollation"); + .HasColumnType("TEXT"); b.Property("OrganizationId") - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.Property("UserId") - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.HasKey("Id"); @@ -1220,25 +1246,25 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) { b.Property("Id") .HasMaxLength(40) - .HasColumnType("character varying(40)"); + .HasColumnType("TEXT"); b.Property("Active") - .HasColumnType("boolean"); + .HasColumnType("INTEGER"); b.Property("Country") .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("TEXT"); b.Property("PostalCode") .HasMaxLength(10) - .HasColumnType("character varying(10)"); + .HasColumnType("TEXT"); b.Property("Rate") - .HasColumnType("numeric"); + .HasColumnType("TEXT"); b.Property("State") .HasMaxLength(2) - .HasColumnType("character varying(2)"); + .HasColumnType("TEXT"); b.HasKey("Id"); @@ -1248,42 +1274,42 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Transaction", b => { b.Property("Id") - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.Property("Amount") - .HasColumnType("numeric"); + .HasColumnType("TEXT"); b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("TEXT"); b.Property("Details") .HasMaxLength(100) - .HasColumnType("character varying(100)"); + .HasColumnType("TEXT"); b.Property("Gateway") - .HasColumnType("smallint"); + .HasColumnType("INTEGER"); b.Property("GatewayId") .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("TEXT"); b.Property("OrganizationId") - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.Property("PaymentMethodType") - .HasColumnType("smallint"); + .HasColumnType("INTEGER"); b.Property("Refunded") - .HasColumnType("boolean"); + .HasColumnType("INTEGER"); b.Property("RefundedAmount") - .HasColumnType("numeric"); + .HasColumnType("TEXT"); b.Property("Type") - .HasColumnType("smallint"); + .HasColumnType("INTEGER"); b.Property("UserId") - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.HasKey("Id"); @@ -1297,127 +1323,130 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.User", b => { b.Property("Id") - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.Property("AccountRevisionDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("TEXT"); b.Property("ApiKey") .IsRequired() .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("TEXT"); + + b.Property("AvatarColor") + .HasMaxLength(7) + .HasColumnType("TEXT"); b.Property("CreationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("TEXT"); b.Property("Culture") .HasMaxLength(10) - .HasColumnType("character varying(10)"); + .HasColumnType("TEXT"); b.Property("Email") .IsRequired() .HasMaxLength(256) - .HasColumnType("character varying(256)") - .UseCollation("postgresIndetermanisticCollation"); + .HasColumnType("TEXT"); b.Property("EmailVerified") - .HasColumnType("boolean"); + .HasColumnType("INTEGER"); b.Property("EquivalentDomains") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("ExcludedGlobalEquivalentDomains") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("FailedLoginCount") - .HasColumnType("integer"); + .HasColumnType("INTEGER"); b.Property("ForcePasswordReset") - .HasColumnType("boolean"); + .HasColumnType("INTEGER"); b.Property("Gateway") - .HasColumnType("smallint"); + .HasColumnType("INTEGER"); b.Property("GatewayCustomerId") .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("TEXT"); b.Property("GatewaySubscriptionId") .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("TEXT"); b.Property("Kdf") - .HasColumnType("smallint"); + .HasColumnType("INTEGER"); b.Property("KdfIterations") - .HasColumnType("integer"); + .HasColumnType("INTEGER"); b.Property("Key") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("LastFailedLoginDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("TEXT"); b.Property("LicenseKey") .HasMaxLength(100) - .HasColumnType("character varying(100)"); + .HasColumnType("TEXT"); b.Property("MasterPassword") .HasMaxLength(300) - .HasColumnType("character varying(300)"); + .HasColumnType("TEXT"); b.Property("MasterPasswordHint") .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("TEXT"); b.Property("MaxStorageGb") - .HasColumnType("smallint"); + .HasColumnType("INTEGER"); b.Property("Name") .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("TEXT"); b.Property("Premium") - .HasColumnType("boolean"); + .HasColumnType("INTEGER"); b.Property("PremiumExpirationDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("TEXT"); b.Property("PrivateKey") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("PublicKey") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("ReferenceData") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("RenewalReminderDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("TEXT"); b.Property("RevisionDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("TEXT"); b.Property("SecurityStamp") .IsRequired() .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("TEXT"); b.Property("Storage") - .HasColumnType("bigint"); + .HasColumnType("INTEGER"); b.Property("TwoFactorProviders") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("TwoFactorRecoveryCode") .HasMaxLength(32) - .HasColumnType("character varying(32)"); + .HasColumnType("TEXT"); b.Property("UnknownDeviceVerificationEnabled") - .HasColumnType("boolean"); + .HasColumnType("INTEGER"); b.Property("UsesKeyConnector") - .HasColumnType("boolean"); + .HasColumnType("INTEGER"); b.HasKey("Id"); @@ -1427,10 +1456,10 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) modelBuilder.Entity("ProjectSecret", b => { b.Property("ProjectsId") - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.Property("SecretsId") - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.HasKey("ProjectsId", "SecretsId"); @@ -1439,6 +1468,110 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.ToTable("ProjectSecret"); }); + modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.GroupProjectAccessPolicy", b => + { + b.HasBaseType("Bit.Infrastructure.EntityFramework.Models.AccessPolicy"); + + b.Property("GrantedProjectId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("TEXT") + .HasColumnName("GrantedProjectId"); + + b.Property("GroupId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("TEXT") + .HasColumnName("GroupId"); + + b.HasIndex("GrantedProjectId"); + + b.HasIndex("GroupId"); + + b.HasDiscriminator().HasValue("group_project"); + }); + + modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.GroupServiceAccountAccessPolicy", b => + { + b.HasBaseType("Bit.Infrastructure.EntityFramework.Models.AccessPolicy"); + + b.Property("GrantedServiceAccountId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("TEXT") + .HasColumnName("GrantedServiceAccountId"); + + b.Property("GroupId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("TEXT") + .HasColumnName("GroupId"); + + b.HasIndex("GrantedServiceAccountId"); + + b.HasIndex("GroupId"); + + b.HasDiscriminator().HasValue("group_service_account"); + }); + + modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ServiceAccountProjectAccessPolicy", b => + { + b.HasBaseType("Bit.Infrastructure.EntityFramework.Models.AccessPolicy"); + + b.Property("GrantedProjectId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("TEXT") + .HasColumnName("GrantedProjectId"); + + b.Property("ServiceAccountId") + .HasColumnType("TEXT") + .HasColumnName("ServiceAccountId"); + + b.HasIndex("GrantedProjectId"); + + b.HasIndex("ServiceAccountId"); + + b.HasDiscriminator().HasValue("service_account_project"); + }); + + modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.UserProjectAccessPolicy", b => + { + b.HasBaseType("Bit.Infrastructure.EntityFramework.Models.AccessPolicy"); + + b.Property("GrantedProjectId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("TEXT") + .HasColumnName("GrantedProjectId"); + + b.Property("OrganizationUserId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("TEXT") + .HasColumnName("OrganizationUserId"); + + b.HasIndex("GrantedProjectId"); + + b.HasIndex("OrganizationUserId"); + + b.HasDiscriminator().HasValue("user_project"); + }); + + modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.UserServiceAccountAccessPolicy", b => + { + b.HasBaseType("Bit.Infrastructure.EntityFramework.Models.AccessPolicy"); + + b.Property("GrantedServiceAccountId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("TEXT") + .HasColumnName("GrantedServiceAccountId"); + + b.Property("OrganizationUserId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("TEXT") + .HasColumnName("OrganizationUserId"); + + b.HasIndex("GrantedServiceAccountId"); + + b.HasIndex("OrganizationUserId"); + + b.HasDiscriminator().HasValue("user_service_account"); + }); + modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ApiKey", b => { b.HasOne("Bit.Infrastructure.EntityFramework.Models.ServiceAccount", "ServiceAccount") @@ -1832,6 +1965,81 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .IsRequired(); }); + modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.GroupProjectAccessPolicy", b => + { + b.HasOne("Bit.Infrastructure.EntityFramework.Models.Project", "GrantedProject") + .WithMany("GroupAccessPolicies") + .HasForeignKey("GrantedProjectId"); + + b.HasOne("Bit.Infrastructure.EntityFramework.Models.Group", "Group") + .WithMany() + .HasForeignKey("GroupId"); + + b.Navigation("GrantedProject"); + + b.Navigation("Group"); + }); + + modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.GroupServiceAccountAccessPolicy", b => + { + b.HasOne("Bit.Infrastructure.EntityFramework.Models.ServiceAccount", "GrantedServiceAccount") + .WithMany() + .HasForeignKey("GrantedServiceAccountId"); + + b.HasOne("Bit.Infrastructure.EntityFramework.Models.Group", "Group") + .WithMany() + .HasForeignKey("GroupId"); + + b.Navigation("GrantedServiceAccount"); + + b.Navigation("Group"); + }); + + modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ServiceAccountProjectAccessPolicy", b => + { + b.HasOne("Bit.Infrastructure.EntityFramework.Models.Project", "GrantedProject") + .WithMany("ServiceAccountAccessPolicies") + .HasForeignKey("GrantedProjectId"); + + b.HasOne("Bit.Infrastructure.EntityFramework.Models.ServiceAccount", "ServiceAccount") + .WithMany() + .HasForeignKey("ServiceAccountId"); + + b.Navigation("GrantedProject"); + + b.Navigation("ServiceAccount"); + }); + + modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.UserProjectAccessPolicy", b => + { + b.HasOne("Bit.Infrastructure.EntityFramework.Models.Project", "GrantedProject") + .WithMany("UserAccessPolicies") + .HasForeignKey("GrantedProjectId"); + + b.HasOne("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", "OrganizationUser") + .WithMany() + .HasForeignKey("OrganizationUserId"); + + b.Navigation("GrantedProject"); + + b.Navigation("OrganizationUser"); + }); + + modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.UserServiceAccountAccessPolicy", b => + { + b.HasOne("Bit.Infrastructure.EntityFramework.Models.ServiceAccount", "GrantedServiceAccount") + .WithMany() + .HasForeignKey("GrantedServiceAccountId"); + + b.HasOne("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", "OrganizationUser") + .WithMany() + .HasForeignKey("OrganizationUserId"); + + b.Navigation("GrantedServiceAccount"); + + b.Navigation("OrganizationUser"); + }); + modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Cipher", b => { b.Navigation("CollectionCiphers"); @@ -1877,6 +2085,15 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.Navigation("CollectionUsers"); }); + modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Project", b => + { + b.Navigation("GroupAccessPolicies"); + + b.Navigation("ServiceAccountAccessPolicies"); + + b.Navigation("UserAccessPolicies"); + }); + modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.User", b => { b.Navigation("Ciphers"); diff --git a/util/SqliteMigrations/Migrations/20230106153919_SecretsManager.cs b/util/SqliteMigrations/Migrations/20230106153919_SecretsManager.cs new file mode 100644 index 000000000000..fbf1f5e3cbf9 --- /dev/null +++ b/util/SqliteMigrations/Migrations/20230106153919_SecretsManager.cs @@ -0,0 +1,276 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Bit.SqliteMigrations.Migrations; + +public partial class SecretsManager : Migration +{ + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "AvatarColor", + table: "User", + type: "TEXT", + maxLength: 7, + nullable: true); + + migrationBuilder.AddColumn( + name: "UseSecretsManager", + table: "Organization", + type: "INTEGER", + nullable: false, + defaultValue: false); + + migrationBuilder.CreateTable( + name: "Project", + columns: table => new + { + Id = table.Column(type: "TEXT", nullable: false), + OrganizationId = table.Column(type: "TEXT", nullable: false), + Name = table.Column(type: "TEXT", nullable: true), + CreationDate = table.Column(type: "TEXT", nullable: false), + RevisionDate = table.Column(type: "TEXT", nullable: false), + DeletedDate = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Project", x => x.Id); + table.ForeignKey( + name: "FK_Project_Organization_OrganizationId", + column: x => x.OrganizationId, + principalTable: "Organization", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Secret", + columns: table => new + { + Id = table.Column(type: "TEXT", nullable: false), + OrganizationId = table.Column(type: "TEXT", nullable: false), + Key = table.Column(type: "TEXT", nullable: true), + Value = table.Column(type: "TEXT", nullable: true), + Note = table.Column(type: "TEXT", nullable: true), + CreationDate = table.Column(type: "TEXT", nullable: false), + RevisionDate = table.Column(type: "TEXT", nullable: false), + DeletedDate = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Secret", x => x.Id); + table.ForeignKey( + name: "FK_Secret_Organization_OrganizationId", + column: x => x.OrganizationId, + principalTable: "Organization", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ServiceAccount", + columns: table => new + { + Id = table.Column(type: "TEXT", nullable: false), + OrganizationId = table.Column(type: "TEXT", nullable: false), + Name = table.Column(type: "TEXT", nullable: true), + CreationDate = table.Column(type: "TEXT", nullable: false), + RevisionDate = table.Column(type: "TEXT", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ServiceAccount", x => x.Id); + table.ForeignKey( + name: "FK_ServiceAccount_Organization_OrganizationId", + column: x => x.OrganizationId, + principalTable: "Organization", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ProjectSecret", + columns: table => new + { + ProjectsId = table.Column(type: "TEXT", nullable: false), + SecretsId = table.Column(type: "TEXT", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ProjectSecret", x => new { x.ProjectsId, x.SecretsId }); + table.ForeignKey( + name: "FK_ProjectSecret_Project_ProjectsId", + column: x => x.ProjectsId, + principalTable: "Project", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ProjectSecret_Secret_SecretsId", + column: x => x.SecretsId, + principalTable: "Secret", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "AccessPolicy", + columns: table => new + { + Id = table.Column(type: "TEXT", nullable: false), + GroupId = table.Column(type: "TEXT", nullable: true), + GrantedProjectId = table.Column(type: "TEXT", nullable: true), + GrantedServiceAccountId = table.Column(type: "TEXT", nullable: true), + ServiceAccountId = table.Column(type: "TEXT", nullable: true), + OrganizationUserId = table.Column(type: "TEXT", nullable: true), + Read = table.Column(type: "INTEGER", nullable: false), + Write = table.Column(type: "INTEGER", nullable: false), + CreationDate = table.Column(type: "TEXT", nullable: false), + RevisionDate = table.Column(type: "TEXT", nullable: false), + Discriminator = table.Column(type: "TEXT", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AccessPolicy", x => x.Id); + table.ForeignKey( + name: "FK_AccessPolicy_Group_GroupId", + column: x => x.GroupId, + principalTable: "Group", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_AccessPolicy_OrganizationUser_OrganizationUserId", + column: x => x.OrganizationUserId, + principalTable: "OrganizationUser", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_AccessPolicy_Project_GrantedProjectId", + column: x => x.GrantedProjectId, + principalTable: "Project", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_AccessPolicy_ServiceAccount_GrantedServiceAccountId", + column: x => x.GrantedServiceAccountId, + principalTable: "ServiceAccount", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_AccessPolicy_ServiceAccount_ServiceAccountId", + column: x => x.ServiceAccountId, + principalTable: "ServiceAccount", + principalColumn: "Id"); + }); + + migrationBuilder.CreateTable( + name: "ApiKey", + columns: table => new + { + Id = table.Column(type: "TEXT", nullable: false), + ServiceAccountId = table.Column(type: "TEXT", nullable: true), + Name = table.Column(type: "TEXT", maxLength: 200, nullable: true), + ClientSecret = table.Column(type: "TEXT", maxLength: 30, nullable: true), + Scope = table.Column(type: "TEXT", maxLength: 4000, nullable: true), + EncryptedPayload = table.Column(type: "TEXT", maxLength: 4000, nullable: true), + Key = table.Column(type: "TEXT", nullable: true), + ExpireAt = table.Column(type: "TEXT", nullable: true), + CreationDate = table.Column(type: "TEXT", nullable: false), + RevisionDate = table.Column(type: "TEXT", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ApiKey", x => x.Id); + table.ForeignKey( + name: "FK_ApiKey_ServiceAccount_ServiceAccountId", + column: x => x.ServiceAccountId, + principalTable: "ServiceAccount", + principalColumn: "Id"); + }); + + migrationBuilder.CreateIndex( + name: "IX_AccessPolicy_GrantedProjectId", + table: "AccessPolicy", + column: "GrantedProjectId"); + + migrationBuilder.CreateIndex( + name: "IX_AccessPolicy_GrantedServiceAccountId", + table: "AccessPolicy", + column: "GrantedServiceAccountId"); + + migrationBuilder.CreateIndex( + name: "IX_AccessPolicy_GroupId", + table: "AccessPolicy", + column: "GroupId"); + + migrationBuilder.CreateIndex( + name: "IX_AccessPolicy_OrganizationUserId", + table: "AccessPolicy", + column: "OrganizationUserId"); + + migrationBuilder.CreateIndex( + name: "IX_AccessPolicy_ServiceAccountId", + table: "AccessPolicy", + column: "ServiceAccountId"); + + migrationBuilder.CreateIndex( + name: "IX_ApiKey_ServiceAccountId", + table: "ApiKey", + column: "ServiceAccountId"); + + migrationBuilder.CreateIndex( + name: "IX_Project_DeletedDate", + table: "Project", + column: "DeletedDate"); + + migrationBuilder.CreateIndex( + name: "IX_Project_OrganizationId", + table: "Project", + column: "OrganizationId"); + + migrationBuilder.CreateIndex( + name: "IX_ProjectSecret_SecretsId", + table: "ProjectSecret", + column: "SecretsId"); + + migrationBuilder.CreateIndex( + name: "IX_Secret_DeletedDate", + table: "Secret", + column: "DeletedDate"); + + migrationBuilder.CreateIndex( + name: "IX_Secret_OrganizationId", + table: "Secret", + column: "OrganizationId"); + + migrationBuilder.CreateIndex( + name: "IX_ServiceAccount_OrganizationId", + table: "ServiceAccount", + column: "OrganizationId"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "AccessPolicy"); + + migrationBuilder.DropTable( + name: "ApiKey"); + + migrationBuilder.DropTable( + name: "ProjectSecret"); + + migrationBuilder.DropTable( + name: "ServiceAccount"); + + migrationBuilder.DropTable( + name: "Project"); + + migrationBuilder.DropTable( + name: "Secret"); + + migrationBuilder.DropColumn( + name: "AvatarColor", + table: "User"); + + migrationBuilder.DropColumn( + name: "UseSecretsManager", + table: "Organization"); + } +} diff --git a/util/SqliteMigrations/Migrations/DatabaseContextModelSnapshot.cs b/util/SqliteMigrations/Migrations/DatabaseContextModelSnapshot.cs index 821b59dbfefe..3d75efc6e701 100644 --- a/util/SqliteMigrations/Migrations/DatabaseContextModelSnapshot.cs +++ b/util/SqliteMigrations/Migrations/DatabaseContextModelSnapshot.cs @@ -15,7 +15,81 @@ partial class DatabaseContextModelSnapshot : ModelSnapshot protected override void BuildModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "6.0.4"); + modelBuilder.HasAnnotation("ProductVersion", "6.0.12"); + + modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.AccessPolicy", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("CreationDate") + .HasColumnType("TEXT"); + + b.Property("Discriminator") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Read") + .HasColumnType("INTEGER"); + + b.Property("RevisionDate") + .HasColumnType("TEXT"); + + b.Property("Write") + .HasColumnType("INTEGER"); + + b.HasKey("Id") + .HasAnnotation("SqlServer:Clustered", true); + + b.ToTable("AccessPolicy", (string)null); + + b.HasDiscriminator("Discriminator").HasValue("AccessPolicy"); + }); + + modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ApiKey", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ClientSecret") + .HasMaxLength(30) + .HasColumnType("TEXT"); + + b.Property("CreationDate") + .HasColumnType("TEXT"); + + b.Property("EncryptedPayload") + .HasMaxLength(4000) + .HasColumnType("TEXT"); + + b.Property("ExpireAt") + .HasColumnType("TEXT"); + + b.Property("Key") + .HasColumnType("TEXT"); + + b.Property("Name") + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("RevisionDate") + .HasColumnType("TEXT"); + + b.Property("Scope") + .HasMaxLength(4000) + .HasColumnType("TEXT"); + + b.Property("ServiceAccountId") + .HasColumnType("TEXT"); + + b.HasKey("Id") + .HasAnnotation("SqlServer:Clustered", true); + + b.HasIndex("ServiceAccountId") + .HasAnnotation("SqlServer:Clustered", false); + + b.ToTable("ApiKey", (string)null); + }); modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.AuthRequest", b => { @@ -644,6 +718,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("UseScim") .HasColumnType("INTEGER"); + b.Property("UseSecretsManager") + .HasColumnType("INTEGER"); + b.Property("UseSso") .HasColumnType("INTEGER"); @@ -832,6 +909,38 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("Policy", (string)null); }); + modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Project", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("CreationDate") + .HasColumnType("TEXT"); + + b.Property("DeletedDate") + .HasColumnType("TEXT"); + + b.Property("Name") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("RevisionDate") + .HasColumnType("TEXT"); + + b.HasKey("Id") + .HasAnnotation("SqlServer:Clustered", true); + + b.HasIndex("DeletedDate") + .HasAnnotation("SqlServer:Clustered", false); + + b.HasIndex("OrganizationId") + .HasAnnotation("SqlServer:Clustered", false); + + b.ToTable("Project", (string)null); + }); + modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Provider", b => { b.Property("Id") @@ -954,6 +1063,44 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("ProviderUser", (string)null); }); + modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Secret", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("CreationDate") + .HasColumnType("TEXT"); + + b.Property("DeletedDate") + .HasColumnType("TEXT"); + + b.Property("Key") + .HasColumnType("TEXT"); + + b.Property("Note") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("RevisionDate") + .HasColumnType("TEXT"); + + b.Property("Value") + .HasColumnType("TEXT"); + + b.HasKey("Id") + .HasAnnotation("SqlServer:Clustered", true); + + b.HasIndex("DeletedDate") + .HasAnnotation("SqlServer:Clustered", false); + + b.HasIndex("OrganizationId") + .HasAnnotation("SqlServer:Clustered", false); + + b.ToTable("Secret", (string)null); + }); + modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Send", b => { b.Property("Id") @@ -1011,6 +1158,32 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("Send", (string)null); }); + modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ServiceAccount", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("CreationDate") + .HasColumnType("TEXT"); + + b.Property("Name") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("RevisionDate") + .HasColumnType("TEXT"); + + b.HasKey("Id") + .HasAnnotation("SqlServer:Clustered", true); + + b.HasIndex("OrganizationId") + .HasAnnotation("SqlServer:Clustered", false); + + b.ToTable("ServiceAccount", (string)null); + }); + modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.SsoConfig", b => { b.Property("Id") @@ -1158,6 +1331,10 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasMaxLength(30) .HasColumnType("TEXT"); + b.Property("AvatarColor") + .HasMaxLength(7) + .HasColumnType("TEXT"); + b.Property("CreationDate") .HasColumnType("TEXT"); @@ -1274,6 +1451,134 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("User", (string)null); }); + modelBuilder.Entity("ProjectSecret", b => + { + b.Property("ProjectsId") + .HasColumnType("TEXT"); + + b.Property("SecretsId") + .HasColumnType("TEXT"); + + b.HasKey("ProjectsId", "SecretsId"); + + b.HasIndex("SecretsId"); + + b.ToTable("ProjectSecret"); + }); + + modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.GroupProjectAccessPolicy", b => + { + b.HasBaseType("Bit.Infrastructure.EntityFramework.Models.AccessPolicy"); + + b.Property("GrantedProjectId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("TEXT") + .HasColumnName("GrantedProjectId"); + + b.Property("GroupId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("TEXT") + .HasColumnName("GroupId"); + + b.HasIndex("GrantedProjectId"); + + b.HasIndex("GroupId"); + + b.HasDiscriminator().HasValue("group_project"); + }); + + modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.GroupServiceAccountAccessPolicy", b => + { + b.HasBaseType("Bit.Infrastructure.EntityFramework.Models.AccessPolicy"); + + b.Property("GrantedServiceAccountId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("TEXT") + .HasColumnName("GrantedServiceAccountId"); + + b.Property("GroupId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("TEXT") + .HasColumnName("GroupId"); + + b.HasIndex("GrantedServiceAccountId"); + + b.HasIndex("GroupId"); + + b.HasDiscriminator().HasValue("group_service_account"); + }); + + modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ServiceAccountProjectAccessPolicy", b => + { + b.HasBaseType("Bit.Infrastructure.EntityFramework.Models.AccessPolicy"); + + b.Property("GrantedProjectId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("TEXT") + .HasColumnName("GrantedProjectId"); + + b.Property("ServiceAccountId") + .HasColumnType("TEXT") + .HasColumnName("ServiceAccountId"); + + b.HasIndex("GrantedProjectId"); + + b.HasIndex("ServiceAccountId"); + + b.HasDiscriminator().HasValue("service_account_project"); + }); + + modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.UserProjectAccessPolicy", b => + { + b.HasBaseType("Bit.Infrastructure.EntityFramework.Models.AccessPolicy"); + + b.Property("GrantedProjectId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("TEXT") + .HasColumnName("GrantedProjectId"); + + b.Property("OrganizationUserId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("TEXT") + .HasColumnName("OrganizationUserId"); + + b.HasIndex("GrantedProjectId"); + + b.HasIndex("OrganizationUserId"); + + b.HasDiscriminator().HasValue("user_project"); + }); + + modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.UserServiceAccountAccessPolicy", b => + { + b.HasBaseType("Bit.Infrastructure.EntityFramework.Models.AccessPolicy"); + + b.Property("GrantedServiceAccountId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("TEXT") + .HasColumnName("GrantedServiceAccountId"); + + b.Property("OrganizationUserId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("TEXT") + .HasColumnName("OrganizationUserId"); + + b.HasIndex("GrantedServiceAccountId"); + + b.HasIndex("OrganizationUserId"); + + b.HasDiscriminator().HasValue("user_service_account"); + }); + + modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ApiKey", b => + { + b.HasOne("Bit.Infrastructure.EntityFramework.Models.ServiceAccount", "ServiceAccount") + .WithMany() + .HasForeignKey("ServiceAccountId"); + + b.Navigation("ServiceAccount"); + }); + modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.AuthRequest", b => { b.HasOne("Bit.Infrastructure.EntityFramework.Models.Device", "ResponseDevice") @@ -1516,6 +1821,17 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Navigation("Organization"); }); + modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Project", b => + { + b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") + .WithMany() + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Organization"); + }); + modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ProviderOrganization", b => { b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") @@ -1552,6 +1868,17 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Navigation("User"); }); + modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Secret", b => + { + b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") + .WithMany() + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Organization"); + }); + modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Send", b => { b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") @@ -1567,6 +1894,17 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Navigation("User"); }); + modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ServiceAccount", b => + { + b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") + .WithMany() + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Organization"); + }); + modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.SsoConfig", b => { b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") @@ -1610,6 +1948,96 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Navigation("User"); }); + modelBuilder.Entity("ProjectSecret", b => + { + b.HasOne("Bit.Infrastructure.EntityFramework.Models.Project", null) + .WithMany() + .HasForeignKey("ProjectsId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Bit.Infrastructure.EntityFramework.Models.Secret", null) + .WithMany() + .HasForeignKey("SecretsId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.GroupProjectAccessPolicy", b => + { + b.HasOne("Bit.Infrastructure.EntityFramework.Models.Project", "GrantedProject") + .WithMany("GroupAccessPolicies") + .HasForeignKey("GrantedProjectId"); + + b.HasOne("Bit.Infrastructure.EntityFramework.Models.Group", "Group") + .WithMany() + .HasForeignKey("GroupId"); + + b.Navigation("GrantedProject"); + + b.Navigation("Group"); + }); + + modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.GroupServiceAccountAccessPolicy", b => + { + b.HasOne("Bit.Infrastructure.EntityFramework.Models.ServiceAccount", "GrantedServiceAccount") + .WithMany() + .HasForeignKey("GrantedServiceAccountId"); + + b.HasOne("Bit.Infrastructure.EntityFramework.Models.Group", "Group") + .WithMany() + .HasForeignKey("GroupId"); + + b.Navigation("GrantedServiceAccount"); + + b.Navigation("Group"); + }); + + modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ServiceAccountProjectAccessPolicy", b => + { + b.HasOne("Bit.Infrastructure.EntityFramework.Models.Project", "GrantedProject") + .WithMany("ServiceAccountAccessPolicies") + .HasForeignKey("GrantedProjectId"); + + b.HasOne("Bit.Infrastructure.EntityFramework.Models.ServiceAccount", "ServiceAccount") + .WithMany() + .HasForeignKey("ServiceAccountId"); + + b.Navigation("GrantedProject"); + + b.Navigation("ServiceAccount"); + }); + + modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.UserProjectAccessPolicy", b => + { + b.HasOne("Bit.Infrastructure.EntityFramework.Models.Project", "GrantedProject") + .WithMany("UserAccessPolicies") + .HasForeignKey("GrantedProjectId"); + + b.HasOne("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", "OrganizationUser") + .WithMany() + .HasForeignKey("OrganizationUserId"); + + b.Navigation("GrantedProject"); + + b.Navigation("OrganizationUser"); + }); + + modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.UserServiceAccountAccessPolicy", b => + { + b.HasOne("Bit.Infrastructure.EntityFramework.Models.ServiceAccount", "GrantedServiceAccount") + .WithMany() + .HasForeignKey("GrantedServiceAccountId"); + + b.HasOne("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", "OrganizationUser") + .WithMany() + .HasForeignKey("OrganizationUserId"); + + b.Navigation("GrantedServiceAccount"); + + b.Navigation("OrganizationUser"); + }); + modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Cipher", b => { b.Navigation("CollectionCiphers"); @@ -1655,6 +2083,15 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Navigation("CollectionUsers"); }); + modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Project", b => + { + b.Navigation("GroupAccessPolicies"); + + b.Navigation("ServiceAccountAccessPolicies"); + + b.Navigation("UserAccessPolicies"); + }); + modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.User", b => { b.Navigation("Ciphers");