Add containerized staging deployment
This commit is contained in:
+19
-1
@@ -99,6 +99,22 @@ if (!notificationColumns.some((column) => column.name === 'actions_json')) {
|
||||
await database.exec('ALTER TABLE notifications ADD COLUMN actions_json TEXT');
|
||||
}
|
||||
|
||||
const legacyProtocolEffects = await (await database.prepare(
|
||||
"SELECT 1 AS present FROM sqlite_master WHERE type='table' AND name='os_protocol_attribute_effects'"
|
||||
)).get();
|
||||
if (legacyProtocolEffects) {
|
||||
const legacyProtocolEffectCount = await (await database.prepare(
|
||||
'SELECT COUNT(*) AS count FROM os_protocol_attribute_effects'
|
||||
)).get();
|
||||
if (Number(legacyProtocolEffectCount?.count ?? 0) > 0) {
|
||||
throw new Error(
|
||||
'Legacy OS Protocol attribute effects still contain rows. Export and reconcile them before removing the retired table.'
|
||||
);
|
||||
}
|
||||
console.log('Removing the empty legacy OS Protocol attribute-effects table.');
|
||||
await database.exec('DROP TABLE os_protocol_attribute_effects');
|
||||
}
|
||||
|
||||
const proposalDefinition = await (await database.prepare(
|
||||
"SELECT sql FROM sqlite_master WHERE type='table' AND name='data_change_proposals'"
|
||||
)).get();
|
||||
@@ -355,7 +371,9 @@ await database.exec('CREATE INDEX IF NOT EXISTS builds_visibility_updated_idx ON
|
||||
|
||||
console.log(`Applied ${statements.length} schema statements to ${databasePath}`);
|
||||
|
||||
if (!databaseAlreadyExisted) {
|
||||
if (!databaseAlreadyExisted && process.env.SKIP_DEFAULT_USERS !== 'true') {
|
||||
console.log('New database detected; creating default users.');
|
||||
await initializeDefaultUsers(database);
|
||||
} else if (!databaseAlreadyExisted) {
|
||||
console.log('New database detected; default-user seeding is disabled for this environment.');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user