v0.12.1 FCM db update

This commit is contained in:
2026-03-22 21:21:57 -04:00
parent 8e05d02695
commit ef3935560d
4 changed files with 23 additions and 2 deletions

View File

@@ -350,6 +350,21 @@ async function initDb() {
await seedAdmin('public');
await seedUserGroups('public');
// Host mode: run migrations on all existing tenant schemas so new migrations
// (e.g. 007_fcm_push) are applied to tenants that were created before the migration existed.
if (APP_TYPE === 'host') {
const tenantResult = await pool.query(
"SELECT schema_name FROM information_schema.schemata WHERE schema_name LIKE 'tenant_%'"
);
for (const row of tenantResult.rows) {
console.log(`[DB] Running migrations for tenant schema: ${row.schema_name}`);
await runMigrations(row.schema_name);
await seedSettings(row.schema_name);
await seedEventTypes(row.schema_name);
await seedUserGroups(row.schema_name);
}
}
// Host mode: the public schema is the host's own workspace — always full RosterChirp-Team plan.
// ON CONFLICT DO UPDATE ensures existing installs get corrected on restart too.
if (APP_TYPE === 'host') {