Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.
Commit generated SQL files to Git for documentation purposes (#955)
Leendert de Borst5d050cd278b7
diff --git a/apps/server/Databases/AliasClientDb/Scripts/.gitignore b/apps/server/Databases/AliasClientDb/Scripts/.gitignoreindex 980b1323d..9d73bd8d5 100644--- a/apps/server/Databases/AliasClientDb/Scripts/.gitignore+++ b/apps/server/Databases/AliasClientDb/Scripts/.gitignore@@ -1,3 +1,5 @@-# Ignore generated files-MigrationSql+# Ignore generated TS filesMigrationTs++# Include generated SQL files in version control for documentation purposes+!MigrationSql/*.sqldiff --git a/apps/server/Databases/AliasClientDb/Scripts/MigrationSql/000_FullSchema.sql b/apps/server/Databases/AliasClientDb/Scripts/MigrationSql/000_FullSchema.sqlnew file mode 100644index 000000000..3458283fd--- /dev/null+++ b/apps/server/Databases/AliasClientDb/Scripts/MigrationSql/000_FullSchema.sql@@ -0,0 +1,254 @@+CREATE TABLE IF NOT EXISTS "__EFMigrationsHistory" (+ "MigrationId" TEXT NOT NULL CONSTRAINT "PK___EFMigrationsHistory" PRIMARY KEY,+ "ProductVersion" TEXT NOT NULL+);++BEGIN TRANSACTION;+CREATE TABLE "Aliases" (+ "Id" TEXT NOT NULL CONSTRAINT "PK_Aliases" PRIMARY KEY,+ "Gender" VARCHAR NULL,+ "FirstName" VARCHAR NULL,+ "LastName" VARCHAR NULL,+ "NickName" VARCHAR NULL,+ "BirthDate" TEXT NOT NULL,+ "AddressStreet" VARCHAR NULL,+ "AddressCity" VARCHAR NULL,+ "AddressState" VARCHAR NULL,+ "AddressZipCode" VARCHAR NULL,+ "AddressCountry" VARCHAR NULL,+ "Hobbies" TEXT NULL,+ "EmailPrefix" TEXT NULL,+ "PhoneMobile" TEXT NULL,+ "BankAccountIBAN" TEXT NULL,+ "CreatedAt" TEXT NOT NULL,+ "UpdatedAt" TEXT NOT NULL+);++CREATE TABLE "Services" (+ "Id" TEXT NOT NULL CONSTRAINT "PK_Services" PRIMARY KEY,+ "Name" TEXT NULL,+ "Url" TEXT NULL,+ "Logo" BLOB NULL,+ "CreatedAt" TEXT NOT NULL,+ "UpdatedAt" TEXT NOT NULL+);++CREATE TABLE "Credentials" (+ "Id" TEXT NOT NULL CONSTRAINT "PK_Credentials" PRIMARY KEY,+ "AliasId" TEXT NOT NULL,+ "Notes" TEXT NULL,+ "Username" TEXT NOT NULL,+ "CreatedAt" TEXT NOT NULL,+ "UpdatedAt" TEXT NOT NULL,+ "ServiceId" TEXT NOT NULL,+ CONSTRAINT "FK_Credentials_Aliases_AliasId" FOREIGN KEY ("AliasId") REFERENCES "Aliases" ("Id") ON DELETE CASCADE,+ CONSTRAINT "FK_Credentials_Services_ServiceId" FOREIGN KEY ("ServiceId") REFERENCES "Services" ("Id") ON DELETE CASCADE+);++CREATE TABLE "Attachment" (+ "Id" TEXT NOT NULL CONSTRAINT "PK_Attachment" PRIMARY KEY,+ "Filename" TEXT NOT NULL,+ "Blob" BLOB NOT NULL,+ "CreatedAt" TEXT NOT NULL,+ "UpdatedAt" TEXT NOT NULL,+ "CredentialId" TEXT NOT NULL,+ CONSTRAINT "FK_Attachment_Credentials_CredentialId" FOREIGN KEY ("CredentialId") REFERENCES "Credentials" ("Id") ON DELETE CASCADE+);++CREATE TABLE "Passwords" (+ "Id" TEXT NOT NULL CONSTRAINT "PK_Passwords" PRIMARY KEY,+ "Value" TEXT NULL,+ "CreatedAt" TEXT NOT NULL,+ "UpdatedAt" TEXT NOT NULL,+ "CredentialId" TEXT NOT NULL,+ CONSTRAINT "FK_Passwords_Credentials_CredentialId" FOREIGN KEY ("CredentialId") REFERENCES "Credentials" ("Id") ON DELETE CASCADE+);++CREATE INDEX "IX_Attachment_CredentialId" ON "Attachment" ("CredentialId");++CREATE INDEX "IX_Credentials_AliasId" ON "Credentials" ("AliasId");++CREATE INDEX "IX_Credentials_ServiceId" ON "Credentials" ("ServiceId");++CREATE INDEX "IX_Passwords_CredentialId" ON "Passwords" ("CredentialId");++INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion")+VALUES ('20240708094944_1.0.0-InitialMigration', '9.0.4');++INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion")+VALUES ('20240708224522_1.0.1-EmptyTestMigration', '9.0.4');++ALTER TABLE "Aliases" RENAME COLUMN "EmailPrefix" TO "Email";++INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion")+VALUES ('20240711204207_1.0.2-ChangeEmailColumn', '9.0.4');++CREATE TABLE "EncryptionKeys" (+ "Id" TEXT NOT NULL CONSTRAINT "PK_EncryptionKeys" PRIMARY KEY,+ "PublicKey" TEXT NOT NULL,+ "PrivateKey" TEXT NOT NULL,+ "IsPrimary" INTEGER NOT NULL,+ "CreatedAt" TEXT NOT NULL,+ "UpdatedAt" TEXT NOT NULL+);++INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion")+VALUES ('20240729105618_1.1.0-AddPkiTables', '9.0.4');++CREATE TABLE "Settings" (+ "Key" TEXT NOT NULL CONSTRAINT "PK_Settings" PRIMARY KEY,+ "Value" TEXT NULL,+ "CreatedAt" TEXT NOT NULL,+ "UpdatedAt" TEXT NOT NULL+);++INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion")+VALUES ('20240805073413_1.2.0-AddSettingsTable', '9.0.4');++CREATE TABLE "ef_temp_Aliases" (+ "Id" TEXT NOT NULL CONSTRAINT "PK_Aliases" PRIMARY KEY,+ "BirthDate" TEXT NOT NULL,+ "CreatedAt" TEXT NOT NULL,+ "Email" TEXT NULL,+ "FirstName" VARCHAR NULL,+ "Gender" VARCHAR NULL,+ "LastName" VARCHAR NULL,+ "NickName" VARCHAR NULL,+ "UpdatedAt" TEXT NOT NULL+);++INSERT INTO "ef_temp_Aliases" ("Id", "BirthDate", "CreatedAt", "Email", "FirstName", "Gender", "LastName", "NickName", "UpdatedAt")+SELECT "Id", "BirthDate", "CreatedAt", "Email", "FirstName", "Gender", "LastName", "NickName", "UpdatedAt"+FROM "Aliases";++COMMIT;++PRAGMA foreign_keys = 0;++BEGIN TRANSACTION;+DROP TABLE "Aliases";++ALTER TABLE "ef_temp_Aliases" RENAME TO "Aliases";++COMMIT;++PRAGMA foreign_keys = 1;++INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion")+VALUES ('20240805122422_1.3.0-UpdateIdentityStructure', '9.0.4');++BEGIN TRANSACTION;+CREATE TABLE "ef_temp_Credentials" (+ "Id" TEXT NOT NULL CONSTRAINT "PK_Credentials" PRIMARY KEY,+ "AliasId" TEXT NOT NULL,+ "CreatedAt" TEXT NOT NULL,+ "Notes" TEXT NULL,+ "ServiceId" TEXT NOT NULL,+ "UpdatedAt" TEXT NOT NULL,+ "Username" TEXT NULL,+ CONSTRAINT "FK_Credentials_Aliases_AliasId" FOREIGN KEY ("AliasId") REFERENCES "Aliases" ("Id") ON DELETE CASCADE,+ CONSTRAINT "FK_Credentials_Services_ServiceId" FOREIGN KEY ("ServiceId") REFERENCES "Services" ("Id") ON DELETE CASCADE+);++INSERT INTO "ef_temp_Credentials" ("Id", "AliasId", "CreatedAt", "Notes", "ServiceId", "UpdatedAt", "Username")+SELECT "Id", "AliasId", "CreatedAt", "Notes", "ServiceId", "UpdatedAt", "Username"+FROM "Credentials";++COMMIT;++PRAGMA foreign_keys = 0;++BEGIN TRANSACTION;+DROP TABLE "Credentials";++ALTER TABLE "ef_temp_Credentials" RENAME TO "Credentials";++COMMIT;++PRAGMA foreign_keys = 1;++BEGIN TRANSACTION;+CREATE INDEX "IX_Credentials_AliasId" ON "Credentials" ("AliasId");++CREATE INDEX "IX_Credentials_ServiceId" ON "Credentials" ("ServiceId");++COMMIT;++INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion")+VALUES ('20240812141727_1.3.1-MakeUsernameOptional', '9.0.4');++BEGIN TRANSACTION;+ALTER TABLE "Settings" ADD "IsDeleted" INTEGER NOT NULL DEFAULT 0;++ALTER TABLE "Services" ADD "IsDeleted" INTEGER NOT NULL DEFAULT 0;++ALTER TABLE "Passwords" ADD "IsDeleted" INTEGER NOT NULL DEFAULT 0;++ALTER TABLE "EncryptionKeys" ADD "IsDeleted" INTEGER NOT NULL DEFAULT 0;++ALTER TABLE "Credentials" ADD "IsDeleted" INTEGER NOT NULL DEFAULT 0;++ALTER TABLE "Attachment" ADD "IsDeleted" INTEGER NOT NULL DEFAULT 0;++ALTER TABLE "Aliases" ADD "IsDeleted" INTEGER NOT NULL DEFAULT 0;++INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion")+VALUES ('20240916105320_1.4.0-AddSyncSupport', '9.0.4');++ALTER TABLE "Attachment" RENAME TO "Attachments";++CREATE TABLE "ef_temp_Attachments" (+ "Id" TEXT NOT NULL CONSTRAINT "PK_Attachments" PRIMARY KEY,+ "Blob" BLOB NOT NULL,+ "CreatedAt" TEXT NOT NULL,+ "CredentialId" TEXT NOT NULL,+ "Filename" TEXT NOT NULL,+ "IsDeleted" INTEGER NOT NULL,+ "UpdatedAt" TEXT NOT NULL,+ CONSTRAINT "FK_Attachments_Credentials_CredentialId" FOREIGN KEY ("CredentialId") REFERENCES "Credentials" ("Id") ON DELETE CASCADE+);++INSERT INTO "ef_temp_Attachments" ("Id", "Blob", "CreatedAt", "CredentialId", "Filename", "IsDeleted", "UpdatedAt")+SELECT "Id", "Blob", "CreatedAt", "CredentialId", "Filename", "IsDeleted", "UpdatedAt"+FROM "Attachments";++COMMIT;++PRAGMA foreign_keys = 0;++BEGIN TRANSACTION;+DROP TABLE "Attachments";++ALTER TABLE "ef_temp_Attachments" RENAME TO "Attachments";++COMMIT;++PRAGMA foreign_keys = 1;++BEGIN TRANSACTION;+CREATE INDEX "IX_Attachments_CredentialId" ON "Attachments" ("CredentialId");++COMMIT;++INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion")+VALUES ('20240917191243_1.4.1-RenameAttachmentsPlural', '9.0.4');++BEGIN TRANSACTION;+CREATE TABLE "TotpCodes" (+ "Id" TEXT NOT NULL CONSTRAINT "PK_TotpCodes" PRIMARY KEY,+ "Name" TEXT NOT NULL,+ "SecretKey" TEXT NOT NULL,+ "CredentialId" TEXT NOT NULL,+ "CreatedAt" TEXT NOT NULL,+ "UpdatedAt" TEXT NOT NULL,+ "IsDeleted" INTEGER NOT NULL,+ CONSTRAINT "FK_TotpCodes_Credentials_CredentialId" FOREIGN KEY ("CredentialId") REFERENCES "Credentials" ("Id") ON DELETE CASCADE+);++CREATE INDEX "IX_TotpCodes_CredentialId" ON "TotpCodes" ("CredentialId");++INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion")+VALUES ('20250310131554_1.5.0-AddTotpCodes', '9.0.4');++COMMIT;+diff --git a/apps/server/Databases/AliasClientDb/Scripts/MigrationSql/001_20240708094944_1.0.0-InitialMigration_to_20240708224522_1.0.1-EmptyTestMigration.sql b/apps/server/Databases/AliasClientDb/Scripts/MigrationSql/001_20240708094944_1.0.0-InitialMigration_to_20240708224522_1.0.1-EmptyTestMigration.sqlnew file mode 100644index 000000000..e05eed70a--- /dev/null+++ b/apps/server/Databases/AliasClientDb/Scripts/MigrationSql/001_20240708094944_1.0.0-InitialMigration_to_20240708224522_1.0.1-EmptyTestMigration.sql@@ -0,0 +1,6 @@+BEGIN TRANSACTION;+INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion")+VALUES ('20240708224522_1.0.1-EmptyTestMigration', '9.0.4');++COMMIT;+diff --git a/apps/server/Databases/AliasClientDb/Scripts/MigrationSql/002_20240708224522_1.0.1-EmptyTestMigration_to_20240711204207_1.0.2-ChangeEmailColumn.sql b/apps/server/Databases/AliasClientDb/Scripts/MigrationSql/002_20240708224522_1.0.1-EmptyTestMigration_to_20240711204207_1.0.2-ChangeEmailColumn.sqlnew file mode 100644index 000000000..680a72ac5--- /dev/null+++ b/apps/server/Databases/AliasClientDb/Scripts/MigrationSql/002_20240708224522_1.0.1-EmptyTestMigration_to_20240711204207_1.0.2-ChangeEmailColumn.sql@@ -0,0 +1,8 @@+BEGIN TRANSACTION;+ALTER TABLE "Aliases" RENAME COLUMN "EmailPrefix" TO "Email";++INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion")+VALUES ('20240711204207_1.0.2-ChangeEmailColumn', '9.0.4');++COMMIT;+diff --git a/apps/server/Databases/AliasClientDb/Scripts/MigrationSql/003_20240711204207_1.0.2-ChangeEmailColumn_to_20240729105618_1.1.0-AddPkiTables.sql b/apps/server/Databases/AliasClientDb/Scripts/MigrationSql/003_20240711204207_1.0.2-ChangeEmailColumn_to_20240729105618_1.1.0-AddPkiTables.sqlnew file mode 100644index 000000000..93232daf9--- /dev/null+++ b/apps/server/Databases/AliasClientDb/Scripts/MigrationSql/003_20240711204207_1.0.2-ChangeEmailColumn_to_20240729105618_1.1.0-AddPkiTables.sql@@ -0,0 +1,15 @@+BEGIN TRANSACTION;+CREATE TABLE "EncryptionKeys" (+ "Id" TEXT NOT NULL CONSTRAINT "PK_EncryptionKeys" PRIMARY KEY,+ "PublicKey" TEXT NOT NULL,+ "PrivateKey" TEXT NOT NULL,+ "IsPrimary" INTEGER NOT NULL,+ "CreatedAt" TEXT NOT NULL,+ "UpdatedAt" TEXT NOT NULL+);++INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion")+VALUES ('20240729105618_1.1.0-AddPkiTables', '9.0.4');++COMMIT;+diff --git a/apps/server/Databases/AliasClientDb/Scripts/MigrationSql/004_20240729105618_1.1.0-AddPkiTables_to_20240805073413_1.2.0-AddSettingsTable.sql b/apps/server/Databases/AliasClientDb/Scripts/MigrationSql/004_20240729105618_1.1.0-AddPkiTables_to_20240805073413_1.2.0-AddSettingsTable.sqlnew file mode 100644index 000000000..29ee69a0c--- /dev/null+++ b/apps/server/Databases/AliasClientDb/Scripts/MigrationSql/004_20240729105618_1.1.0-AddPkiTables_to_20240805073413_1.2.0-AddSettingsTable.sql@@ -0,0 +1,13 @@+BEGIN TRANSACTION;+CREATE TABLE "Settings" (+ "Key" TEXT NOT NULL CONSTRAINT "PK_Settings" PRIMARY KEY,+ "Value" TEXT NULL,+ "CreatedAt" TEXT NOT NULL,+ "UpdatedAt" TEXT NOT NULL+);++INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion")+VALUES ('20240805073413_1.2.0-AddSettingsTable', '9.0.4');++COMMIT;+diff --git a/apps/server/Databases/AliasClientDb/Scripts/MigrationSql/005_20240805073413_1.2.0-AddSettingsTable_to_20240805122422_1.3.0-UpdateIdentityStructure.sql b/apps/server/Databases/AliasClientDb/Scripts/MigrationSql/005_20240805073413_1.2.0-AddSettingsTable_to_20240805122422_1.3.0-UpdateIdentityStructure.sqlnew file mode 100644index 000000000..63d274fbd--- /dev/null+++ b/apps/server/Databases/AliasClientDb/Scripts/MigrationSql/005_20240805073413_1.2.0-AddSettingsTable_to_20240805122422_1.3.0-UpdateIdentityStructure.sql@@ -0,0 +1,33 @@+BEGIN TRANSACTION;+CREATE TABLE "ef_temp_Aliases" (+ "Id" TEXT NOT NULL CONSTRAINT "PK_Aliases" PRIMARY KEY,+ "BirthDate" TEXT NOT NULL,+ "CreatedAt" TEXT NOT NULL,+ "Email" TEXT NULL,+ "FirstName" VARCHAR NULL,+ "Gender" VARCHAR NULL,+ "LastName" VARCHAR NULL,+ "NickName" VARCHAR NULL,+ "UpdatedAt" TEXT NOT NULL+);++INSERT INTO "ef_temp_Aliases" ("Id", "BirthDate", "CreatedAt", "Email", "FirstName", "Gender", "LastName", "NickName", "UpdatedAt")+SELECT "Id", "BirthDate", "CreatedAt", "Email", "FirstName", "Gender", "LastName", "NickName", "UpdatedAt"+FROM "Aliases";++COMMIT;++PRAGMA foreign_keys = 0;++BEGIN TRANSACTION;+DROP TABLE "Aliases";++ALTER TABLE "ef_temp_Aliases" RENAME TO "Aliases";++COMMIT;++PRAGMA foreign_keys = 1;++INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion")+VALUES ('20240805122422_1.3.0-UpdateIdentityStructure', '9.0.4');+diff --git a/apps/server/Databases/AliasClientDb/Scripts/MigrationSql/006_20240805122422_1.3.0-UpdateIdentityStructure_to_20240812141727_1.3.1-MakeUsernameOptional.sql b/apps/server/Databases/AliasClientDb/Scripts/MigrationSql/006_20240805122422_1.3.0-UpdateIdentityStructure_to_20240812141727_1.3.1-MakeUsernameOptional.sqlnew file mode 100644index 000000000..534492b75--- /dev/null+++ b/apps/server/Databases/AliasClientDb/Scripts/MigrationSql/006_20240805122422_1.3.0-UpdateIdentityStructure_to_20240812141727_1.3.1-MakeUsernameOptional.sql@@ -0,0 +1,40 @@+BEGIN TRANSACTION;+CREATE TABLE "ef_temp_Credentials" (+ "Id" TEXT NOT NULL CONSTRAINT "PK_Credentials" PRIMARY KEY,+ "AliasId" TEXT NOT NULL,+ "CreatedAt" TEXT NOT NULL,+ "Notes" TEXT NULL,+ "ServiceId" TEXT NOT NULL,+ "UpdatedAt" TEXT NOT NULL,+ "Username" TEXT NULL,+ CONSTRAINT "FK_Credentials_Aliases_AliasId" FOREIGN KEY ("AliasId") REFERENCES "Aliases" ("Id") ON DELETE CASCADE,+ CONSTRAINT "FK_Credentials_Services_ServiceId" FOREIGN KEY ("ServiceId") REFERENCES "Services" ("Id") ON DELETE CASCADE+);++INSERT INTO "ef_temp_Credentials" ("Id", "AliasId", "CreatedAt", "Notes", "ServiceId", "UpdatedAt", "Username")+SELECT "Id", "AliasId", "CreatedAt", "Notes", "ServiceId", "UpdatedAt", "Username"+FROM "Credentials";++COMMIT;++PRAGMA foreign_keys = 0;++BEGIN TRANSACTION;+DROP TABLE "Credentials";++ALTER TABLE "ef_temp_Credentials" RENAME TO "Credentials";++COMMIT;++PRAGMA foreign_keys = 1;++BEGIN TRANSACTION;+CREATE INDEX "IX_Credentials_AliasId" ON "Credentials" ("AliasId");++CREATE INDEX "IX_Credentials_ServiceId" ON "Credentials" ("ServiceId");++COMMIT;++INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion")+VALUES ('20240812141727_1.3.1-MakeUsernameOptional', '9.0.4');+diff --git a/apps/server/Databases/AliasClientDb/Scripts/MigrationSql/007_20240812141727_1.3.1-MakeUsernameOptional_to_20240916105320_1.4.0-AddSyncSupport.sql b/apps/server/Databases/AliasClientDb/Scripts/MigrationSql/007_20240812141727_1.3.1-MakeUsernameOptional_to_20240916105320_1.4.0-AddSyncSupport.sqlnew file mode 100644index 000000000..698030669--- /dev/null+++ b/apps/server/Databases/AliasClientDb/Scripts/MigrationSql/007_20240812141727_1.3.1-MakeUsernameOptional_to_20240916105320_1.4.0-AddSyncSupport.sql@@ -0,0 +1,20 @@+BEGIN TRANSACTION;+ALTER TABLE "Settings" ADD "IsDeleted" INTEGER NOT NULL DEFAULT 0;++ALTER TABLE "Services" ADD "IsDeleted" INTEGER NOT NULL DEFAULT 0;++ALTER TABLE "Passwords" ADD "IsDeleted" INTEGER NOT NULL DEFAULT 0;++ALTER TABLE "EncryptionKeys" ADD "IsDeleted" INTEGER NOT NULL DEFAULT 0;++ALTER TABLE "Credentials" ADD "IsDeleted" INTEGER NOT NULL DEFAULT 0;++ALTER TABLE "Attachment" ADD "IsDeleted" INTEGER NOT NULL DEFAULT 0;++ALTER TABLE "Aliases" ADD "IsDeleted" INTEGER NOT NULL DEFAULT 0;++INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion")+VALUES ('20240916105320_1.4.0-AddSyncSupport', '9.0.4');++COMMIT;+diff --git a/apps/server/Databases/AliasClientDb/Scripts/MigrationSql/008_20240916105320_1.4.0-AddSyncSupport_to_20240917191243_1.4.1-RenameAttachmentsPlural.sql b/apps/server/Databases/AliasClientDb/Scripts/MigrationSql/008_20240916105320_1.4.0-AddSyncSupport_to_20240917191243_1.4.1-RenameAttachmentsPlural.sqlnew file mode 100644index 000000000..4c23ed4f2--- /dev/null+++ b/apps/server/Databases/AliasClientDb/Scripts/MigrationSql/008_20240916105320_1.4.0-AddSyncSupport_to_20240917191243_1.4.1-RenameAttachmentsPlural.sql@@ -0,0 +1,39 @@+BEGIN TRANSACTION;+ALTER TABLE "Attachment" RENAME TO "Attachments";++CREATE TABLE "ef_temp_Attachments" (+ "Id" TEXT NOT NULL CONSTRAINT "PK_Attachments" PRIMARY KEY,+ "Blob" BLOB NOT NULL,+ "CreatedAt" TEXT NOT NULL,+ "CredentialId" TEXT NOT NULL,+ "Filename" TEXT NOT NULL,+ "IsDeleted" INTEGER NOT NULL,+ "UpdatedAt" TEXT NOT NULL,+ CONSTRAINT "FK_Attachments_Credentials_CredentialId" FOREIGN KEY ("CredentialId") REFERENCES "Credentials" ("Id") ON DELETE CASCADE+);++INSERT INTO "ef_temp_Attachments" ("Id", "Blob", "CreatedAt", "CredentialId", "Filename", "IsDeleted", "UpdatedAt")+SELECT "Id", "Blob", "CreatedAt", "CredentialId", "Filename", "IsDeleted", "UpdatedAt"+FROM "Attachments";++COMMIT;++PRAGMA foreign_keys = 0;++BEGIN TRANSACTION;+DROP TABLE "Attachments";++ALTER TABLE "ef_temp_Attachments" RENAME TO "Attachments";++COMMIT;++PRAGMA foreign_keys = 1;++BEGIN TRANSACTION;+CREATE INDEX "IX_Attachments_CredentialId" ON "Attachments" ("CredentialId");++COMMIT;++INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion")+VALUES ('20240917191243_1.4.1-RenameAttachmentsPlural', '9.0.4');+diff --git a/apps/server/Databases/AliasClientDb/Scripts/MigrationSql/009_20240917191243_1.4.1-RenameAttachmentsPlural_to_20250310131554_1.5.0-AddTotpCodes.sql b/apps/server/Databases/AliasClientDb/Scripts/MigrationSql/009_20240917191243_1.4.1-RenameAttachmentsPlural_to_20250310131554_1.5.0-AddTotpCodes.sqlnew file mode 100644index 000000000..531267bdb--- /dev/null+++ b/apps/server/Databases/AliasClientDb/Scripts/MigrationSql/009_20240917191243_1.4.1-RenameAttachmentsPlural_to_20250310131554_1.5.0-AddTotpCodes.sql@@ -0,0 +1,19 @@+BEGIN TRANSACTION;+CREATE TABLE "TotpCodes" (+ "Id" TEXT NOT NULL CONSTRAINT "PK_TotpCodes" PRIMARY KEY,+ "Name" TEXT NOT NULL,+ "SecretKey" TEXT NOT NULL,+ "CredentialId" TEXT NOT NULL,+ "CreatedAt" TEXT NOT NULL,+ "UpdatedAt" TEXT NOT NULL,+ "IsDeleted" INTEGER NOT NULL,+ CONSTRAINT "FK_TotpCodes_Credentials_CredentialId" FOREIGN KEY ("CredentialId") REFERENCES "Credentials" ("Id") ON DELETE CASCADE+);++CREATE INDEX "IX_TotpCodes_CredentialId" ON "TotpCodes" ("CredentialId");++INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion")+VALUES ('20250310131554_1.5.0-AddTotpCodes', '9.0.4');++COMMIT;+