feat(isac): add moderated contributor mode

This commit is contained in:
JB
2026-07-25 13:59:45 -04:00
parent d495cd585a
commit 32dbef822b
20 changed files with 353 additions and 36 deletions
+12
View File
@@ -81,6 +81,18 @@ for (const [name, definition] of [
}
}
const proposalColumns = await (await database.prepare("PRAGMA table_info('data_change_proposals')")).all();
for (const [name, definition] of [
['draft_entity_id', 'TEXT'],
['applied_entity_id', 'TEXT']
]) {
if (!proposalColumns.some((column) => column.name === name)) {
await database.exec(`ALTER TABLE data_change_proposals ADD COLUMN ${name} ${definition}`);
}
}
await database.exec("UPDATE data_change_proposals SET draft_entity_id=id WHERE draft_entity_id IS NULL AND entity_id IS NULL");
await database.exec('CREATE UNIQUE INDEX IF NOT EXISTS data_change_proposals_draft_entity_idx ON data_change_proposals(draft_entity_id) WHERE draft_entity_id IS NOT NULL');
console.log(`Applied ${statements.length} schema statements to ${databasePath}`);
if (!databaseAlreadyExisted) {