mirror of
https://github.com/bitwarden/server.git
synced 2024-11-25 12:45:18 +01:00
Remove EF migration scripts (#2550)
* Removed Scripts folders * Removed .csproj references. * Added back HelperScripts * Added back additional helper scripts. * Fixed extra ItemGroup
This commit is contained in:
parent
ea9e30c35f
commit
145071d499
@ -6,7 +6,7 @@ namespace Bit.MySqlMigrations.Migrations;
|
||||
public partial class SplitManageCollectionsPermissions2 : Migration
|
||||
{
|
||||
private const string _scriptLocation =
|
||||
"MySqlMigrations.Scripts.2021-09-21_01_SplitManageCollectionsPermission.sql";
|
||||
"MySqlMigrations.HelperScripts.2021-09-21_01_SplitManageCollectionsPermission.sql";
|
||||
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
@ -6,7 +6,7 @@ namespace Bit.MySqlMigrations.Migrations;
|
||||
public partial class SetMaxAutoscaleSeatsToCurrentSeatCount : Migration
|
||||
{
|
||||
private const string _scriptLocation =
|
||||
"MySqlMigrations.Scripts.2021-10-21_00_SetMaxAutoscaleSeatCount.sql";
|
||||
"MySqlMigrations.HelperScripts.2021-10-21_00_SetMaxAutoscaleSeatCount.sql";
|
||||
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
@ -21,12 +21,12 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="Scripts\2021-09-21_01_SplitManageCollectionsPermission.sql" />
|
||||
<None Remove="Scripts\2021-10-21_00_SetMaxAutoscaleSeatCount.sql" />
|
||||
<None Remove="HelperScripts\2021-09-21_01_SplitManageCollectionsPermission.sql" />
|
||||
<None Remove="HelperScripts\2021-10-21_00_SetMaxAutoscaleSeatCount.sql" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Scripts\2021-09-21_01_SplitManageCollectionsPermission.sql" />
|
||||
<EmbeddedResource Include="Scripts\2021-10-21_00_SetMaxAutoscaleSeatCount.sql" />
|
||||
<EmbeddedResource Include="HelperScripts\2021-09-21_01_SplitManageCollectionsPermission.sql" />
|
||||
<EmbeddedResource Include="HelperScripts\2021-10-21_00_SetMaxAutoscaleSeatCount.sql" />
|
||||
<EmbeddedResource Include="HelperScripts\2022-03-01_00_Up_MigrateOrganizationApiKeys.sql" />
|
||||
<EmbeddedResource Include="HelperScripts\2022-03-01_00_Down_MigrateOrganizationApiKeys.sql" />
|
||||
</ItemGroup>
|
||||
|
@ -1,491 +0,0 @@
|
||||
ALTER DATABASE CHARACTER SET utf8mb4;
|
||||
CREATE TABLE IF NOT EXISTS `__EFMigrationsHistory` (
|
||||
`MigrationId` varchar(150) CHARACTER SET utf8mb4 NOT NULL,
|
||||
`ProductVersion` varchar(32) CHARACTER SET utf8mb4 NOT NULL,
|
||||
CONSTRAINT `PK___EFMigrationsHistory` PRIMARY KEY (`MigrationId`)
|
||||
) CHARACTER SET utf8mb4;
|
||||
|
||||
START TRANSACTION;
|
||||
|
||||
ALTER DATABASE CHARACTER SET utf8mb4;
|
||||
|
||||
CREATE TABLE `Event` (
|
||||
`Id` char(36) COLLATE ascii_general_ci NOT NULL,
|
||||
`Date` datetime(6) NOT NULL,
|
||||
`Type` int NOT NULL,
|
||||
`UserId` char(36) COLLATE ascii_general_ci NULL,
|
||||
`OrganizationId` char(36) COLLATE ascii_general_ci NULL,
|
||||
`CipherId` char(36) COLLATE ascii_general_ci NULL,
|
||||
`CollectionId` char(36) COLLATE ascii_general_ci NULL,
|
||||
`PolicyId` char(36) COLLATE ascii_general_ci NULL,
|
||||
`GroupId` char(36) COLLATE ascii_general_ci NULL,
|
||||
`OrganizationUserId` char(36) COLLATE ascii_general_ci NULL,
|
||||
`DeviceType` tinyint unsigned NULL,
|
||||
`IpAddress` varchar(50) CHARACTER SET utf8mb4 NULL,
|
||||
`ActingUserId` char(36) COLLATE ascii_general_ci NULL,
|
||||
CONSTRAINT `PK_Event` PRIMARY KEY (`Id`)
|
||||
) ENGINE=InnoDB CHARACTER SET utf8mb4;
|
||||
|
||||
CREATE TABLE `Grant` (
|
||||
`Key` varchar(200) CHARACTER SET utf8mb4 NOT NULL,
|
||||
`Type` varchar(50) CHARACTER SET utf8mb4 NULL,
|
||||
`SubjectId` varchar(200) CHARACTER SET utf8mb4 NULL,
|
||||
`SessionId` varchar(100) CHARACTER SET utf8mb4 NULL,
|
||||
`ClientId` varchar(200) CHARACTER SET utf8mb4 NULL,
|
||||
`Description` varchar(200) CHARACTER SET utf8mb4 NULL,
|
||||
`CreationDate` datetime(6) NOT NULL,
|
||||
`ExpirationDate` datetime(6) NULL,
|
||||
`ConsumedDate` datetime(6) NULL,
|
||||
`Data` longtext CHARACTER SET utf8mb4 NULL,
|
||||
CONSTRAINT `PK_Grant` PRIMARY KEY (`Key`)
|
||||
) ENGINE=InnoDB CHARACTER SET utf8mb4;
|
||||
|
||||
CREATE TABLE `Installation` (
|
||||
`Id` char(36) COLLATE ascii_general_ci NOT NULL,
|
||||
`Email` varchar(256) CHARACTER SET utf8mb4 NULL,
|
||||
`Key` varchar(150) CHARACTER SET utf8mb4 NULL,
|
||||
`Enabled` tinyint(1) NOT NULL,
|
||||
`CreationDate` datetime(6) NOT NULL,
|
||||
CONSTRAINT `PK_Installation` PRIMARY KEY (`Id`)
|
||||
) ENGINE=InnoDB CHARACTER SET utf8mb4;
|
||||
|
||||
CREATE TABLE `Organization` (
|
||||
`Id` char(36) COLLATE ascii_general_ci NOT NULL,
|
||||
`Identifier` varchar(50) CHARACTER SET utf8mb4 NULL,
|
||||
`Name` varchar(50) CHARACTER SET utf8mb4 NULL,
|
||||
`BusinessName` varchar(50) CHARACTER SET utf8mb4 NULL,
|
||||
`BusinessAddress1` varchar(50) CHARACTER SET utf8mb4 NULL,
|
||||
`BusinessAddress2` varchar(50) CHARACTER SET utf8mb4 NULL,
|
||||
`BusinessAddress3` varchar(50) CHARACTER SET utf8mb4 NULL,
|
||||
`BusinessCountry` varchar(2) CHARACTER SET utf8mb4 NULL,
|
||||
`BusinessTaxNumber` varchar(30) CHARACTER SET utf8mb4 NULL,
|
||||
`BillingEmail` varchar(256) CHARACTER SET utf8mb4 NULL,
|
||||
`Plan` varchar(50) CHARACTER SET utf8mb4 NULL,
|
||||
`PlanType` tinyint unsigned NOT NULL,
|
||||
`Seats` int NULL,
|
||||
`MaxCollections` smallint NULL,
|
||||
`UsePolicies` tinyint(1) NOT NULL,
|
||||
`UseSso` tinyint(1) NOT NULL,
|
||||
`UseGroups` tinyint(1) NOT NULL,
|
||||
`UseDirectory` tinyint(1) NOT NULL,
|
||||
`UseEvents` tinyint(1) NOT NULL,
|
||||
`UseTotp` tinyint(1) NOT NULL,
|
||||
`Use2fa` tinyint(1) NOT NULL,
|
||||
`UseApi` tinyint(1) NOT NULL,
|
||||
`UseResetPassword` tinyint(1) NOT NULL,
|
||||
`SelfHost` tinyint(1) NOT NULL,
|
||||
`UsersGetPremium` tinyint(1) NOT NULL,
|
||||
`Storage` bigint NULL,
|
||||
`MaxStorageGb` smallint NULL,
|
||||
`Gateway` tinyint unsigned NULL,
|
||||
`GatewayCustomerId` varchar(50) CHARACTER SET utf8mb4 NULL,
|
||||
`GatewaySubscriptionId` varchar(50) CHARACTER SET utf8mb4 NULL,
|
||||
`ReferenceData` longtext CHARACTER SET utf8mb4 NULL,
|
||||
`Enabled` tinyint(1) NOT NULL,
|
||||
`LicenseKey` varchar(100) CHARACTER SET utf8mb4 NULL,
|
||||
`ApiKey` varchar(30) CHARACTER SET utf8mb4 NULL,
|
||||
`PublicKey` longtext CHARACTER SET utf8mb4 NULL,
|
||||
`PrivateKey` longtext CHARACTER SET utf8mb4 NULL,
|
||||
`TwoFactorProviders` longtext CHARACTER SET utf8mb4 NULL,
|
||||
`ExpirationDate` datetime(6) NULL,
|
||||
`CreationDate` datetime(6) NOT NULL,
|
||||
`RevisionDate` datetime(6) NOT NULL,
|
||||
CONSTRAINT `PK_Organization` PRIMARY KEY (`Id`)
|
||||
) ENGINE=InnoDB CHARACTER SET utf8mb4;
|
||||
|
||||
CREATE TABLE `Provider` (
|
||||
`Id` char(36) COLLATE ascii_general_ci NOT NULL,
|
||||
`Name` longtext CHARACTER SET utf8mb4 NULL,
|
||||
`BusinessName` longtext CHARACTER SET utf8mb4 NULL,
|
||||
`BusinessAddress1` longtext CHARACTER SET utf8mb4 NULL,
|
||||
`BusinessAddress2` longtext CHARACTER SET utf8mb4 NULL,
|
||||
`BusinessAddress3` longtext CHARACTER SET utf8mb4 NULL,
|
||||
`BusinessCountry` longtext CHARACTER SET utf8mb4 NULL,
|
||||
`BusinessTaxNumber` longtext CHARACTER SET utf8mb4 NULL,
|
||||
`BillingEmail` longtext CHARACTER SET utf8mb4 NULL,
|
||||
`Status` tinyint unsigned NOT NULL,
|
||||
`Enabled` tinyint(1) NOT NULL,
|
||||
`CreationDate` datetime(6) NOT NULL,
|
||||
`RevisionDate` datetime(6) NOT NULL,
|
||||
CONSTRAINT `PK_Provider` PRIMARY KEY (`Id`)
|
||||
) ENGINE=InnoDB CHARACTER SET utf8mb4;
|
||||
|
||||
CREATE TABLE `TaxRate` (
|
||||
`Id` varchar(40) CHARACTER SET utf8mb4 NOT NULL,
|
||||
`Country` varchar(50) CHARACTER SET utf8mb4 NULL,
|
||||
`State` varchar(2) CHARACTER SET utf8mb4 NULL,
|
||||
`PostalCode` varchar(10) CHARACTER SET utf8mb4 NULL,
|
||||
`Rate` decimal(65,30) NOT NULL,
|
||||
`Active` tinyint(1) NOT NULL,
|
||||
CONSTRAINT `PK_TaxRate` PRIMARY KEY (`Id`)
|
||||
) ENGINE=InnoDB CHARACTER SET utf8mb4;
|
||||
|
||||
CREATE TABLE `User` (
|
||||
`Id` char(36) COLLATE ascii_general_ci NOT NULL,
|
||||
`Name` varchar(50) CHARACTER SET utf8mb4 NULL,
|
||||
`Email` varchar(256) CHARACTER SET utf8mb4 NOT NULL,
|
||||
`EmailVerified` tinyint(1) NOT NULL,
|
||||
`MasterPassword` varchar(300) CHARACTER SET utf8mb4 NULL,
|
||||
`MasterPasswordHint` varchar(50) CHARACTER SET utf8mb4 NULL,
|
||||
`Culture` varchar(10) CHARACTER SET utf8mb4 NULL,
|
||||
`SecurityStamp` varchar(50) CHARACTER SET utf8mb4 NOT NULL,
|
||||
`TwoFactorProviders` longtext CHARACTER SET utf8mb4 NULL,
|
||||
`TwoFactorRecoveryCode` varchar(32) CHARACTER SET utf8mb4 NULL,
|
||||
`EquivalentDomains` longtext CHARACTER SET utf8mb4 NULL,
|
||||
`ExcludedGlobalEquivalentDomains` longtext CHARACTER SET utf8mb4 NULL,
|
||||
`AccountRevisionDate` datetime(6) NOT NULL,
|
||||
`Key` longtext CHARACTER SET utf8mb4 NULL,
|
||||
`PublicKey` longtext CHARACTER SET utf8mb4 NULL,
|
||||
`PrivateKey` longtext CHARACTER SET utf8mb4 NULL,
|
||||
`Premium` tinyint(1) NOT NULL,
|
||||
`PremiumExpirationDate` datetime(6) NULL,
|
||||
`RenewalReminderDate` datetime(6) NULL,
|
||||
`Storage` bigint NULL,
|
||||
`MaxStorageGb` smallint NULL,
|
||||
`Gateway` tinyint unsigned NULL,
|
||||
`GatewayCustomerId` varchar(50) CHARACTER SET utf8mb4 NULL,
|
||||
`GatewaySubscriptionId` varchar(50) CHARACTER SET utf8mb4 NULL,
|
||||
`ReferenceData` longtext CHARACTER SET utf8mb4 NULL,
|
||||
`LicenseKey` varchar(100) CHARACTER SET utf8mb4 NULL,
|
||||
`ApiKey` varchar(30) CHARACTER SET utf8mb4 NOT NULL,
|
||||
`Kdf` tinyint unsigned NOT NULL,
|
||||
`KdfIterations` int NOT NULL,
|
||||
`CreationDate` datetime(6) NOT NULL,
|
||||
`RevisionDate` datetime(6) NOT NULL,
|
||||
CONSTRAINT `PK_User` PRIMARY KEY (`Id`)
|
||||
) ENGINE=InnoDB CHARACTER SET utf8mb4;
|
||||
|
||||
CREATE TABLE `Collection` (
|
||||
`Id` char(36) COLLATE ascii_general_ci NOT NULL,
|
||||
`OrganizationId` char(36) COLLATE ascii_general_ci NOT NULL,
|
||||
`Name` longtext CHARACTER SET utf8mb4 NULL,
|
||||
`ExternalId` varchar(300) CHARACTER SET utf8mb4 NULL,
|
||||
`CreationDate` datetime(6) NOT NULL,
|
||||
`RevisionDate` datetime(6) NOT NULL,
|
||||
CONSTRAINT `PK_Collection` PRIMARY KEY (`Id`),
|
||||
CONSTRAINT `FK_Collection_Organization_OrganizationId` FOREIGN KEY (`OrganizationId`) REFERENCES `Organization` (`Id`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB CHARACTER SET utf8mb4;
|
||||
|
||||
CREATE TABLE `Group` (
|
||||
`Id` char(36) COLLATE ascii_general_ci NOT NULL,
|
||||
`OrganizationId` char(36) COLLATE ascii_general_ci NOT NULL,
|
||||
`Name` varchar(100) CHARACTER SET utf8mb4 NULL,
|
||||
`AccessAll` tinyint(1) NOT NULL,
|
||||
`ExternalId` varchar(300) CHARACTER SET utf8mb4 NULL,
|
||||
`CreationDate` datetime(6) NOT NULL,
|
||||
`RevisionDate` datetime(6) NOT NULL,
|
||||
CONSTRAINT `PK_Group` PRIMARY KEY (`Id`),
|
||||
CONSTRAINT `FK_Group_Organization_OrganizationId` FOREIGN KEY (`OrganizationId`) REFERENCES `Organization` (`Id`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB CHARACTER SET utf8mb4;
|
||||
|
||||
CREATE TABLE `Policy` (
|
||||
`Id` char(36) COLLATE ascii_general_ci NOT NULL,
|
||||
`OrganizationId` char(36) COLLATE ascii_general_ci NOT NULL,
|
||||
`Type` tinyint unsigned NOT NULL,
|
||||
`Data` longtext CHARACTER SET utf8mb4 NULL,
|
||||
`Enabled` tinyint(1) NOT NULL,
|
||||
`CreationDate` datetime(6) NOT NULL,
|
||||
`RevisionDate` datetime(6) NOT NULL,
|
||||
CONSTRAINT `PK_Policy` PRIMARY KEY (`Id`),
|
||||
CONSTRAINT `FK_Policy_Organization_OrganizationId` FOREIGN KEY (`OrganizationId`) REFERENCES `Organization` (`Id`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB CHARACTER SET utf8mb4;
|
||||
|
||||
CREATE TABLE `SsoConfig` (
|
||||
`Id` bigint NOT NULL AUTO_INCREMENT,
|
||||
`Enabled` tinyint(1) NOT NULL,
|
||||
`OrganizationId` char(36) COLLATE ascii_general_ci NOT NULL,
|
||||
`Data` longtext CHARACTER SET utf8mb4 NULL,
|
||||
`CreationDate` datetime(6) NOT NULL,
|
||||
`RevisionDate` datetime(6) NOT NULL,
|
||||
CONSTRAINT `PK_SsoConfig` PRIMARY KEY (`Id`),
|
||||
CONSTRAINT `FK_SsoConfig_Organization_OrganizationId` FOREIGN KEY (`OrganizationId`) REFERENCES `Organization` (`Id`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB CHARACTER SET utf8mb4;
|
||||
|
||||
CREATE TABLE `ProviderOrganization` (
|
||||
`Id` char(36) COLLATE ascii_general_ci NOT NULL,
|
||||
`ProviderId` char(36) COLLATE ascii_general_ci NOT NULL,
|
||||
`OrganizationId` char(36) COLLATE ascii_general_ci NOT NULL,
|
||||
`Key` longtext CHARACTER SET utf8mb4 NULL,
|
||||
`Settings` longtext CHARACTER SET utf8mb4 NULL,
|
||||
`CreationDate` datetime(6) NOT NULL,
|
||||
`RevisionDate` datetime(6) NOT NULL,
|
||||
CONSTRAINT `PK_ProviderOrganization` PRIMARY KEY (`Id`),
|
||||
CONSTRAINT `FK_ProviderOrganization_Organization_OrganizationId` FOREIGN KEY (`OrganizationId`) REFERENCES `Organization` (`Id`) ON DELETE CASCADE,
|
||||
CONSTRAINT `FK_ProviderOrganization_Provider_ProviderId` FOREIGN KEY (`ProviderId`) REFERENCES `Provider` (`Id`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB CHARACTER SET utf8mb4;
|
||||
|
||||
CREATE TABLE `Cipher` (
|
||||
`Id` char(36) COLLATE ascii_general_ci NOT NULL,
|
||||
`UserId` char(36) COLLATE ascii_general_ci NULL,
|
||||
`OrganizationId` char(36) COLLATE ascii_general_ci NULL,
|
||||
`Type` tinyint unsigned NOT NULL,
|
||||
`Data` longtext CHARACTER SET utf8mb4 NULL,
|
||||
`Favorites` longtext CHARACTER SET utf8mb4 NULL,
|
||||
`Folders` longtext CHARACTER SET utf8mb4 NULL,
|
||||
`Attachments` longtext CHARACTER SET utf8mb4 NULL,
|
||||
`CreationDate` datetime(6) NOT NULL,
|
||||
`RevisionDate` datetime(6) NOT NULL,
|
||||
`DeletedDate` datetime(6) NULL,
|
||||
`Reprompt` tinyint unsigned NULL,
|
||||
CONSTRAINT `PK_Cipher` PRIMARY KEY (`Id`),
|
||||
CONSTRAINT `FK_Cipher_Organization_OrganizationId` FOREIGN KEY (`OrganizationId`) REFERENCES `Organization` (`Id`) ON DELETE RESTRICT,
|
||||
CONSTRAINT `FK_Cipher_User_UserId` FOREIGN KEY (`UserId`) REFERENCES `User` (`Id`) ON DELETE RESTRICT
|
||||
) ENGINE=InnoDB CHARACTER SET utf8mb4;
|
||||
|
||||
CREATE TABLE `Device` (
|
||||
`Id` char(36) COLLATE ascii_general_ci NOT NULL,
|
||||
`UserId` char(36) COLLATE ascii_general_ci NOT NULL,
|
||||
`Name` varchar(50) CHARACTER SET utf8mb4 NULL,
|
||||
`Type` tinyint unsigned NOT NULL,
|
||||
`Identifier` varchar(50) CHARACTER SET utf8mb4 NULL,
|
||||
`PushToken` varchar(255) CHARACTER SET utf8mb4 NULL,
|
||||
`CreationDate` datetime(6) NOT NULL,
|
||||
`RevisionDate` datetime(6) NOT NULL,
|
||||
CONSTRAINT `PK_Device` PRIMARY KEY (`Id`),
|
||||
CONSTRAINT `FK_Device_User_UserId` FOREIGN KEY (`UserId`) REFERENCES `User` (`Id`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB CHARACTER SET utf8mb4;
|
||||
|
||||
CREATE TABLE `EmergencyAccess` (
|
||||
`Id` char(36) COLLATE ascii_general_ci NOT NULL,
|
||||
`GrantorId` char(36) COLLATE ascii_general_ci NOT NULL,
|
||||
`GranteeId` char(36) COLLATE ascii_general_ci NULL,
|
||||
`Email` varchar(256) CHARACTER SET utf8mb4 NULL,
|
||||
`KeyEncrypted` longtext CHARACTER SET utf8mb4 NULL,
|
||||
`Type` tinyint unsigned NOT NULL,
|
||||
`Status` tinyint unsigned NOT NULL,
|
||||
`WaitTimeDays` int NOT NULL,
|
||||
`RecoveryInitiatedDate` datetime(6) NULL,
|
||||
`LastNotificationDate` datetime(6) NULL,
|
||||
`CreationDate` datetime(6) NOT NULL,
|
||||
`RevisionDate` datetime(6) NOT NULL,
|
||||
CONSTRAINT `PK_EmergencyAccess` PRIMARY KEY (`Id`),
|
||||
CONSTRAINT `FK_EmergencyAccess_User_GranteeId` FOREIGN KEY (`GranteeId`) REFERENCES `User` (`Id`) ON DELETE RESTRICT,
|
||||
CONSTRAINT `FK_EmergencyAccess_User_GrantorId` FOREIGN KEY (`GrantorId`) REFERENCES `User` (`Id`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB CHARACTER SET utf8mb4;
|
||||
|
||||
CREATE TABLE `Folder` (
|
||||
`Id` char(36) COLLATE ascii_general_ci NOT NULL,
|
||||
`UserId` 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_Folder` PRIMARY KEY (`Id`),
|
||||
CONSTRAINT `FK_Folder_User_UserId` FOREIGN KEY (`UserId`) REFERENCES `User` (`Id`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB CHARACTER SET utf8mb4;
|
||||
|
||||
CREATE TABLE `OrganizationUser` (
|
||||
`Id` char(36) COLLATE ascii_general_ci NOT NULL,
|
||||
`OrganizationId` char(36) COLLATE ascii_general_ci NOT NULL,
|
||||
`UserId` char(36) COLLATE ascii_general_ci NULL,
|
||||
`Email` varchar(256) CHARACTER SET utf8mb4 NULL,
|
||||
`Key` longtext CHARACTER SET utf8mb4 NULL,
|
||||
`ResetPasswordKey` longtext CHARACTER SET utf8mb4 NULL,
|
||||
`Status` tinyint unsigned NOT NULL,
|
||||
`Type` tinyint unsigned NOT NULL,
|
||||
`AccessAll` tinyint(1) NOT NULL,
|
||||
`ExternalId` varchar(300) CHARACTER SET utf8mb4 NULL,
|
||||
`CreationDate` datetime(6) NOT NULL,
|
||||
`RevisionDate` datetime(6) NOT NULL,
|
||||
`Permissions` longtext CHARACTER SET utf8mb4 NULL,
|
||||
CONSTRAINT `PK_OrganizationUser` PRIMARY KEY (`Id`),
|
||||
CONSTRAINT `FK_OrganizationUser_Organization_OrganizationId` FOREIGN KEY (`OrganizationId`) REFERENCES `Organization` (`Id`) ON DELETE CASCADE,
|
||||
CONSTRAINT `FK_OrganizationUser_User_UserId` FOREIGN KEY (`UserId`) REFERENCES `User` (`Id`) ON DELETE RESTRICT
|
||||
) ENGINE=InnoDB CHARACTER SET utf8mb4;
|
||||
|
||||
CREATE TABLE `ProviderUser` (
|
||||
`Id` char(36) COLLATE ascii_general_ci NOT NULL,
|
||||
`ProviderId` char(36) COLLATE ascii_general_ci NOT NULL,
|
||||
`UserId` char(36) COLLATE ascii_general_ci NULL,
|
||||
`Email` longtext CHARACTER SET utf8mb4 NULL,
|
||||
`Key` longtext CHARACTER SET utf8mb4 NULL,
|
||||
`Status` tinyint unsigned NOT NULL,
|
||||
`Type` tinyint unsigned NOT NULL,
|
||||
`Permissions` longtext CHARACTER SET utf8mb4 NULL,
|
||||
`CreationDate` datetime(6) NOT NULL,
|
||||
`RevisionDate` datetime(6) NOT NULL,
|
||||
CONSTRAINT `PK_ProviderUser` PRIMARY KEY (`Id`),
|
||||
CONSTRAINT `FK_ProviderUser_Provider_ProviderId` FOREIGN KEY (`ProviderId`) REFERENCES `Provider` (`Id`) ON DELETE CASCADE,
|
||||
CONSTRAINT `FK_ProviderUser_User_UserId` FOREIGN KEY (`UserId`) REFERENCES `User` (`Id`) ON DELETE RESTRICT
|
||||
) ENGINE=InnoDB CHARACTER SET utf8mb4;
|
||||
|
||||
CREATE TABLE `Send` (
|
||||
`Id` char(36) COLLATE ascii_general_ci NOT NULL,
|
||||
`UserId` char(36) COLLATE ascii_general_ci NULL,
|
||||
`OrganizationId` char(36) COLLATE ascii_general_ci NULL,
|
||||
`Type` tinyint unsigned NOT NULL,
|
||||
`Data` longtext CHARACTER SET utf8mb4 NULL,
|
||||
`Key` longtext CHARACTER SET utf8mb4 NULL,
|
||||
`Password` varchar(300) CHARACTER SET utf8mb4 NULL,
|
||||
`MaxAccessCount` int NULL,
|
||||
`AccessCount` int NOT NULL,
|
||||
`CreationDate` datetime(6) NOT NULL,
|
||||
`RevisionDate` datetime(6) NOT NULL,
|
||||
`ExpirationDate` datetime(6) NULL,
|
||||
`DeletionDate` datetime(6) NOT NULL,
|
||||
`Disabled` tinyint(1) NOT NULL,
|
||||
`HideEmail` tinyint(1) NULL,
|
||||
CONSTRAINT `PK_Send` PRIMARY KEY (`Id`),
|
||||
CONSTRAINT `FK_Send_Organization_OrganizationId` FOREIGN KEY (`OrganizationId`) REFERENCES `Organization` (`Id`) ON DELETE RESTRICT,
|
||||
CONSTRAINT `FK_Send_User_UserId` FOREIGN KEY (`UserId`) REFERENCES `User` (`Id`) ON DELETE RESTRICT
|
||||
) ENGINE=InnoDB CHARACTER SET utf8mb4;
|
||||
|
||||
CREATE TABLE `SsoUser` (
|
||||
`Id` bigint NOT NULL AUTO_INCREMENT,
|
||||
`UserId` char(36) COLLATE ascii_general_ci NOT NULL,
|
||||
`OrganizationId` char(36) COLLATE ascii_general_ci NULL,
|
||||
`ExternalId` varchar(50) CHARACTER SET utf8mb4 NULL,
|
||||
`CreationDate` datetime(6) NOT NULL,
|
||||
CONSTRAINT `PK_SsoUser` PRIMARY KEY (`Id`),
|
||||
CONSTRAINT `FK_SsoUser_Organization_OrganizationId` FOREIGN KEY (`OrganizationId`) REFERENCES `Organization` (`Id`) ON DELETE RESTRICT,
|
||||
CONSTRAINT `FK_SsoUser_User_UserId` FOREIGN KEY (`UserId`) REFERENCES `User` (`Id`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB CHARACTER SET utf8mb4;
|
||||
|
||||
CREATE TABLE `Transaction` (
|
||||
`Id` char(36) COLLATE ascii_general_ci NOT NULL,
|
||||
`UserId` char(36) COLLATE ascii_general_ci NULL,
|
||||
`OrganizationId` char(36) COLLATE ascii_general_ci NULL,
|
||||
`Type` tinyint unsigned NOT NULL,
|
||||
`Amount` decimal(65,30) NOT NULL,
|
||||
`Refunded` tinyint(1) NULL,
|
||||
`RefundedAmount` decimal(65,30) NULL,
|
||||
`Details` varchar(100) CHARACTER SET utf8mb4 NULL,
|
||||
`PaymentMethodType` tinyint unsigned NULL,
|
||||
`Gateway` tinyint unsigned NULL,
|
||||
`GatewayId` varchar(50) CHARACTER SET utf8mb4 NULL,
|
||||
`CreationDate` datetime(6) NOT NULL,
|
||||
CONSTRAINT `PK_Transaction` PRIMARY KEY (`Id`),
|
||||
CONSTRAINT `FK_Transaction_Organization_OrganizationId` FOREIGN KEY (`OrganizationId`) REFERENCES `Organization` (`Id`) ON DELETE RESTRICT,
|
||||
CONSTRAINT `FK_Transaction_User_UserId` FOREIGN KEY (`UserId`) REFERENCES `User` (`Id`) ON DELETE RESTRICT
|
||||
) ENGINE=InnoDB CHARACTER SET utf8mb4;
|
||||
|
||||
CREATE TABLE `U2f` (
|
||||
`Id` int NOT NULL AUTO_INCREMENT,
|
||||
`UserId` char(36) COLLATE ascii_general_ci NOT NULL,
|
||||
`KeyHandle` varchar(200) CHARACTER SET utf8mb4 NULL,
|
||||
`Challenge` varchar(200) CHARACTER SET utf8mb4 NULL,
|
||||
`AppId` varchar(50) CHARACTER SET utf8mb4 NULL,
|
||||
`Version` varchar(20) CHARACTER SET utf8mb4 NULL,
|
||||
`CreationDate` datetime(6) NOT NULL,
|
||||
CONSTRAINT `PK_U2f` PRIMARY KEY (`Id`),
|
||||
CONSTRAINT `FK_U2f_User_UserId` FOREIGN KEY (`UserId`) REFERENCES `User` (`Id`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB CHARACTER SET utf8mb4;
|
||||
|
||||
CREATE TABLE `CollectionGroups` (
|
||||
`CollectionId` char(36) COLLATE ascii_general_ci NOT NULL,
|
||||
`GroupId` char(36) COLLATE ascii_general_ci NOT NULL,
|
||||
`ReadOnly` tinyint(1) NOT NULL,
|
||||
`HidePasswords` tinyint(1) NOT NULL,
|
||||
CONSTRAINT `PK_CollectionGroups` PRIMARY KEY (`CollectionId`, `GroupId`),
|
||||
CONSTRAINT `FK_CollectionGroups_Collection_CollectionId` FOREIGN KEY (`CollectionId`) REFERENCES `Collection` (`Id`) ON DELETE CASCADE,
|
||||
CONSTRAINT `FK_CollectionGroups_Group_GroupId` FOREIGN KEY (`GroupId`) REFERENCES `Group` (`Id`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB CHARACTER SET utf8mb4;
|
||||
|
||||
CREATE TABLE `CollectionCipher` (
|
||||
`CollectionId` char(36) COLLATE ascii_general_ci NOT NULL,
|
||||
`CipherId` char(36) COLLATE ascii_general_ci NOT NULL,
|
||||
CONSTRAINT `PK_CollectionCipher` PRIMARY KEY (`CollectionId`, `CipherId`),
|
||||
CONSTRAINT `FK_CollectionCipher_Cipher_CipherId` FOREIGN KEY (`CipherId`) REFERENCES `Cipher` (`Id`) ON DELETE CASCADE,
|
||||
CONSTRAINT `FK_CollectionCipher_Collection_CollectionId` FOREIGN KEY (`CollectionId`) REFERENCES `Collection` (`Id`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB CHARACTER SET utf8mb4;
|
||||
|
||||
CREATE TABLE `CollectionUsers` (
|
||||
`CollectionId` char(36) COLLATE ascii_general_ci NOT NULL,
|
||||
`OrganizationUserId` char(36) COLLATE ascii_general_ci NOT NULL,
|
||||
`UserId` char(36) COLLATE ascii_general_ci NULL,
|
||||
`ReadOnly` tinyint(1) NOT NULL,
|
||||
`HidePasswords` tinyint(1) NOT NULL,
|
||||
CONSTRAINT `PK_CollectionUsers` PRIMARY KEY (`CollectionId`, `OrganizationUserId`),
|
||||
CONSTRAINT `FK_CollectionUsers_Collection_CollectionId` FOREIGN KEY (`CollectionId`) REFERENCES `Collection` (`Id`) ON DELETE CASCADE,
|
||||
CONSTRAINT `FK_CollectionUsers_OrganizationUser_OrganizationUserId` FOREIGN KEY (`OrganizationUserId`) REFERENCES `OrganizationUser` (`Id`) ON DELETE CASCADE,
|
||||
CONSTRAINT `FK_CollectionUsers_User_UserId` FOREIGN KEY (`UserId`) REFERENCES `User` (`Id`) ON DELETE RESTRICT
|
||||
) ENGINE=InnoDB CHARACTER SET utf8mb4;
|
||||
|
||||
CREATE TABLE `GroupUser` (
|
||||
`GroupId` char(36) COLLATE ascii_general_ci NOT NULL,
|
||||
`OrganizationUserId` char(36) COLLATE ascii_general_ci NOT NULL,
|
||||
`UserId` char(36) COLLATE ascii_general_ci NULL,
|
||||
CONSTRAINT `PK_GroupUser` PRIMARY KEY (`GroupId`, `OrganizationUserId`),
|
||||
CONSTRAINT `FK_GroupUser_Group_GroupId` FOREIGN KEY (`GroupId`) REFERENCES `Group` (`Id`) ON DELETE CASCADE,
|
||||
CONSTRAINT `FK_GroupUser_OrganizationUser_OrganizationUserId` FOREIGN KEY (`OrganizationUserId`) REFERENCES `OrganizationUser` (`Id`) ON DELETE CASCADE,
|
||||
CONSTRAINT `FK_GroupUser_User_UserId` FOREIGN KEY (`UserId`) REFERENCES `User` (`Id`) ON DELETE RESTRICT
|
||||
) ENGINE=InnoDB CHARACTER SET utf8mb4;
|
||||
|
||||
CREATE TABLE `ProviderOrganizationProviderUser` (
|
||||
`Id` char(36) COLLATE ascii_general_ci NOT NULL,
|
||||
`ProviderOrganizationId` char(36) COLLATE ascii_general_ci NOT NULL,
|
||||
`ProviderUserId` char(36) COLLATE ascii_general_ci NOT NULL,
|
||||
`Type` tinyint unsigned NOT NULL,
|
||||
`Permissions` longtext CHARACTER SET utf8mb4 NULL,
|
||||
`CreationDate` datetime(6) NOT NULL,
|
||||
`RevisionDate` datetime(6) NOT NULL,
|
||||
CONSTRAINT `PK_ProviderOrganizationProviderUser` PRIMARY KEY (`Id`),
|
||||
CONSTRAINT `FK_ProviderOrganizationProviderUser_ProviderOrganization_Provid~` FOREIGN KEY (`ProviderOrganizationId`) REFERENCES `ProviderOrganization` (`Id`) ON DELETE CASCADE,
|
||||
CONSTRAINT `FK_ProviderOrganizationProviderUser_ProviderUser_ProviderUserId` FOREIGN KEY (`ProviderUserId`) REFERENCES `ProviderUser` (`Id`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB CHARACTER SET utf8mb4;
|
||||
|
||||
CREATE INDEX `IX_Cipher_OrganizationId` ON `Cipher` (`OrganizationId`);
|
||||
|
||||
CREATE INDEX `IX_Cipher_UserId` ON `Cipher` (`UserId`);
|
||||
|
||||
CREATE INDEX `IX_Collection_OrganizationId` ON `Collection` (`OrganizationId`);
|
||||
|
||||
CREATE INDEX `IX_CollectionCipher_CipherId` ON `CollectionCipher` (`CipherId`);
|
||||
|
||||
CREATE INDEX `IX_CollectionGroups_GroupId` ON `CollectionGroups` (`GroupId`);
|
||||
|
||||
CREATE INDEX `IX_CollectionUsers_OrganizationUserId` ON `CollectionUsers` (`OrganizationUserId`);
|
||||
|
||||
CREATE INDEX `IX_CollectionUsers_UserId` ON `CollectionUsers` (`UserId`);
|
||||
|
||||
CREATE INDEX `IX_Device_UserId` ON `Device` (`UserId`);
|
||||
|
||||
CREATE INDEX `IX_EmergencyAccess_GranteeId` ON `EmergencyAccess` (`GranteeId`);
|
||||
|
||||
CREATE INDEX `IX_EmergencyAccess_GrantorId` ON `EmergencyAccess` (`GrantorId`);
|
||||
|
||||
CREATE INDEX `IX_Folder_UserId` ON `Folder` (`UserId`);
|
||||
|
||||
CREATE INDEX `IX_Group_OrganizationId` ON `Group` (`OrganizationId`);
|
||||
|
||||
CREATE INDEX `IX_GroupUser_OrganizationUserId` ON `GroupUser` (`OrganizationUserId`);
|
||||
|
||||
CREATE INDEX `IX_GroupUser_UserId` ON `GroupUser` (`UserId`);
|
||||
|
||||
CREATE INDEX `IX_OrganizationUser_OrganizationId` ON `OrganizationUser` (`OrganizationId`);
|
||||
|
||||
CREATE INDEX `IX_OrganizationUser_UserId` ON `OrganizationUser` (`UserId`);
|
||||
|
||||
CREATE INDEX `IX_Policy_OrganizationId` ON `Policy` (`OrganizationId`);
|
||||
|
||||
CREATE INDEX `IX_ProviderOrganization_OrganizationId` ON `ProviderOrganization` (`OrganizationId`);
|
||||
|
||||
CREATE INDEX `IX_ProviderOrganization_ProviderId` ON `ProviderOrganization` (`ProviderId`);
|
||||
|
||||
CREATE INDEX `IX_ProviderOrganizationProviderUser_ProviderOrganizationId` ON `ProviderOrganizationProviderUser` (`ProviderOrganizationId`);
|
||||
|
||||
CREATE INDEX `IX_ProviderOrganizationProviderUser_ProviderUserId` ON `ProviderOrganizationProviderUser` (`ProviderUserId`);
|
||||
|
||||
CREATE INDEX `IX_ProviderUser_ProviderId` ON `ProviderUser` (`ProviderId`);
|
||||
|
||||
CREATE INDEX `IX_ProviderUser_UserId` ON `ProviderUser` (`UserId`);
|
||||
|
||||
CREATE INDEX `IX_Send_OrganizationId` ON `Send` (`OrganizationId`);
|
||||
|
||||
CREATE INDEX `IX_Send_UserId` ON `Send` (`UserId`);
|
||||
|
||||
CREATE INDEX `IX_SsoConfig_OrganizationId` ON `SsoConfig` (`OrganizationId`);
|
||||
|
||||
CREATE INDEX `IX_SsoUser_OrganizationId` ON `SsoUser` (`OrganizationId`);
|
||||
|
||||
CREATE INDEX `IX_SsoUser_UserId` ON `SsoUser` (`UserId`);
|
||||
|
||||
CREATE INDEX `IX_Transaction_OrganizationId` ON `Transaction` (`OrganizationId`);
|
||||
|
||||
CREATE INDEX `IX_Transaction_UserId` ON `Transaction` (`UserId`);
|
||||
|
||||
CREATE INDEX `IX_U2f_UserId` ON `U2f` (`UserId`);
|
||||
|
||||
INSERT INTO `__EFMigrationsHistory` (`MigrationId`, `ProductVersion`)
|
||||
VALUES ('20210617183900_Init', '5.0.5');
|
||||
|
||||
COMMIT;
|
@ -1,14 +0,0 @@
|
||||
START TRANSACTION;
|
||||
|
||||
DROP TABLE `ProviderOrganizationProviderUser`;
|
||||
|
||||
ALTER TABLE `Provider` ADD `UseEvents` tinyint(1) NOT NULL DEFAULT FALSE;
|
||||
|
||||
ALTER TABLE `Event` ADD `ProviderId` char(36) COLLATE ascii_general_ci NULL;
|
||||
|
||||
ALTER TABLE `Event` ADD `ProviderUserId` char(36) COLLATE ascii_general_ci NULL;
|
||||
|
||||
INSERT INTO `__EFMigrationsHistory` (`MigrationId`, `ProductVersion`)
|
||||
VALUES ('20210709095522_RemoveProviderOrganizationProviderUser', '5.0.5');
|
||||
|
||||
COMMIT;
|
@ -1,8 +0,0 @@
|
||||
START TRANSACTION;
|
||||
|
||||
ALTER TABLE `User` ADD `ForcePasswordReset` tinyint(1) NOT NULL DEFAULT FALSE;
|
||||
|
||||
INSERT INTO `__EFMigrationsHistory` (`MigrationId`, `ProductVersion`)
|
||||
VALUES ('20210716142145_UserForcePasswordReset', '5.0.5');
|
||||
|
||||
COMMIT;
|
@ -1,12 +0,0 @@
|
||||
START TRANSACTION;
|
||||
|
||||
ALTER TABLE `Organization` ADD `MaxAutoscaleSeats` int NULL;
|
||||
|
||||
ALTER TABLE `Organization` ADD `OwnersNotifiedOfAutoscaling` datetime(6) NULL;
|
||||
|
||||
ALTER TABLE `Event` ADD `ProviderOrganizationId` char(36) COLLATE ascii_general_ci NULL;
|
||||
|
||||
INSERT INTO `__EFMigrationsHistory` (`MigrationId`, `ProductVersion`)
|
||||
VALUES ('20210921132418_AddMaxAutoscaleSeatsToOrganization', '5.0.9');
|
||||
|
||||
COMMIT;
|
@ -1,33 +0,0 @@
|
||||
START TRANSACTION;
|
||||
|
||||
ALTER TABLE `User` ADD `UsesCryptoAgent` tinyint(1) NOT NULL DEFAULT FALSE;
|
||||
|
||||
CREATE TABLE `OrganizationSponsorship` (
|
||||
`Id` char(36) COLLATE ascii_general_ci NOT NULL,
|
||||
`InstallationId` char(36) COLLATE ascii_general_ci NULL,
|
||||
`SponsoringOrganizationId` char(36) COLLATE ascii_general_ci NULL,
|
||||
`SponsoringOrganizationUserId` char(36) COLLATE ascii_general_ci NULL,
|
||||
`SponsoredOrganizationId` char(36) COLLATE ascii_general_ci NULL,
|
||||
`FriendlyName` varchar(256) CHARACTER SET utf8mb4 NULL,
|
||||
`OfferedToEmail` varchar(256) CHARACTER SET utf8mb4 NULL,
|
||||
`PlanSponsorshipType` tinyint unsigned NULL,
|
||||
`CloudSponsor` tinyint(1) NOT NULL,
|
||||
`LastSyncDate` datetime(6) NULL,
|
||||
`TimesRenewedWithoutValidation` tinyint unsigned NOT NULL,
|
||||
`SponsorshipLapsedDate` datetime(6) NULL,
|
||||
CONSTRAINT `PK_OrganizationSponsorship` PRIMARY KEY (`Id`),
|
||||
CONSTRAINT `FK_OrganizationSponsorship_Installation_InstallationId` FOREIGN KEY (`InstallationId`) REFERENCES `Installation` (`Id`) ON DELETE RESTRICT,
|
||||
CONSTRAINT `FK_OrganizationSponsorship_Organization_SponsoredOrganizationId` FOREIGN KEY (`SponsoredOrganizationId`) REFERENCES `Organization` (`Id`) ON DELETE RESTRICT,
|
||||
CONSTRAINT `FK_OrganizationSponsorship_Organization_SponsoringOrganizationId` FOREIGN KEY (`SponsoringOrganizationId`) REFERENCES `Organization` (`Id`) ON DELETE RESTRICT
|
||||
) CHARACTER SET utf8mb4;
|
||||
|
||||
CREATE INDEX `IX_OrganizationSponsorship_InstallationId` ON `OrganizationSponsorship` (`InstallationId`);
|
||||
|
||||
CREATE INDEX `IX_OrganizationSponsorship_SponsoredOrganizationId` ON `OrganizationSponsorship` (`SponsoredOrganizationId`);
|
||||
|
||||
CREATE INDEX `IX_OrganizationSponsorship_SponsoringOrganizationId` ON `OrganizationSponsorship` (`SponsoringOrganizationId`);
|
||||
|
||||
INSERT INTO `__EFMigrationsHistory` (`MigrationId`, `ProductVersion`)
|
||||
VALUES ('20211108225243_OrganizationSponsorship', '5.0.9');
|
||||
|
||||
COMMIT;
|
@ -1,9 +0,0 @@
|
||||
START TRANSACTION;
|
||||
|
||||
ALTER TABLE `User` ADD `UsesKeyConnector` tinyint(1) NOT NULL DEFAULT FALSE;
|
||||
|
||||
INSERT INTO `__EFMigrationsHistory` (`MigrationId`, `ProductVersion`)
|
||||
VALUES ('20211108041911_KeyConnector', '5.0.9');
|
||||
|
||||
COMMIT;
|
||||
|
Binary file not shown.
Binary file not shown.
@ -1,10 +0,0 @@
|
||||
START TRANSACTION;
|
||||
|
||||
ALTER TABLE `User` ADD `FailedLoginCount` int NOT NULL DEFAULT 0;
|
||||
|
||||
ALTER TABLE `User` ADD `LastFailedLoginDate` datetime(6) NULL;
|
||||
|
||||
INSERT INTO `__EFMigrationsHistory` (`MigrationId`, `ProductVersion`)
|
||||
VALUES ('20220301215315_FailedLoginCaptcha', '5.0.12');
|
||||
|
||||
COMMIT;
|
@ -1,50 +0,0 @@
|
||||
START TRANSACTION;
|
||||
|
||||
ALTER TABLE `OrganizationSponsorship` DROP FOREIGN KEY `FK_OrganizationSponsorship_Installation_InstallationId`;
|
||||
|
||||
ALTER TABLE `OrganizationSponsorship` DROP INDEX `IX_OrganizationSponsorship_InstallationId`;
|
||||
|
||||
ALTER TABLE `OrganizationSponsorship` DROP COLUMN `InstallationId`;
|
||||
|
||||
ALTER TABLE `OrganizationSponsorship` DROP COLUMN `TimesRenewedWithoutValidation`;
|
||||
|
||||
CREATE TABLE `OrganizationApiKey` (
|
||||
`Id` char(36) COLLATE ascii_general_ci NOT NULL,
|
||||
`OrganizationId` char(36) COLLATE ascii_general_ci NOT NULL,
|
||||
`Type` tinyint unsigned NOT NULL,
|
||||
`ApiKey` varchar(30) CHARACTER SET utf8mb4 NULL,
|
||||
`RevisionDate` datetime(6) NOT NULL,
|
||||
CONSTRAINT `PK_OrganizationApiKey` PRIMARY KEY (`Id`),
|
||||
CONSTRAINT `FK_OrganizationApiKey_Organization_OrganizationId` FOREIGN KEY (`OrganizationId`) REFERENCES `Organization` (`Id`) ON DELETE CASCADE
|
||||
) CHARACTER SET utf8mb4;
|
||||
|
||||
INSERT INTO OrganizationApiKey(Id, OrganizationId, Type, ApiKey, RevisionDate)
|
||||
SELECT UUID(), Id, 0, ApiKey, RevisionDate
|
||||
FROM Organization;
|
||||
|
||||
|
||||
ALTER TABLE `Organization` DROP COLUMN `ApiKey`;
|
||||
|
||||
ALTER TABLE `OrganizationSponsorship` RENAME COLUMN `SponsorshipLapsedDate` TO `ValidUntil`;
|
||||
|
||||
ALTER TABLE `OrganizationSponsorship` RENAME COLUMN `CloudSponsor` TO `ToDelete`;
|
||||
|
||||
CREATE TABLE `OrganizationConnection` (
|
||||
`Id` char(36) COLLATE ascii_general_ci NOT NULL,
|
||||
`Type` tinyint unsigned NOT NULL,
|
||||
`OrganizationId` char(36) COLLATE ascii_general_ci NOT NULL,
|
||||
`Enabled` tinyint(1) NOT NULL,
|
||||
`Config` longtext CHARACTER SET utf8mb4 NULL,
|
||||
CONSTRAINT `PK_OrganizationConnection` PRIMARY KEY (`Id`),
|
||||
CONSTRAINT `FK_OrganizationConnection_Organization_OrganizationId` FOREIGN KEY (`OrganizationId`) REFERENCES `Organization` (`Id`) ON DELETE CASCADE
|
||||
) CHARACTER SET utf8mb4;
|
||||
|
||||
CREATE INDEX `IX_OrganizationApiKey_OrganizationId` ON `OrganizationApiKey` (`OrganizationId`);
|
||||
|
||||
CREATE INDEX `IX_OrganizationConnection_OrganizationId` ON `OrganizationConnection` (`OrganizationId`);
|
||||
|
||||
INSERT INTO `__EFMigrationsHistory` (`MigrationId`, `ProductVersion`)
|
||||
VALUES ('20220322191314_SelfHostF4E', '5.0.12');
|
||||
|
||||
COMMIT;
|
||||
|
@ -1,14 +0,0 @@
|
||||
START TRANSACTION;
|
||||
|
||||
ALTER TABLE `OrganizationSponsorship` DROP FOREIGN KEY `FK_OrganizationSponsorship_Organization_SponsoringOrganizationId`;
|
||||
|
||||
ALTER TABLE `OrganizationSponsorship` MODIFY COLUMN `SponsoringOrganizationUserId` char(36) COLLATE ascii_general_ci NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000';
|
||||
|
||||
ALTER TABLE `OrganizationSponsorship` MODIFY COLUMN `SponsoringOrganizationId` char(36) COLLATE ascii_general_ci NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000';
|
||||
|
||||
ALTER TABLE `OrganizationSponsorship` ADD CONSTRAINT `FK_OrganizationSponsorship_Organization_SponsoringOrganizationId` FOREIGN KEY (`SponsoringOrganizationId`) REFERENCES `Organization` (`Id`) ON DELETE CASCADE;
|
||||
|
||||
INSERT INTO `__EFMigrationsHistory` (`MigrationId`, `ProductVersion`)
|
||||
VALUES ('20220411191518_SponsorshipBulkActions', '5.0.12');
|
||||
|
||||
COMMIT;
|
@ -1,14 +0,0 @@
|
||||
START TRANSACTION;
|
||||
|
||||
ALTER TABLE `OrganizationSponsorship` DROP FOREIGN KEY `FK_OrganizationSponsorship_Organization_SponsoringOrganizationId`;
|
||||
|
||||
ALTER TABLE `OrganizationSponsorship` MODIFY COLUMN `SponsoringOrganizationId` char(36) COLLATE ascii_general_ci NULL;
|
||||
|
||||
ALTER TABLE `Event` ADD `InstallationId` char(36) COLLATE ascii_general_ci NULL;
|
||||
|
||||
ALTER TABLE `OrganizationSponsorship` ADD CONSTRAINT `FK_OrganizationSponsorship_Organization_SponsoringOrganizationId` FOREIGN KEY (`SponsoringOrganizationId`) REFERENCES `Organization` (`Id`) ON DELETE RESTRICT;
|
||||
|
||||
INSERT INTO `__EFMigrationsHistory` (`MigrationId`, `ProductVersion`)
|
||||
VALUES ('20220420170738_AddInstallationIdToEvents', '5.0.12');
|
||||
|
||||
COMMIT;
|
@ -1,8 +0,0 @@
|
||||
START TRANSACTION;
|
||||
|
||||
ALTER TABLE `User` ADD `UnknownDeviceVerificationEnabled` tinyint(1) NOT NULL DEFAULT 1;
|
||||
|
||||
INSERT INTO `__EFMigrationsHistory` (`MigrationId`, `ProductVersion`)
|
||||
VALUES ('20220524171600_DeviceUnknownVerification', '5.0.12');
|
||||
|
||||
COMMIT;
|
@ -1,8 +0,0 @@
|
||||
START TRANSACTION;
|
||||
|
||||
ALTER TABLE `OrganizationUser` MODIFY COLUMN `Status` smallint NOT NULL;
|
||||
|
||||
INSERT INTO `__EFMigrationsHistory` (`MigrationId`, `ProductVersion`)
|
||||
VALUES ('20220608191914_DeactivatedUserStatus', '5.0.12');
|
||||
|
||||
COMMIT;
|
@ -1,17 +0,0 @@
|
||||
START TRANSACTION;
|
||||
|
||||
ALTER TABLE `OrganizationUser` MODIFY COLUMN `Status` smallint NOT NULL;
|
||||
|
||||
INSERT INTO `__EFMigrationsHistory` (`MigrationId`, `ProductVersion`)
|
||||
VALUES ('20220608191914_DeactivatedUserStatus', '6.0.4');
|
||||
|
||||
COMMIT;
|
||||
|
||||
START TRANSACTION;
|
||||
|
||||
ALTER TABLE `Organization` ADD `UseScim` tinyint(1) NOT NULL DEFAULT FALSE;
|
||||
|
||||
INSERT INTO `__EFMigrationsHistory` (`MigrationId`, `ProductVersion`)
|
||||
VALUES ('20220707163017_UseScimFlag', '6.0.4');
|
||||
|
||||
COMMIT;
|
@ -1,31 +0,0 @@
|
||||
START TRANSACTION;
|
||||
|
||||
CREATE TABLE `AuthRequest` (
|
||||
`Id` char(36) COLLATE ascii_general_ci NOT NULL,
|
||||
`UserId` char(36) COLLATE ascii_general_ci NOT NULL,
|
||||
`Type` tinyint unsigned NOT NULL,
|
||||
`RequestDeviceIdentifier` varchar(50) CHARACTER SET utf8mb4 NULL,
|
||||
`RequestDeviceType` tinyint unsigned NOT NULL,
|
||||
`RequestIpAddress` varchar(50) CHARACTER SET utf8mb4 NULL,
|
||||
`RequestFingerprint` longtext CHARACTER SET utf8mb4 NULL,
|
||||
`ResponseDeviceId` char(36) COLLATE ascii_general_ci NULL,
|
||||
`AccessCode` varchar(25) CHARACTER SET utf8mb4 NULL,
|
||||
`PublicKey` longtext CHARACTER SET utf8mb4 NULL,
|
||||
`Key` longtext CHARACTER SET utf8mb4 NULL,
|
||||
`MasterPasswordHash` longtext CHARACTER SET utf8mb4 NULL,
|
||||
`CreationDate` datetime(6) NOT NULL,
|
||||
`ResponseDate` datetime(6) NULL,
|
||||
`AuthenticationDate` datetime(6) NULL,
|
||||
CONSTRAINT `PK_AuthRequest` PRIMARY KEY (`Id`),
|
||||
CONSTRAINT `FK_AuthRequest_Device_ResponseDeviceId` FOREIGN KEY (`ResponseDeviceId`) REFERENCES `Device` (`Id`),
|
||||
CONSTRAINT `FK_AuthRequest_User_UserId` FOREIGN KEY (`UserId`) REFERENCES `User` (`Id`) ON DELETE CASCADE
|
||||
) CHARACTER SET=utf8mb4;
|
||||
|
||||
CREATE INDEX `IX_AuthRequest_ResponseDeviceId` ON `AuthRequest` (`ResponseDeviceId`);
|
||||
|
||||
CREATE INDEX `IX_AuthRequest_UserId` ON `AuthRequest` (`UserId`);
|
||||
|
||||
INSERT INTO `__EFMigrationsHistory` (`MigrationId`, `ProductVersion`)
|
||||
VALUES ('20220912144222_PasswordlessAuthRequests', '6.0.4');
|
||||
|
||||
COMMIT;
|
@ -1,8 +0,0 @@
|
||||
START TRANSACTION;
|
||||
|
||||
ALTER TABLE `Event` ADD `SystemUser` tinyint unsigned NULL;
|
||||
|
||||
INSERT INTO `__EFMigrationsHistory` (`MigrationId`, `ProductVersion`)
|
||||
VALUES ('20220927142038_EventsSystemUser', '6.0.4');
|
||||
|
||||
COMMIT;
|
@ -1,8 +0,0 @@
|
||||
START TRANSACTION;
|
||||
|
||||
ALTER TABLE `Organization` ADD `UseCustomPermissions` tinyint(1) NOT NULL DEFAULT FALSE;
|
||||
|
||||
INSERT INTO `__EFMigrationsHistory` (`MigrationId`, `ProductVersion`)
|
||||
VALUES ('20221020154432_UseCustomPermissionsFlag', '6.0.4');
|
||||
|
||||
COMMIT;
|
@ -1,8 +0,0 @@
|
||||
START TRANSACTION;
|
||||
|
||||
ALTER TABLE `AuthRequest` ADD `Approved` tinyint(1) NULL;
|
||||
|
||||
INSERT INTO `__EFMigrationsHistory` (`MigrationId`, `ProductVersion`)
|
||||
VALUES ('20221024210500_PasswordlessAuthRequestAddApprovedColumn', '6.0.4');
|
||||
|
||||
COMMIT;
|
@ -1,9 +0,0 @@
|
||||
START TRANSACTION;
|
||||
|
||||
ALTER TABLE `User` ADD `AvatarColor` varchar(7) CHARACTER SET utf8mb4 NULL;
|
||||
|
||||
INSERT INTO `__EFMigrationsHistory` (`MigrationId`, `ProductVersion`)
|
||||
VALUES ('20221115030843_AvatarColor', '6.0.4');
|
||||
|
||||
COMMIT;
|
||||
|
@ -6,7 +6,7 @@ namespace Bit.PostgresMigrations.Migrations;
|
||||
public partial class SplitManageCollectionsPermissions2 : Migration
|
||||
{
|
||||
private const string _scriptLocation =
|
||||
"PostgresMigrations.Scripts.2021-09-21_01_SplitManageCollectionsPermission.psql";
|
||||
"PostgresMigrations.HelperScripts.2021-09-21_01_SplitManageCollectionsPermission.psql";
|
||||
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
@ -6,7 +6,7 @@ namespace Bit.PostgresMigrations.Migrations;
|
||||
public partial class SetMaxAutoscaleSeatsToCurrentSeatCount : Migration
|
||||
{
|
||||
private const string _scriptLocation =
|
||||
"PostgresMigrations.Scripts.2021-10-21_00_SetMaxAutoscaleSeatCount.psql";
|
||||
"PostgresMigrations.HelperScripts.2021-10-21_00_SetMaxAutoscaleSeatCount.psql";
|
||||
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
@ -15,14 +15,13 @@
|
||||
<ItemGroup>
|
||||
<Compile Include="..\EfShared\MigrationBuilderExtensions.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="Scripts\2021-09-21_01_SplitManageCollectionsPermission.psql" />
|
||||
<None Remove="Scripts\2021-10-21_00_SetMaxAutoscaleSeatCount.psql" />
|
||||
<None Remove="HelperScripts\2021-09-21_01_SplitManageCollectionsPermission.psql" />
|
||||
<None Remove="HelperScripts\2021-10-21_00_SetMaxAutoscaleSeatCount.psql" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Scripts\2021-09-21_01_SplitManageCollectionsPermission.psql" />
|
||||
<EmbeddedResource Include="Scripts\2021-10-21_00_SetMaxAutoscaleSeatCount.psql" />
|
||||
<EmbeddedResource Include="HelperScripts\2021-09-21_01_SplitManageCollectionsPermission.psql" />
|
||||
<EmbeddedResource Include="HelperScripts\2021-10-21_00_SetMaxAutoscaleSeatCount.psql" />
|
||||
<EmbeddedResource Include="HelperScripts\2022-03-01_00_Up_MigrateOrganizationApiKeys.psql" />
|
||||
<EmbeddedResource Include="HelperScripts\2022-03-01_00_Down_MigrateOrganizationApiKeys.psql" />
|
||||
</ItemGroup>
|
||||
|
@ -1,497 +0,0 @@
|
||||
CREATE TABLE IF NOT EXISTS "__EFMigrationsHistory" (
|
||||
"MigrationId" character varying(150) NOT NULL,
|
||||
"ProductVersion" character varying(32) NOT NULL,
|
||||
CONSTRAINT "PK___EFMigrationsHistory" PRIMARY KEY ("MigrationId")
|
||||
);
|
||||
|
||||
START TRANSACTION;
|
||||
|
||||
CREATE COLLATION "postgresIndetermanisticCollation" (LC_COLLATE = 'en-u-ks-primary',
|
||||
LC_CTYPE = 'en-u-ks-primary',
|
||||
PROVIDER = icu,
|
||||
DETERMINISTIC = False
|
||||
);
|
||||
|
||||
CREATE TABLE "Event" (
|
||||
"Id" uuid NOT NULL,
|
||||
"Date" timestamp without time zone NOT NULL,
|
||||
"Type" integer NOT NULL,
|
||||
"UserId" uuid NULL,
|
||||
"OrganizationId" uuid NULL,
|
||||
"CipherId" uuid NULL,
|
||||
"CollectionId" uuid NULL,
|
||||
"PolicyId" uuid NULL,
|
||||
"GroupId" uuid NULL,
|
||||
"OrganizationUserId" uuid NULL,
|
||||
"DeviceType" smallint NULL,
|
||||
"IpAddress" character varying(50) NULL,
|
||||
"ActingUserId" uuid NULL,
|
||||
CONSTRAINT "PK_Event" PRIMARY KEY ("Id")
|
||||
);
|
||||
|
||||
CREATE TABLE "Grant" (
|
||||
"Key" character varying(200) NOT NULL,
|
||||
"Type" character varying(50) NULL,
|
||||
"SubjectId" character varying(200) NULL,
|
||||
"SessionId" character varying(100) NULL,
|
||||
"ClientId" character varying(200) NULL,
|
||||
"Description" character varying(200) NULL,
|
||||
"CreationDate" timestamp without time zone NOT NULL,
|
||||
"ExpirationDate" timestamp without time zone NULL,
|
||||
"ConsumedDate" timestamp without time zone NULL,
|
||||
"Data" text NULL,
|
||||
CONSTRAINT "PK_Grant" PRIMARY KEY ("Key")
|
||||
);
|
||||
|
||||
CREATE TABLE "Installation" (
|
||||
"Id" uuid NOT NULL,
|
||||
"Email" character varying(256) NULL,
|
||||
"Key" character varying(150) NULL,
|
||||
"Enabled" boolean NOT NULL,
|
||||
"CreationDate" timestamp without time zone NOT NULL,
|
||||
CONSTRAINT "PK_Installation" PRIMARY KEY ("Id")
|
||||
);
|
||||
|
||||
CREATE TABLE "Organization" (
|
||||
"Id" uuid NOT NULL,
|
||||
"Identifier" character varying(50) COLLATE "postgresIndetermanisticCollation" NULL,
|
||||
"Name" character varying(50) NULL,
|
||||
"BusinessName" character varying(50) NULL,
|
||||
"BusinessAddress1" character varying(50) NULL,
|
||||
"BusinessAddress2" character varying(50) NULL,
|
||||
"BusinessAddress3" character varying(50) NULL,
|
||||
"BusinessCountry" character varying(2) NULL,
|
||||
"BusinessTaxNumber" character varying(30) NULL,
|
||||
"BillingEmail" character varying(256) NULL,
|
||||
"Plan" character varying(50) NULL,
|
||||
"PlanType" smallint NOT NULL,
|
||||
"Seats" integer NULL,
|
||||
"MaxCollections" smallint NULL,
|
||||
"UsePolicies" boolean NOT NULL,
|
||||
"UseSso" boolean NOT NULL,
|
||||
"UseGroups" boolean NOT NULL,
|
||||
"UseDirectory" boolean NOT NULL,
|
||||
"UseEvents" boolean NOT NULL,
|
||||
"UseTotp" boolean NOT NULL,
|
||||
"Use2fa" boolean NOT NULL,
|
||||
"UseApi" boolean NOT NULL,
|
||||
"UseResetPassword" boolean NOT NULL,
|
||||
"SelfHost" boolean NOT NULL,
|
||||
"UsersGetPremium" boolean NOT NULL,
|
||||
"Storage" bigint NULL,
|
||||
"MaxStorageGb" smallint NULL,
|
||||
"Gateway" smallint NULL,
|
||||
"GatewayCustomerId" character varying(50) NULL,
|
||||
"GatewaySubscriptionId" character varying(50) NULL,
|
||||
"ReferenceData" text NULL,
|
||||
"Enabled" boolean NOT NULL,
|
||||
"LicenseKey" character varying(100) NULL,
|
||||
"ApiKey" character varying(30) NULL,
|
||||
"PublicKey" text NULL,
|
||||
"PrivateKey" text NULL,
|
||||
"TwoFactorProviders" text NULL,
|
||||
"ExpirationDate" timestamp without time zone NULL,
|
||||
"CreationDate" timestamp without time zone NOT NULL,
|
||||
"RevisionDate" timestamp without time zone NOT NULL,
|
||||
CONSTRAINT "PK_Organization" PRIMARY KEY ("Id")
|
||||
);
|
||||
|
||||
CREATE TABLE "Provider" (
|
||||
"Id" uuid NOT NULL,
|
||||
"Name" text NULL,
|
||||
"BusinessName" text NULL,
|
||||
"BusinessAddress1" text NULL,
|
||||
"BusinessAddress2" text NULL,
|
||||
"BusinessAddress3" text NULL,
|
||||
"BusinessCountry" text NULL,
|
||||
"BusinessTaxNumber" text NULL,
|
||||
"BillingEmail" text NULL,
|
||||
"Status" smallint NOT NULL,
|
||||
"UseEvents" boolean NOT NULL,
|
||||
"Enabled" boolean NOT NULL,
|
||||
"CreationDate" timestamp without time zone NOT NULL,
|
||||
"RevisionDate" timestamp without time zone NOT NULL,
|
||||
CONSTRAINT "PK_Provider" PRIMARY KEY ("Id")
|
||||
);
|
||||
|
||||
CREATE TABLE "TaxRate" (
|
||||
"Id" character varying(40) NOT NULL,
|
||||
"Country" character varying(50) NULL,
|
||||
"State" character varying(2) NULL,
|
||||
"PostalCode" character varying(10) NULL,
|
||||
"Rate" numeric NOT NULL,
|
||||
"Active" boolean NOT NULL,
|
||||
CONSTRAINT "PK_TaxRate" PRIMARY KEY ("Id")
|
||||
);
|
||||
|
||||
CREATE TABLE "User" (
|
||||
"Id" uuid NOT NULL,
|
||||
"Name" character varying(50) NULL,
|
||||
"Email" character varying(256) COLLATE "postgresIndetermanisticCollation" NOT NULL,
|
||||
"EmailVerified" boolean NOT NULL,
|
||||
"MasterPassword" character varying(300) NULL,
|
||||
"MasterPasswordHint" character varying(50) NULL,
|
||||
"Culture" character varying(10) NULL,
|
||||
"SecurityStamp" character varying(50) NOT NULL,
|
||||
"TwoFactorProviders" text NULL,
|
||||
"TwoFactorRecoveryCode" character varying(32) NULL,
|
||||
"EquivalentDomains" text NULL,
|
||||
"ExcludedGlobalEquivalentDomains" text NULL,
|
||||
"AccountRevisionDate" timestamp without time zone NOT NULL,
|
||||
"Key" text NULL,
|
||||
"PublicKey" text NULL,
|
||||
"PrivateKey" text NULL,
|
||||
"Premium" boolean NOT NULL,
|
||||
"PremiumExpirationDate" timestamp without time zone NULL,
|
||||
"RenewalReminderDate" timestamp without time zone NULL,
|
||||
"Storage" bigint NULL,
|
||||
"MaxStorageGb" smallint NULL,
|
||||
"Gateway" smallint NULL,
|
||||
"GatewayCustomerId" character varying(50) NULL,
|
||||
"GatewaySubscriptionId" character varying(50) NULL,
|
||||
"ReferenceData" text NULL,
|
||||
"LicenseKey" character varying(100) NULL,
|
||||
"ApiKey" character varying(30) NOT NULL,
|
||||
"Kdf" smallint NOT NULL,
|
||||
"KdfIterations" integer NOT NULL,
|
||||
"CreationDate" timestamp without time zone NOT NULL,
|
||||
"RevisionDate" timestamp without time zone NOT NULL,
|
||||
CONSTRAINT "PK_User" PRIMARY KEY ("Id")
|
||||
);
|
||||
|
||||
CREATE TABLE "Collection" (
|
||||
"Id" uuid NOT NULL,
|
||||
"OrganizationId" uuid NOT NULL,
|
||||
"Name" text NULL,
|
||||
"ExternalId" character varying(300) NULL,
|
||||
"CreationDate" timestamp without time zone NOT NULL,
|
||||
"RevisionDate" timestamp without time zone NOT NULL,
|
||||
CONSTRAINT "PK_Collection" PRIMARY KEY ("Id"),
|
||||
CONSTRAINT "FK_Collection_Organization_OrganizationId" FOREIGN KEY ("OrganizationId") REFERENCES "Organization" ("Id") ON DELETE CASCADE
|
||||
);
|
||||
|
||||
CREATE TABLE "Group" (
|
||||
"Id" uuid NOT NULL,
|
||||
"OrganizationId" uuid NOT NULL,
|
||||
"Name" character varying(100) NULL,
|
||||
"AccessAll" boolean NOT NULL,
|
||||
"ExternalId" character varying(300) NULL,
|
||||
"CreationDate" timestamp without time zone NOT NULL,
|
||||
"RevisionDate" timestamp without time zone NOT NULL,
|
||||
CONSTRAINT "PK_Group" PRIMARY KEY ("Id"),
|
||||
CONSTRAINT "FK_Group_Organization_OrganizationId" FOREIGN KEY ("OrganizationId") REFERENCES "Organization" ("Id") ON DELETE CASCADE
|
||||
);
|
||||
|
||||
CREATE TABLE "Policy" (
|
||||
"Id" uuid NOT NULL,
|
||||
"OrganizationId" uuid NOT NULL,
|
||||
"Type" smallint NOT NULL,
|
||||
"Data" text NULL,
|
||||
"Enabled" boolean NOT NULL,
|
||||
"CreationDate" timestamp without time zone NOT NULL,
|
||||
"RevisionDate" timestamp without time zone NOT NULL,
|
||||
CONSTRAINT "PK_Policy" PRIMARY KEY ("Id"),
|
||||
CONSTRAINT "FK_Policy_Organization_OrganizationId" FOREIGN KEY ("OrganizationId") REFERENCES "Organization" ("Id") ON DELETE CASCADE
|
||||
);
|
||||
|
||||
CREATE TABLE "SsoConfig" (
|
||||
"Id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
|
||||
"Enabled" boolean NOT NULL,
|
||||
"OrganizationId" uuid NOT NULL,
|
||||
"Data" text NULL,
|
||||
"CreationDate" timestamp without time zone NOT NULL,
|
||||
"RevisionDate" timestamp without time zone NOT NULL,
|
||||
CONSTRAINT "PK_SsoConfig" PRIMARY KEY ("Id"),
|
||||
CONSTRAINT "FK_SsoConfig_Organization_OrganizationId" FOREIGN KEY ("OrganizationId") REFERENCES "Organization" ("Id") ON DELETE CASCADE
|
||||
);
|
||||
|
||||
CREATE TABLE "ProviderOrganization" (
|
||||
"Id" uuid NOT NULL,
|
||||
"ProviderId" uuid NOT NULL,
|
||||
"OrganizationId" uuid NOT NULL,
|
||||
"Key" text NULL,
|
||||
"Settings" text NULL,
|
||||
"CreationDate" timestamp without time zone NOT NULL,
|
||||
"RevisionDate" timestamp without time zone NOT NULL,
|
||||
CONSTRAINT "PK_ProviderOrganization" PRIMARY KEY ("Id"),
|
||||
CONSTRAINT "FK_ProviderOrganization_Organization_OrganizationId" FOREIGN KEY ("OrganizationId") REFERENCES "Organization" ("Id") ON DELETE CASCADE,
|
||||
CONSTRAINT "FK_ProviderOrganization_Provider_ProviderId" FOREIGN KEY ("ProviderId") REFERENCES "Provider" ("Id") ON DELETE CASCADE
|
||||
);
|
||||
|
||||
CREATE TABLE "Cipher" (
|
||||
"Id" uuid NOT NULL,
|
||||
"UserId" uuid NULL,
|
||||
"OrganizationId" uuid NULL,
|
||||
"Type" smallint NOT NULL,
|
||||
"Data" text NULL,
|
||||
"Favorites" text NULL,
|
||||
"Folders" text NULL,
|
||||
"Attachments" text NULL,
|
||||
"CreationDate" timestamp without time zone NOT NULL,
|
||||
"RevisionDate" timestamp without time zone NOT NULL,
|
||||
"DeletedDate" timestamp without time zone NULL,
|
||||
"Reprompt" smallint NULL,
|
||||
CONSTRAINT "PK_Cipher" PRIMARY KEY ("Id"),
|
||||
CONSTRAINT "FK_Cipher_Organization_OrganizationId" FOREIGN KEY ("OrganizationId") REFERENCES "Organization" ("Id") ON DELETE RESTRICT,
|
||||
CONSTRAINT "FK_Cipher_User_UserId" FOREIGN KEY ("UserId") REFERENCES "User" ("Id") ON DELETE RESTRICT
|
||||
);
|
||||
|
||||
CREATE TABLE "Device" (
|
||||
"Id" uuid NOT NULL,
|
||||
"UserId" uuid NOT NULL,
|
||||
"Name" character varying(50) NULL,
|
||||
"Type" smallint NOT NULL,
|
||||
"Identifier" character varying(50) NULL,
|
||||
"PushToken" character varying(255) NULL,
|
||||
"CreationDate" timestamp without time zone NOT NULL,
|
||||
"RevisionDate" timestamp without time zone NOT NULL,
|
||||
CONSTRAINT "PK_Device" PRIMARY KEY ("Id"),
|
||||
CONSTRAINT "FK_Device_User_UserId" FOREIGN KEY ("UserId") REFERENCES "User" ("Id") ON DELETE CASCADE
|
||||
);
|
||||
|
||||
CREATE TABLE "EmergencyAccess" (
|
||||
"Id" uuid NOT NULL,
|
||||
"GrantorId" uuid NOT NULL,
|
||||
"GranteeId" uuid NULL,
|
||||
"Email" character varying(256) NULL,
|
||||
"KeyEncrypted" text NULL,
|
||||
"Type" smallint NOT NULL,
|
||||
"Status" smallint NOT NULL,
|
||||
"WaitTimeDays" integer NOT NULL,
|
||||
"RecoveryInitiatedDate" timestamp without time zone NULL,
|
||||
"LastNotificationDate" timestamp without time zone NULL,
|
||||
"CreationDate" timestamp without time zone NOT NULL,
|
||||
"RevisionDate" timestamp without time zone NOT NULL,
|
||||
CONSTRAINT "PK_EmergencyAccess" PRIMARY KEY ("Id"),
|
||||
CONSTRAINT "FK_EmergencyAccess_User_GranteeId" FOREIGN KEY ("GranteeId") REFERENCES "User" ("Id") ON DELETE RESTRICT,
|
||||
CONSTRAINT "FK_EmergencyAccess_User_GrantorId" FOREIGN KEY ("GrantorId") REFERENCES "User" ("Id") ON DELETE CASCADE
|
||||
);
|
||||
|
||||
CREATE TABLE "Folder" (
|
||||
"Id" uuid NOT NULL,
|
||||
"UserId" uuid NOT NULL,
|
||||
"Name" text NULL,
|
||||
"CreationDate" timestamp without time zone NOT NULL,
|
||||
"RevisionDate" timestamp without time zone NOT NULL,
|
||||
CONSTRAINT "PK_Folder" PRIMARY KEY ("Id"),
|
||||
CONSTRAINT "FK_Folder_User_UserId" FOREIGN KEY ("UserId") REFERENCES "User" ("Id") ON DELETE CASCADE
|
||||
);
|
||||
|
||||
CREATE TABLE "OrganizationUser" (
|
||||
"Id" uuid NOT NULL,
|
||||
"OrganizationId" uuid NOT NULL,
|
||||
"UserId" uuid NULL,
|
||||
"Email" character varying(256) NULL,
|
||||
"Key" text NULL,
|
||||
"ResetPasswordKey" text NULL,
|
||||
"Status" smallint NOT NULL,
|
||||
"Type" smallint NOT NULL,
|
||||
"AccessAll" boolean NOT NULL,
|
||||
"ExternalId" character varying(300) NULL,
|
||||
"CreationDate" timestamp without time zone NOT NULL,
|
||||
"RevisionDate" timestamp without time zone NOT NULL,
|
||||
"Permissions" text NULL,
|
||||
CONSTRAINT "PK_OrganizationUser" PRIMARY KEY ("Id"),
|
||||
CONSTRAINT "FK_OrganizationUser_Organization_OrganizationId" FOREIGN KEY ("OrganizationId") REFERENCES "Organization" ("Id") ON DELETE CASCADE,
|
||||
CONSTRAINT "FK_OrganizationUser_User_UserId" FOREIGN KEY ("UserId") REFERENCES "User" ("Id") ON DELETE RESTRICT
|
||||
);
|
||||
|
||||
CREATE TABLE "ProviderUser" (
|
||||
"Id" uuid NOT NULL,
|
||||
"ProviderId" uuid NOT NULL,
|
||||
"UserId" uuid NULL,
|
||||
"Email" text NULL,
|
||||
"Key" text NULL,
|
||||
"Status" smallint NOT NULL,
|
||||
"Type" smallint NOT NULL,
|
||||
"Permissions" text NULL,
|
||||
"CreationDate" timestamp without time zone NOT NULL,
|
||||
"RevisionDate" timestamp without time zone NOT NULL,
|
||||
CONSTRAINT "PK_ProviderUser" PRIMARY KEY ("Id"),
|
||||
CONSTRAINT "FK_ProviderUser_Provider_ProviderId" FOREIGN KEY ("ProviderId") REFERENCES "Provider" ("Id") ON DELETE CASCADE,
|
||||
CONSTRAINT "FK_ProviderUser_User_UserId" FOREIGN KEY ("UserId") REFERENCES "User" ("Id") ON DELETE RESTRICT
|
||||
);
|
||||
|
||||
CREATE TABLE "Send" (
|
||||
"Id" uuid NOT NULL,
|
||||
"UserId" uuid NULL,
|
||||
"OrganizationId" uuid NULL,
|
||||
"Type" smallint NOT NULL,
|
||||
"Data" text NULL,
|
||||
"Key" text NULL,
|
||||
"Password" character varying(300) NULL,
|
||||
"MaxAccessCount" integer NULL,
|
||||
"AccessCount" integer NOT NULL,
|
||||
"CreationDate" timestamp without time zone NOT NULL,
|
||||
"RevisionDate" timestamp without time zone NOT NULL,
|
||||
"ExpirationDate" timestamp without time zone NULL,
|
||||
"DeletionDate" timestamp without time zone NOT NULL,
|
||||
"Disabled" boolean NOT NULL,
|
||||
"HideEmail" boolean NULL,
|
||||
CONSTRAINT "PK_Send" PRIMARY KEY ("Id"),
|
||||
CONSTRAINT "FK_Send_Organization_OrganizationId" FOREIGN KEY ("OrganizationId") REFERENCES "Organization" ("Id") ON DELETE RESTRICT,
|
||||
CONSTRAINT "FK_Send_User_UserId" FOREIGN KEY ("UserId") REFERENCES "User" ("Id") ON DELETE RESTRICT
|
||||
);
|
||||
|
||||
CREATE TABLE "SsoUser" (
|
||||
"Id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
|
||||
"UserId" uuid NOT NULL,
|
||||
"OrganizationId" uuid NULL,
|
||||
"ExternalId" character varying(50) COLLATE "postgresIndetermanisticCollation" NULL,
|
||||
"CreationDate" timestamp without time zone NOT NULL,
|
||||
CONSTRAINT "PK_SsoUser" PRIMARY KEY ("Id"),
|
||||
CONSTRAINT "FK_SsoUser_Organization_OrganizationId" FOREIGN KEY ("OrganizationId") REFERENCES "Organization" ("Id") ON DELETE RESTRICT,
|
||||
CONSTRAINT "FK_SsoUser_User_UserId" FOREIGN KEY ("UserId") REFERENCES "User" ("Id") ON DELETE CASCADE
|
||||
);
|
||||
|
||||
CREATE TABLE "Transaction" (
|
||||
"Id" uuid NOT NULL,
|
||||
"UserId" uuid NULL,
|
||||
"OrganizationId" uuid NULL,
|
||||
"Type" smallint NOT NULL,
|
||||
"Amount" numeric NOT NULL,
|
||||
"Refunded" boolean NULL,
|
||||
"RefundedAmount" numeric NULL,
|
||||
"Details" character varying(100) NULL,
|
||||
"PaymentMethodType" smallint NULL,
|
||||
"Gateway" smallint NULL,
|
||||
"GatewayId" character varying(50) NULL,
|
||||
"CreationDate" timestamp without time zone NOT NULL,
|
||||
CONSTRAINT "PK_Transaction" PRIMARY KEY ("Id"),
|
||||
CONSTRAINT "FK_Transaction_Organization_OrganizationId" FOREIGN KEY ("OrganizationId") REFERENCES "Organization" ("Id") ON DELETE RESTRICT,
|
||||
CONSTRAINT "FK_Transaction_User_UserId" FOREIGN KEY ("UserId") REFERENCES "User" ("Id") ON DELETE RESTRICT
|
||||
);
|
||||
|
||||
CREATE TABLE "U2f" (
|
||||
"Id" integer NOT NULL GENERATED BY DEFAULT AS IDENTITY,
|
||||
"UserId" uuid NOT NULL,
|
||||
"KeyHandle" character varying(200) NULL,
|
||||
"Challenge" character varying(200) NULL,
|
||||
"AppId" character varying(50) NULL,
|
||||
"Version" character varying(20) NULL,
|
||||
"CreationDate" timestamp without time zone NOT NULL,
|
||||
CONSTRAINT "PK_U2f" PRIMARY KEY ("Id"),
|
||||
CONSTRAINT "FK_U2f_User_UserId" FOREIGN KEY ("UserId") REFERENCES "User" ("Id") ON DELETE CASCADE
|
||||
);
|
||||
|
||||
CREATE TABLE "CollectionGroups" (
|
||||
"CollectionId" uuid NOT NULL,
|
||||
"GroupId" uuid NOT NULL,
|
||||
"ReadOnly" boolean NOT NULL,
|
||||
"HidePasswords" boolean NOT NULL,
|
||||
CONSTRAINT "PK_CollectionGroups" PRIMARY KEY ("CollectionId", "GroupId"),
|
||||
CONSTRAINT "FK_CollectionGroups_Collection_CollectionId" FOREIGN KEY ("CollectionId") REFERENCES "Collection" ("Id") ON DELETE CASCADE,
|
||||
CONSTRAINT "FK_CollectionGroups_Group_GroupId" FOREIGN KEY ("GroupId") REFERENCES "Group" ("Id") ON DELETE CASCADE
|
||||
);
|
||||
|
||||
CREATE TABLE "CollectionCipher" (
|
||||
"CollectionId" uuid NOT NULL,
|
||||
"CipherId" uuid NOT NULL,
|
||||
CONSTRAINT "PK_CollectionCipher" PRIMARY KEY ("CollectionId", "CipherId"),
|
||||
CONSTRAINT "FK_CollectionCipher_Cipher_CipherId" FOREIGN KEY ("CipherId") REFERENCES "Cipher" ("Id") ON DELETE CASCADE,
|
||||
CONSTRAINT "FK_CollectionCipher_Collection_CollectionId" FOREIGN KEY ("CollectionId") REFERENCES "Collection" ("Id") ON DELETE CASCADE
|
||||
);
|
||||
|
||||
CREATE TABLE "CollectionUsers" (
|
||||
"CollectionId" uuid NOT NULL,
|
||||
"OrganizationUserId" uuid NOT NULL,
|
||||
"UserId" uuid NULL,
|
||||
"ReadOnly" boolean NOT NULL,
|
||||
"HidePasswords" boolean NOT NULL,
|
||||
CONSTRAINT "PK_CollectionUsers" PRIMARY KEY ("CollectionId", "OrganizationUserId"),
|
||||
CONSTRAINT "FK_CollectionUsers_Collection_CollectionId" FOREIGN KEY ("CollectionId") REFERENCES "Collection" ("Id") ON DELETE CASCADE,
|
||||
CONSTRAINT "FK_CollectionUsers_OrganizationUser_OrganizationUserId" FOREIGN KEY ("OrganizationUserId") REFERENCES "OrganizationUser" ("Id") ON DELETE CASCADE,
|
||||
CONSTRAINT "FK_CollectionUsers_User_UserId" FOREIGN KEY ("UserId") REFERENCES "User" ("Id") ON DELETE RESTRICT
|
||||
);
|
||||
|
||||
CREATE TABLE "GroupUser" (
|
||||
"GroupId" uuid NOT NULL,
|
||||
"OrganizationUserId" uuid NOT NULL,
|
||||
"UserId" uuid NULL,
|
||||
CONSTRAINT "PK_GroupUser" PRIMARY KEY ("GroupId", "OrganizationUserId"),
|
||||
CONSTRAINT "FK_GroupUser_Group_GroupId" FOREIGN KEY ("GroupId") REFERENCES "Group" ("Id") ON DELETE CASCADE,
|
||||
CONSTRAINT "FK_GroupUser_OrganizationUser_OrganizationUserId" FOREIGN KEY ("OrganizationUserId") REFERENCES "OrganizationUser" ("Id") ON DELETE CASCADE,
|
||||
CONSTRAINT "FK_GroupUser_User_UserId" FOREIGN KEY ("UserId") REFERENCES "User" ("Id") ON DELETE RESTRICT
|
||||
);
|
||||
|
||||
CREATE TABLE "ProviderOrganizationProviderUser" (
|
||||
"Id" uuid NOT NULL,
|
||||
"ProviderOrganizationId" uuid NOT NULL,
|
||||
"ProviderUserId" uuid NOT NULL,
|
||||
"Type" smallint NOT NULL,
|
||||
"Permissions" text NULL,
|
||||
"CreationDate" timestamp without time zone NOT NULL,
|
||||
"RevisionDate" timestamp without time zone NOT NULL,
|
||||
CONSTRAINT "PK_ProviderOrganizationProviderUser" PRIMARY KEY ("Id"),
|
||||
CONSTRAINT "FK_ProviderOrganizationProviderUser_ProviderOrganization_Provi~" FOREIGN KEY ("ProviderOrganizationId") REFERENCES "ProviderOrganization" ("Id") ON DELETE CASCADE,
|
||||
CONSTRAINT "FK_ProviderOrganizationProviderUser_ProviderUser_ProviderUserId" FOREIGN KEY ("ProviderUserId") REFERENCES "ProviderUser" ("Id") ON DELETE CASCADE
|
||||
);
|
||||
|
||||
CREATE INDEX "IX_Cipher_OrganizationId" ON "Cipher" ("OrganizationId");
|
||||
|
||||
CREATE INDEX "IX_Cipher_UserId" ON "Cipher" ("UserId");
|
||||
|
||||
CREATE INDEX "IX_Collection_OrganizationId" ON "Collection" ("OrganizationId");
|
||||
|
||||
CREATE INDEX "IX_CollectionCipher_CipherId" ON "CollectionCipher" ("CipherId");
|
||||
|
||||
CREATE INDEX "IX_CollectionGroups_GroupId" ON "CollectionGroups" ("GroupId");
|
||||
|
||||
CREATE INDEX "IX_CollectionUsers_OrganizationUserId" ON "CollectionUsers" ("OrganizationUserId");
|
||||
|
||||
CREATE INDEX "IX_CollectionUsers_UserId" ON "CollectionUsers" ("UserId");
|
||||
|
||||
CREATE INDEX "IX_Device_UserId" ON "Device" ("UserId");
|
||||
|
||||
CREATE INDEX "IX_EmergencyAccess_GranteeId" ON "EmergencyAccess" ("GranteeId");
|
||||
|
||||
CREATE INDEX "IX_EmergencyAccess_GrantorId" ON "EmergencyAccess" ("GrantorId");
|
||||
|
||||
CREATE INDEX "IX_Folder_UserId" ON "Folder" ("UserId");
|
||||
|
||||
CREATE INDEX "IX_Group_OrganizationId" ON "Group" ("OrganizationId");
|
||||
|
||||
CREATE INDEX "IX_GroupUser_OrganizationUserId" ON "GroupUser" ("OrganizationUserId");
|
||||
|
||||
CREATE INDEX "IX_GroupUser_UserId" ON "GroupUser" ("UserId");
|
||||
|
||||
CREATE INDEX "IX_OrganizationUser_OrganizationId" ON "OrganizationUser" ("OrganizationId");
|
||||
|
||||
CREATE INDEX "IX_OrganizationUser_UserId" ON "OrganizationUser" ("UserId");
|
||||
|
||||
CREATE INDEX "IX_Policy_OrganizationId" ON "Policy" ("OrganizationId");
|
||||
|
||||
CREATE INDEX "IX_ProviderOrganization_OrganizationId" ON "ProviderOrganization" ("OrganizationId");
|
||||
|
||||
CREATE INDEX "IX_ProviderOrganization_ProviderId" ON "ProviderOrganization" ("ProviderId");
|
||||
|
||||
CREATE INDEX "IX_ProviderOrganizationProviderUser_ProviderOrganizationId" ON "ProviderOrganizationProviderUser" ("ProviderOrganizationId");
|
||||
|
||||
CREATE INDEX "IX_ProviderOrganizationProviderUser_ProviderUserId" ON "ProviderOrganizationProviderUser" ("ProviderUserId");
|
||||
|
||||
CREATE INDEX "IX_ProviderUser_ProviderId" ON "ProviderUser" ("ProviderId");
|
||||
|
||||
CREATE INDEX "IX_ProviderUser_UserId" ON "ProviderUser" ("UserId");
|
||||
|
||||
CREATE INDEX "IX_Send_OrganizationId" ON "Send" ("OrganizationId");
|
||||
|
||||
CREATE INDEX "IX_Send_UserId" ON "Send" ("UserId");
|
||||
|
||||
CREATE INDEX "IX_SsoConfig_OrganizationId" ON "SsoConfig" ("OrganizationId");
|
||||
|
||||
CREATE INDEX "IX_SsoUser_OrganizationId" ON "SsoUser" ("OrganizationId");
|
||||
|
||||
CREATE INDEX "IX_SsoUser_UserId" ON "SsoUser" ("UserId");
|
||||
|
||||
CREATE INDEX "IX_Transaction_OrganizationId" ON "Transaction" ("OrganizationId");
|
||||
|
||||
CREATE INDEX "IX_Transaction_UserId" ON "Transaction" ("UserId");
|
||||
|
||||
CREATE INDEX "IX_U2f_UserId" ON "U2f" ("UserId");
|
||||
|
||||
INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion")
|
||||
VALUES ('20210708191531_Init', '5.0.5');
|
||||
|
||||
COMMIT;
|
||||
|
||||
|
@ -1,12 +0,0 @@
|
||||
START TRANSACTION;
|
||||
|
||||
DROP TABLE "ProviderOrganizationProviderUser";
|
||||
|
||||
ALTER TABLE "Event" ADD "ProviderId" uuid NULL;
|
||||
|
||||
ALTER TABLE "Event" ADD "ProviderUserId" uuid NULL;
|
||||
|
||||
INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion")
|
||||
VALUES ('20210709092227_RemoveProviderOrganizationProviderUser', '5.0.5');
|
||||
|
||||
COMMIT;
|
@ -1,8 +0,0 @@
|
||||
START TRANSACTION;
|
||||
|
||||
ALTER TABLE "User" ADD "ForcePasswordReset" boolean NOT NULL DEFAULT FALSE;
|
||||
|
||||
INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion")
|
||||
VALUES ('20210716141748_UserForcePasswordReset', '5.0.5');
|
||||
|
||||
COMMIT;
|
@ -1,12 +0,0 @@
|
||||
START TRANSACTION;
|
||||
|
||||
ALTER TABLE "Organization" ADD "MaxAutoscaleSeats" integer NULL;
|
||||
|
||||
ALTER TABLE "Organization" ADD "OwnersNotifiedOfAutoscaling" timestamp without time zone NULL;
|
||||
|
||||
ALTER TABLE "Event" ADD "ProviderOrganizationId" uuid NULL;
|
||||
|
||||
INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion")
|
||||
VALUES ('20210920201829_AddMaxAutoscaleSeatsToOrganization', '5.0.9');
|
||||
|
||||
COMMIT;
|
@ -1,33 +0,0 @@
|
||||
START TRANSACTION;
|
||||
|
||||
ALTER TABLE "User" ADD "UsesCryptoAgent" boolean NOT NULL DEFAULT FALSE;
|
||||
|
||||
CREATE TABLE "OrganizationSponsorship" (
|
||||
"Id" uuid NOT NULL,
|
||||
"InstallationId" uuid NULL,
|
||||
"SponsoringOrganizationId" uuid NULL,
|
||||
"SponsoringOrganizationUserId" uuid NULL,
|
||||
"SponsoredOrganizationId" uuid NULL,
|
||||
"FriendlyName" character varying(256) NULL,
|
||||
"OfferedToEmail" character varying(256) NULL,
|
||||
"PlanSponsorshipType" smallint NULL,
|
||||
"CloudSponsor" boolean NOT NULL,
|
||||
"LastSyncDate" timestamp without time zone NULL,
|
||||
"TimesRenewedWithoutValidation" smallint NOT NULL,
|
||||
"SponsorshipLapsedDate" timestamp without time zone NULL,
|
||||
CONSTRAINT "PK_OrganizationSponsorship" PRIMARY KEY ("Id"),
|
||||
CONSTRAINT "FK_OrganizationSponsorship_Installation_InstallationId" FOREIGN KEY ("InstallationId") REFERENCES "Installation" ("Id") ON DELETE RESTRICT,
|
||||
CONSTRAINT "FK_OrganizationSponsorship_Organization_SponsoredOrganizationId" FOREIGN KEY ("SponsoredOrganizationId") REFERENCES "Organization" ("Id") ON DELETE RESTRICT,
|
||||
CONSTRAINT "FK_OrganizationSponsorship_Organization_SponsoringOrganization~" FOREIGN KEY ("SponsoringOrganizationId") REFERENCES "Organization" ("Id") ON DELETE RESTRICT
|
||||
);
|
||||
|
||||
CREATE INDEX "IX_OrganizationSponsorship_InstallationId" ON "OrganizationSponsorship" ("InstallationId");
|
||||
|
||||
CREATE INDEX "IX_OrganizationSponsorship_SponsoredOrganizationId" ON "OrganizationSponsorship" ("SponsoredOrganizationId");
|
||||
|
||||
CREATE INDEX "IX_OrganizationSponsorship_SponsoringOrganizationId" ON "OrganizationSponsorship" ("SponsoringOrganizationId");
|
||||
|
||||
INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion")
|
||||
VALUES ('20211108225011_OrganizationSponsorship', '5.0.9');
|
||||
|
||||
COMMIT;
|
@ -1,9 +0,0 @@
|
||||
START TRANSACTION;
|
||||
|
||||
ALTER TABLE "User" ADD "UsesKeyConnector" boolean NOT NULL DEFAULT FALSE;
|
||||
|
||||
INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion")
|
||||
VALUES ('20211108041547_KeyConnector', '5.0.9');
|
||||
|
||||
COMMIT;
|
||||
|
Binary file not shown.
Binary file not shown.
@ -1,10 +0,0 @@
|
||||
START TRANSACTION;
|
||||
|
||||
ALTER TABLE "User" ADD "FailedLoginCount" integer NOT NULL DEFAULT 0;
|
||||
|
||||
ALTER TABLE "User" ADD "LastFailedLoginDate" timestamp without time zone NULL;
|
||||
|
||||
INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion")
|
||||
VALUES ('20220301211818_FailedLoginCaptcha', '5.0.12');
|
||||
|
||||
COMMIT;
|
@ -1,59 +0,0 @@
|
||||
START TRANSACTION;
|
||||
|
||||
ALTER TABLE "OrganizationSponsorship" DROP CONSTRAINT "FK_OrganizationSponsorship_Installation_InstallationId";
|
||||
|
||||
DROP INDEX "IX_OrganizationSponsorship_InstallationId";
|
||||
|
||||
ALTER TABLE "OrganizationSponsorship" DROP COLUMN "InstallationId";
|
||||
|
||||
ALTER TABLE "OrganizationSponsorship" DROP COLUMN "TimesRenewedWithoutValidation";
|
||||
|
||||
CREATE TABLE "OrganizationApiKey" (
|
||||
"Id" uuid NOT NULL,
|
||||
"OrganizationId" uuid NOT NULL,
|
||||
"Type" smallint NOT NULL,
|
||||
"ApiKey" character varying(30) NULL,
|
||||
"RevisionDate" timestamp without time zone NOT NULL,
|
||||
CONSTRAINT "PK_OrganizationApiKey" PRIMARY KEY ("Id"),
|
||||
CONSTRAINT "FK_OrganizationApiKey_Organization_OrganizationId" FOREIGN KEY ("OrganizationId") REFERENCES "Organization" ("Id") ON DELETE CASCADE
|
||||
);
|
||||
|
||||
INSERT INTO "OrganizationApiKey"(
|
||||
"Id",
|
||||
"OrganizationId",
|
||||
"ApiKey",
|
||||
"Type",
|
||||
"RevisionDate")
|
||||
SELECT uuid_in(overlay(overlay(md5(random()::text || ':' || random()::text) placing '4' from 13) placing to_hex(floor(random()*(11-8+1) + 8)::int)::text from 17)::cstring),
|
||||
"Id" AS "OrganizationId",
|
||||
"ApiKey",
|
||||
0 AS "Type",
|
||||
"RevisionDate"
|
||||
FROM "Organization";
|
||||
|
||||
|
||||
ALTER TABLE "Organization" DROP COLUMN "ApiKey";
|
||||
|
||||
ALTER TABLE "OrganizationSponsorship" RENAME COLUMN "SponsorshipLapsedDate" TO "ValidUntil";
|
||||
|
||||
ALTER TABLE "OrganizationSponsorship" RENAME COLUMN "CloudSponsor" TO "ToDelete";
|
||||
|
||||
CREATE TABLE "OrganizationConnection" (
|
||||
"Id" uuid NOT NULL,
|
||||
"Type" smallint NOT NULL,
|
||||
"OrganizationId" uuid NOT NULL,
|
||||
"Enabled" boolean NOT NULL,
|
||||
"Config" text NULL,
|
||||
CONSTRAINT "PK_OrganizationConnection" PRIMARY KEY ("Id"),
|
||||
CONSTRAINT "FK_OrganizationConnection_Organization_OrganizationId" FOREIGN KEY ("OrganizationId") REFERENCES "Organization" ("Id") ON DELETE CASCADE
|
||||
);
|
||||
|
||||
CREATE INDEX "IX_OrganizationApiKey_OrganizationId" ON "OrganizationApiKey" ("OrganizationId");
|
||||
|
||||
CREATE INDEX "IX_OrganizationConnection_OrganizationId" ON "OrganizationConnection" ("OrganizationId");
|
||||
|
||||
INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion")
|
||||
VALUES ('20220322183505_SelfHostF4E', '5.0.12');
|
||||
|
||||
COMMIT;
|
||||
|
@ -1,16 +0,0 @@
|
||||
START TRANSACTION;
|
||||
|
||||
ALTER TABLE "OrganizationSponsorship" DROP CONSTRAINT "FK_OrganizationSponsorship_Organization_SponsoringOrganization~";
|
||||
|
||||
ALTER TABLE "OrganizationSponsorship" ALTER COLUMN "SponsoringOrganizationUserId" SET NOT NULL;
|
||||
ALTER TABLE "OrganizationSponsorship" ALTER COLUMN "SponsoringOrganizationUserId" SET DEFAULT '00000000-0000-0000-0000-000000000000';
|
||||
|
||||
ALTER TABLE "OrganizationSponsorship" ALTER COLUMN "SponsoringOrganizationId" SET NOT NULL;
|
||||
ALTER TABLE "OrganizationSponsorship" ALTER COLUMN "SponsoringOrganizationId" SET DEFAULT '00000000-0000-0000-0000-000000000000';
|
||||
|
||||
ALTER TABLE "OrganizationSponsorship" ADD CONSTRAINT "FK_OrganizationSponsorship_Organization_SponsoringOrganization~" FOREIGN KEY ("SponsoringOrganizationId") REFERENCES "Organization" ("Id") ON DELETE CASCADE;
|
||||
|
||||
INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion")
|
||||
VALUES ('20220411190525_SponsorshipBulkActions', '5.0.12');
|
||||
|
||||
COMMIT;
|
@ -1,14 +0,0 @@
|
||||
START TRANSACTION;
|
||||
|
||||
ALTER TABLE "OrganizationSponsorship" DROP CONSTRAINT "FK_OrganizationSponsorship_Organization_SponsoringOrganization~";
|
||||
|
||||
ALTER TABLE "OrganizationSponsorship" ALTER COLUMN "SponsoringOrganizationId" DROP NOT NULL;
|
||||
|
||||
ALTER TABLE "Event" ADD "InstallationId" uuid NULL;
|
||||
|
||||
ALTER TABLE "OrganizationSponsorship" ADD CONSTRAINT "FK_OrganizationSponsorship_Organization_SponsoringOrganization~" FOREIGN KEY ("SponsoringOrganizationId") REFERENCES "Organization" ("Id") ON DELETE RESTRICT;
|
||||
|
||||
INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion")
|
||||
VALUES ('20220420171153_AddInstallationIdToEvents', '5.0.12');
|
||||
|
||||
COMMIT;
|
@ -1,8 +0,0 @@
|
||||
START TRANSACTION;
|
||||
|
||||
ALTER TABLE "User" ADD "UnknownDeviceVerificationEnabled" boolean NOT NULL DEFAULT true;
|
||||
|
||||
INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion")
|
||||
VALUES ('20220524170740_DeviceUnknownVerification', '5.0.12');
|
||||
|
||||
COMMIT;
|
@ -1,8 +0,0 @@
|
||||
START TRANSACTION;
|
||||
|
||||
ALTER TABLE "Organization" ADD "UseScim" boolean NOT NULL DEFAULT FALSE;
|
||||
|
||||
INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion")
|
||||
VALUES ('20220707162231_UseScimFlag', '6.0.4');
|
||||
|
||||
COMMIT;
|
@ -1,133 +0,0 @@
|
||||
START TRANSACTION;
|
||||
|
||||
ALTER TABLE "User" ALTER COLUMN "RevisionDate" TYPE timestamp with time zone;
|
||||
|
||||
ALTER TABLE "User" ALTER COLUMN "RenewalReminderDate" TYPE timestamp with time zone;
|
||||
|
||||
ALTER TABLE "User" ALTER COLUMN "PremiumExpirationDate" TYPE timestamp with time zone;
|
||||
|
||||
ALTER TABLE "User" ALTER COLUMN "LastFailedLoginDate" TYPE timestamp with time zone;
|
||||
|
||||
ALTER TABLE "User" ALTER COLUMN "CreationDate" TYPE timestamp with time zone;
|
||||
|
||||
ALTER TABLE "User" ALTER COLUMN "AccountRevisionDate" TYPE timestamp with time zone;
|
||||
|
||||
ALTER TABLE "Transaction" ALTER COLUMN "CreationDate" TYPE timestamp with time zone;
|
||||
|
||||
ALTER TABLE "SsoUser" ALTER COLUMN "CreationDate" TYPE timestamp with time zone;
|
||||
|
||||
ALTER TABLE "SsoConfig" ALTER COLUMN "RevisionDate" TYPE timestamp with time zone;
|
||||
|
||||
ALTER TABLE "SsoConfig" ALTER COLUMN "CreationDate" TYPE timestamp with time zone;
|
||||
|
||||
ALTER TABLE "Send" ALTER COLUMN "RevisionDate" TYPE timestamp with time zone;
|
||||
|
||||
ALTER TABLE "Send" ALTER COLUMN "ExpirationDate" TYPE timestamp with time zone;
|
||||
|
||||
ALTER TABLE "Send" ALTER COLUMN "DeletionDate" TYPE timestamp with time zone;
|
||||
|
||||
ALTER TABLE "Send" ALTER COLUMN "CreationDate" TYPE timestamp with time zone;
|
||||
|
||||
ALTER TABLE "ProviderUser" ALTER COLUMN "RevisionDate" TYPE timestamp with time zone;
|
||||
|
||||
ALTER TABLE "ProviderUser" ALTER COLUMN "CreationDate" TYPE timestamp with time zone;
|
||||
|
||||
ALTER TABLE "ProviderOrganization" ALTER COLUMN "RevisionDate" TYPE timestamp with time zone;
|
||||
|
||||
ALTER TABLE "ProviderOrganization" ALTER COLUMN "CreationDate" TYPE timestamp with time zone;
|
||||
|
||||
ALTER TABLE "Provider" ALTER COLUMN "RevisionDate" TYPE timestamp with time zone;
|
||||
|
||||
ALTER TABLE "Provider" ALTER COLUMN "CreationDate" TYPE timestamp with time zone;
|
||||
|
||||
ALTER TABLE "Policy" ALTER COLUMN "RevisionDate" TYPE timestamp with time zone;
|
||||
|
||||
ALTER TABLE "Policy" ALTER COLUMN "CreationDate" TYPE timestamp with time zone;
|
||||
|
||||
ALTER TABLE "OrganizationUser" ALTER COLUMN "RevisionDate" TYPE timestamp with time zone;
|
||||
|
||||
ALTER TABLE "OrganizationUser" ALTER COLUMN "CreationDate" TYPE timestamp with time zone;
|
||||
|
||||
ALTER TABLE "OrganizationSponsorship" ALTER COLUMN "ValidUntil" TYPE timestamp with time zone;
|
||||
|
||||
ALTER TABLE "OrganizationSponsorship" ALTER COLUMN "LastSyncDate" TYPE timestamp with time zone;
|
||||
|
||||
ALTER TABLE "OrganizationApiKey" ALTER COLUMN "RevisionDate" TYPE timestamp with time zone;
|
||||
|
||||
ALTER TABLE "Organization" ALTER COLUMN "RevisionDate" TYPE timestamp with time zone;
|
||||
|
||||
ALTER TABLE "Organization" ALTER COLUMN "OwnersNotifiedOfAutoscaling" TYPE timestamp with time zone;
|
||||
|
||||
ALTER TABLE "Organization" ALTER COLUMN "ExpirationDate" TYPE timestamp with time zone;
|
||||
|
||||
ALTER TABLE "Organization" ALTER COLUMN "CreationDate" TYPE timestamp with time zone;
|
||||
|
||||
ALTER TABLE "Installation" ALTER COLUMN "CreationDate" TYPE timestamp with time zone;
|
||||
|
||||
ALTER TABLE "Group" ALTER COLUMN "RevisionDate" TYPE timestamp with time zone;
|
||||
|
||||
ALTER TABLE "Group" ALTER COLUMN "CreationDate" TYPE timestamp with time zone;
|
||||
|
||||
ALTER TABLE "Grant" ALTER COLUMN "ExpirationDate" TYPE timestamp with time zone;
|
||||
|
||||
ALTER TABLE "Grant" ALTER COLUMN "CreationDate" TYPE timestamp with time zone;
|
||||
|
||||
ALTER TABLE "Grant" ALTER COLUMN "ConsumedDate" TYPE timestamp with time zone;
|
||||
|
||||
ALTER TABLE "Folder" ALTER COLUMN "RevisionDate" TYPE timestamp with time zone;
|
||||
|
||||
ALTER TABLE "Folder" ALTER COLUMN "CreationDate" TYPE timestamp with time zone;
|
||||
|
||||
ALTER TABLE "Event" ALTER COLUMN "Date" TYPE timestamp with time zone;
|
||||
|
||||
ALTER TABLE "EmergencyAccess" ALTER COLUMN "RevisionDate" TYPE timestamp with time zone;
|
||||
|
||||
ALTER TABLE "EmergencyAccess" ALTER COLUMN "RecoveryInitiatedDate" TYPE timestamp with time zone;
|
||||
|
||||
ALTER TABLE "EmergencyAccess" ALTER COLUMN "LastNotificationDate" TYPE timestamp with time zone;
|
||||
|
||||
ALTER TABLE "EmergencyAccess" ALTER COLUMN "CreationDate" TYPE timestamp with time zone;
|
||||
|
||||
ALTER TABLE "Device" ALTER COLUMN "RevisionDate" TYPE timestamp with time zone;
|
||||
|
||||
ALTER TABLE "Device" ALTER COLUMN "CreationDate" TYPE timestamp with time zone;
|
||||
|
||||
ALTER TABLE "Collection" ALTER COLUMN "RevisionDate" TYPE timestamp with time zone;
|
||||
|
||||
ALTER TABLE "Collection" ALTER COLUMN "CreationDate" TYPE timestamp with time zone;
|
||||
|
||||
ALTER TABLE "Cipher" ALTER COLUMN "RevisionDate" TYPE timestamp with time zone;
|
||||
|
||||
ALTER TABLE "Cipher" ALTER COLUMN "DeletedDate" TYPE timestamp with time zone;
|
||||
|
||||
ALTER TABLE "Cipher" ALTER COLUMN "CreationDate" TYPE timestamp with time zone;
|
||||
|
||||
CREATE TABLE "AuthRequest" (
|
||||
"Id" uuid NOT NULL,
|
||||
"UserId" uuid NOT NULL,
|
||||
"Type" smallint NOT NULL,
|
||||
"RequestDeviceIdentifier" text NULL,
|
||||
"RequestDeviceType" smallint NOT NULL,
|
||||
"RequestIpAddress" text NULL,
|
||||
"RequestFingerprint" text NULL,
|
||||
"ResponseDeviceId" uuid NULL,
|
||||
"AccessCode" text NULL,
|
||||
"PublicKey" text NULL,
|
||||
"Key" text NULL,
|
||||
"MasterPasswordHash" text NULL,
|
||||
"CreationDate" timestamp with time zone NOT NULL,
|
||||
"ResponseDate" timestamp with time zone NULL,
|
||||
"AuthenticationDate" timestamp with time zone NULL,
|
||||
CONSTRAINT "PK_AuthRequest" PRIMARY KEY ("Id"),
|
||||
CONSTRAINT "FK_AuthRequest_Device_ResponseDeviceId" FOREIGN KEY ("ResponseDeviceId") REFERENCES "Device" ("Id"),
|
||||
CONSTRAINT "FK_AuthRequest_User_UserId" FOREIGN KEY ("UserId") REFERENCES "User" ("Id") ON DELETE CASCADE
|
||||
);
|
||||
|
||||
CREATE INDEX "IX_AuthRequest_ResponseDeviceId" ON "AuthRequest" ("ResponseDeviceId");
|
||||
|
||||
CREATE INDEX "IX_AuthRequest_UserId" ON "AuthRequest" ("UserId");
|
||||
|
||||
INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion")
|
||||
VALUES ('20220830163921_PasswordlessAuthRequests', '6.0.4');
|
||||
|
||||
COMMIT;
|
@ -1,8 +0,0 @@
|
||||
START TRANSACTION;
|
||||
|
||||
ALTER TABLE "Event" ADD "SystemUser" smallint NULL;
|
||||
|
||||
INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion")
|
||||
VALUES ('20220927142152_EventsSystemUser', '6.0.4');
|
||||
|
||||
COMMIT;
|
@ -1,8 +0,0 @@
|
||||
START TRANSACTION;
|
||||
|
||||
ALTER TABLE "Organization" ADD "UseCustomPermissions" boolean NOT NULL DEFAULT FALSE;
|
||||
|
||||
INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion")
|
||||
VALUES ('20221116102326_UseCustomPermissionsFlag', '6.0.4');
|
||||
|
||||
COMMIT;
|
@ -1,8 +0,0 @@
|
||||
START TRANSACTION;
|
||||
|
||||
ALTER TABLE "AuthRequest" ADD "Approved" boolean NULL;
|
||||
|
||||
INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion")
|
||||
VALUES ('20221025033204_PasswordlessAuthRequestAddApprovedColumn', '6.0.4');
|
||||
|
||||
COMMIT;
|
@ -1,9 +0,0 @@
|
||||
START TRANSACTION;
|
||||
|
||||
ALTER TABLE "User" ADD "AvatarColor" character varying(7) NULL;
|
||||
|
||||
INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion")
|
||||
VALUES ('20221115034053_AvatarColor', '6.0.4');
|
||||
|
||||
COMMIT;
|
||||
|
Loading…
Reference in New Issue
Block a user