Skip to content

Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.

Update vault-sql and remove unnecessary update commands (#957)

Leendert de Borst925455b5d6b3
diff --git a/apps/browser-extension/src/utils/dist/shared/vault-sql/index.js b/apps/browser-extension/src/utils/dist/shared/vault-sql/index.js
index 5181d9248..9136f7721 100644
--- a/apps/browser-extension/src/utils/dist/shared/vault-sql/index.js
+++ b/apps/browser-extension/src/utils/dist/shared/vault-sql/index.js
@@ -546,13 +546,7 @@ var VaultSqlGenerator = class {
getCreateVaultSql() {
try {
const sqlCommands = [
- "PRAGMA foreign_keys = ON;",
- COMPLETE_SCHEMA_SQL,
- // Insert version tracking
- `INSERT INTO "Settings" ("Key", "Value", "CreatedAt", "UpdatedAt", "IsDeleted")
- VALUES ('vault_version', '${VAULT_VERSIONS[VAULT_VERSIONS.length - 1].version}', datetime('now'), datetime('now'), 0);`,
- `INSERT INTO "Settings" ("Key", "Value", "CreatedAt", "UpdatedAt", "IsDeleted")
- VALUES ('vault_migration_number', '${VAULT_VERSIONS[VAULT_VERSIONS.length - 1].revision}', datetime('now'), datetime('now'), 0);`
+ COMPLETE_SCHEMA_SQL
];
return {
success: true,
@@ -597,21 +591,13 @@ var VaultSqlGenerator = class {
const migrationsToApply = VAULT_VERSIONS.filter(
(v) => v.revision > currentMigrationNumber && v.revision <= targetMigration
);
- const sqlCommands = ["PRAGMA foreign_keys = ON;"];
+ const sqlCommands = [];
for (const migration of migrationsToApply) {
const migrationSql = MIGRATION_SCRIPTS[migration.revision];
if (migrationSql) {
sqlCommands.push(migrationSql);
}
}
- sqlCommands.push(
- `INSERT OR REPLACE INTO "Settings" ("Key", "Value", "CreatedAt", "UpdatedAt", "IsDeleted")
- VALUES ('vault_version', '${targetVersionInfo.version}', datetime('now'), datetime('now'), 0);`
- );
- sqlCommands.push(
- `INSERT OR REPLACE INTO "Settings" ("Key", "Value", "CreatedAt", "UpdatedAt", "IsDeleted")
- VALUES ('vault_migration_number', '${targetMigration}', datetime('now'), datetime('now'), 0);`
- );
return {
success: true,
sqlCommands,
diff --git a/apps/browser-extension/src/utils/dist/shared/vault-sql/index.mjs b/apps/browser-extension/src/utils/dist/shared/vault-sql/index.mjs
index fe517740b..b9eae1f04 100644
--- a/apps/browser-extension/src/utils/dist/shared/vault-sql/index.mjs
+++ b/apps/browser-extension/src/utils/dist/shared/vault-sql/index.mjs
@@ -517,13 +517,7 @@ var VaultSqlGenerator = class {
getCreateVaultSql() {
try {
const sqlCommands = [
- "PRAGMA foreign_keys = ON;",
- COMPLETE_SCHEMA_SQL,
- // Insert version tracking
- `INSERT INTO "Settings" ("Key", "Value", "CreatedAt", "UpdatedAt", "IsDeleted")
- VALUES ('vault_version', '${VAULT_VERSIONS[VAULT_VERSIONS.length - 1].version}', datetime('now'), datetime('now'), 0);`,
- `INSERT INTO "Settings" ("Key", "Value", "CreatedAt", "UpdatedAt", "IsDeleted")
- VALUES ('vault_migration_number', '${VAULT_VERSIONS[VAULT_VERSIONS.length - 1].revision}', datetime('now'), datetime('now'), 0);`
+ COMPLETE_SCHEMA_SQL
];
return {
success: true,
@@ -568,21 +562,13 @@ var VaultSqlGenerator = class {
const migrationsToApply = VAULT_VERSIONS.filter(
(v) => v.revision > currentMigrationNumber && v.revision <= targetMigration
);
- const sqlCommands = ["PRAGMA foreign_keys = ON;"];
+ const sqlCommands = [];
for (const migration of migrationsToApply) {
const migrationSql = MIGRATION_SCRIPTS[migration.revision];
if (migrationSql) {
sqlCommands.push(migrationSql);
}
}
- sqlCommands.push(
- `INSERT OR REPLACE INTO "Settings" ("Key", "Value", "CreatedAt", "UpdatedAt", "IsDeleted")
- VALUES ('vault_version', '${targetVersionInfo.version}', datetime('now'), datetime('now'), 0);`
- );
- sqlCommands.push(
- `INSERT OR REPLACE INTO "Settings" ("Key", "Value", "CreatedAt", "UpdatedAt", "IsDeleted")
- VALUES ('vault_migration_number', '${targetMigration}', datetime('now'), datetime('now'), 0);`
- );
return {
success: true,
sqlCommands,
diff --git a/apps/mobile-app/utils/dist/shared/vault-sql/index.js b/apps/mobile-app/utils/dist/shared/vault-sql/index.js
index 5181d9248..9136f7721 100644
--- a/apps/mobile-app/utils/dist/shared/vault-sql/index.js
+++ b/apps/mobile-app/utils/dist/shared/vault-sql/index.js
@@ -546,13 +546,7 @@ var VaultSqlGenerator = class {
getCreateVaultSql() {
try {
const sqlCommands = [
- "PRAGMA foreign_keys = ON;",
- COMPLETE_SCHEMA_SQL,
- // Insert version tracking
- `INSERT INTO "Settings" ("Key", "Value", "CreatedAt", "UpdatedAt", "IsDeleted")
- VALUES ('vault_version', '${VAULT_VERSIONS[VAULT_VERSIONS.length - 1].version}', datetime('now'), datetime('now'), 0);`,
- `INSERT INTO "Settings" ("Key", "Value", "CreatedAt", "UpdatedAt", "IsDeleted")
- VALUES ('vault_migration_number', '${VAULT_VERSIONS[VAULT_VERSIONS.length - 1].revision}', datetime('now'), datetime('now'), 0);`
+ COMPLETE_SCHEMA_SQL
];
return {
success: true,
@@ -597,21 +591,13 @@ var VaultSqlGenerator = class {
const migrationsToApply = VAULT_VERSIONS.filter(
(v) => v.revision > currentMigrationNumber && v.revision <= targetMigration
);
- const sqlCommands = ["PRAGMA foreign_keys = ON;"];
+ const sqlCommands = [];
for (const migration of migrationsToApply) {
const migrationSql = MIGRATION_SCRIPTS[migration.revision];
if (migrationSql) {
sqlCommands.push(migrationSql);
}
}
- sqlCommands.push(
- `INSERT OR REPLACE INTO "Settings" ("Key", "Value", "CreatedAt", "UpdatedAt", "IsDeleted")
- VALUES ('vault_version', '${targetVersionInfo.version}', datetime('now'), datetime('now'), 0);`
- );
- sqlCommands.push(
- `INSERT OR REPLACE INTO "Settings" ("Key", "Value", "CreatedAt", "UpdatedAt", "IsDeleted")
- VALUES ('vault_migration_number', '${targetMigration}', datetime('now'), datetime('now'), 0);`
- );
return {
success: true,
sqlCommands,
diff --git a/apps/mobile-app/utils/dist/shared/vault-sql/index.mjs b/apps/mobile-app/utils/dist/shared/vault-sql/index.mjs
index fe517740b..b9eae1f04 100644
--- a/apps/mobile-app/utils/dist/shared/vault-sql/index.mjs
+++ b/apps/mobile-app/utils/dist/shared/vault-sql/index.mjs
@@ -517,13 +517,7 @@ var VaultSqlGenerator = class {
getCreateVaultSql() {
try {
const sqlCommands = [
- "PRAGMA foreign_keys = ON;",
- COMPLETE_SCHEMA_SQL,
- // Insert version tracking
- `INSERT INTO "Settings" ("Key", "Value", "CreatedAt", "UpdatedAt", "IsDeleted")
- VALUES ('vault_version', '${VAULT_VERSIONS[VAULT_VERSIONS.length - 1].version}', datetime('now'), datetime('now'), 0);`,
- `INSERT INTO "Settings" ("Key", "Value", "CreatedAt", "UpdatedAt", "IsDeleted")
- VALUES ('vault_migration_number', '${VAULT_VERSIONS[VAULT_VERSIONS.length - 1].revision}', datetime('now'), datetime('now'), 0);`
+ COMPLETE_SCHEMA_SQL
];
return {
success: true,
@@ -568,21 +562,13 @@ var VaultSqlGenerator = class {
const migrationsToApply = VAULT_VERSIONS.filter(
(v) => v.revision > currentMigrationNumber && v.revision <= targetMigration
);
- const sqlCommands = ["PRAGMA foreign_keys = ON;"];
+ const sqlCommands = [];
for (const migration of migrationsToApply) {
const migrationSql = MIGRATION_SCRIPTS[migration.revision];
if (migrationSql) {
sqlCommands.push(migrationSql);
}
}
- sqlCommands.push(
- `INSERT OR REPLACE INTO "Settings" ("Key", "Value", "CreatedAt", "UpdatedAt", "IsDeleted")
- VALUES ('vault_version', '${targetVersionInfo.version}', datetime('now'), datetime('now'), 0);`
- );
- sqlCommands.push(
- `INSERT OR REPLACE INTO "Settings" ("Key", "Value", "CreatedAt", "UpdatedAt", "IsDeleted")
- VALUES ('vault_migration_number', '${targetMigration}', datetime('now'), datetime('now'), 0);`
- );
return {
success: true,
sqlCommands,
diff --git a/apps/server/AliasVault.Client/wwwroot/js/dist/shared/vault-sql/index.js b/apps/server/AliasVault.Client/wwwroot/js/dist/shared/vault-sql/index.js
index 5181d9248..9136f7721 100644
--- a/apps/server/AliasVault.Client/wwwroot/js/dist/shared/vault-sql/index.js
+++ b/apps/server/AliasVault.Client/wwwroot/js/dist/shared/vault-sql/index.js
@@ -546,13 +546,7 @@ var VaultSqlGenerator = class {
getCreateVaultSql() {
try {
const sqlCommands = [
- "PRAGMA foreign_keys = ON;",
- COMPLETE_SCHEMA_SQL,
- // Insert version tracking
- `INSERT INTO "Settings" ("Key", "Value", "CreatedAt", "UpdatedAt", "IsDeleted")
- VALUES ('vault_version', '${VAULT_VERSIONS[VAULT_VERSIONS.length - 1].version}', datetime('now'), datetime('now'), 0);`,
- `INSERT INTO "Settings" ("Key", "Value", "CreatedAt", "UpdatedAt", "IsDeleted")
- VALUES ('vault_migration_number', '${VAULT_VERSIONS[VAULT_VERSIONS.length - 1].revision}', datetime('now'), datetime('now'), 0);`
+ COMPLETE_SCHEMA_SQL
];
return {
success: true,
@@ -597,21 +591,13 @@ var VaultSqlGenerator = class {
const migrationsToApply = VAULT_VERSIONS.filter(
(v) => v.revision > currentMigrationNumber && v.revision <= targetMigration
);
- const sqlCommands = ["PRAGMA foreign_keys = ON;"];
+ const sqlCommands = [];
for (const migration of migrationsToApply) {
const migrationSql = MIGRATION_SCRIPTS[migration.revision];
if (migrationSql) {
sqlCommands.push(migrationSql);
}
}
- sqlCommands.push(
- `INSERT OR REPLACE INTO "Settings" ("Key", "Value", "CreatedAt", "UpdatedAt", "IsDeleted")
- VALUES ('vault_version', '${targetVersionInfo.version}', datetime('now'), datetime('now'), 0);`
- );
- sqlCommands.push(
- `INSERT OR REPLACE INTO "Settings" ("Key", "Value", "CreatedAt", "UpdatedAt", "IsDeleted")
- VALUES ('vault_migration_number', '${targetMigration}', datetime('now'), datetime('now'), 0);`
- );
return {
success: true,
sqlCommands,
diff --git a/apps/server/AliasVault.Client/wwwroot/js/dist/shared/vault-sql/index.mjs b/apps/server/AliasVault.Client/wwwroot/js/dist/shared/vault-sql/index.mjs
index fe517740b..b9eae1f04 100644
--- a/apps/server/AliasVault.Client/wwwroot/js/dist/shared/vault-sql/index.mjs
+++ b/apps/server/AliasVault.Client/wwwroot/js/dist/shared/vault-sql/index.mjs
@@ -517,13 +517,7 @@ var VaultSqlGenerator = class {
getCreateVaultSql() {
try {
const sqlCommands = [
- "PRAGMA foreign_keys = ON;",
- COMPLETE_SCHEMA_SQL,
- // Insert version tracking
- `INSERT INTO "Settings" ("Key", "Value", "CreatedAt", "UpdatedAt", "IsDeleted")
- VALUES ('vault_version', '${VAULT_VERSIONS[VAULT_VERSIONS.length - 1].version}', datetime('now'), datetime('now'), 0);`,
- `INSERT INTO "Settings" ("Key", "Value", "CreatedAt", "UpdatedAt", "IsDeleted")
- VALUES ('vault_migration_number', '${VAULT_VERSIONS[VAULT_VERSIONS.length - 1].revision}', datetime('now'), datetime('now'), 0);`
+ COMPLETE_SCHEMA_SQL
];
return {
success: true,
@@ -568,21 +562,13 @@ var VaultSqlGenerator = class {
const migrationsToApply = VAULT_VERSIONS.filter(
(v) => v.revision > currentMigrationNumber && v.revision <= targetMigration
);
- const sqlCommands = ["PRAGMA foreign_keys = ON;"];
+ const sqlCommands = [];
for (const migration of migrationsToApply) {
const migrationSql = MIGRATION_SCRIPTS[migration.revision];
if (migrationSql) {
sqlCommands.push(migrationSql);
}
}
- sqlCommands.push(
- `INSERT OR REPLACE INTO "Settings" ("Key", "Value", "CreatedAt", "UpdatedAt", "IsDeleted")
- VALUES ('vault_version', '${targetVersionInfo.version}', datetime('now'), datetime('now'), 0);`
- );
- sqlCommands.push(
- `INSERT OR REPLACE INTO "Settings" ("Key", "Value", "CreatedAt", "UpdatedAt", "IsDeleted")
- VALUES ('vault_migration_number', '${targetMigration}', datetime('now'), datetime('now'), 0);`
- );
return {
success: true,
sqlCommands,
diff --git a/shared/vault-sql/src/sql/VaultSqlGenerator.ts b/shared/vault-sql/src/sql/VaultSqlGenerator.ts
index 59bf7a873..2d5c80751 100644
--- a/shared/vault-sql/src/sql/VaultSqlGenerator.ts
+++ b/shared/vault-sql/src/sql/VaultSqlGenerator.ts
@@ -36,13 +36,7 @@ export class VaultSqlGenerator {
getCreateVaultSql(): SqlGenerationResult {
try {
const sqlCommands = [
- 'PRAGMA foreign_keys = ON;',
COMPLETE_SCHEMA_SQL,
- // Insert version tracking
- `INSERT INTO "Settings" ("Key", "Value", "CreatedAt", "UpdatedAt", "IsDeleted")
- VALUES ('vault_version', '${VAULT_VERSIONS[VAULT_VERSIONS.length - 1].version}', datetime('now'), datetime('now'), 0);`,
- `INSERT INTO "Settings" ("Key", "Value", "CreatedAt", "UpdatedAt", "IsDeleted")
- VALUES ('vault_migration_number', '${VAULT_VERSIONS[VAULT_VERSIONS.length - 1].revision}', datetime('now'), datetime('now'), 0);`
];
return {
@@ -96,7 +90,7 @@ export class VaultSqlGenerator {
v.revision <= targetMigration
);
- const sqlCommands: string[] = ['PRAGMA foreign_keys = ON;'];
+ const sqlCommands: string[] = [];
// Add migration SQL commands
for (const migration of migrationsToApply) {
@@ -106,16 +100,6 @@ export class VaultSqlGenerator {
}
}
- // Update version tracking
- sqlCommands.push(
- `INSERT OR REPLACE INTO "Settings" ("Key", "Value", "CreatedAt", "UpdatedAt", "IsDeleted")
- VALUES ('vault_version', '${targetVersionInfo.version}', datetime('now'), datetime('now'), 0);`
- );
- sqlCommands.push(
- `INSERT OR REPLACE INTO "Settings" ("Key", "Value", "CreatedAt", "UpdatedAt", "IsDeleted")
- VALUES ('vault_migration_number', '${targetMigration}', datetime('now'), datetime('now'), 0);`
- );
-
return {
success: true,
sqlCommands,