fix(core): preserve credential schema compatibility

This commit is contained in:
Dax Raad 2026-06-12 02:45:25 -04:00
commit 7793db3ac8
6 changed files with 100 additions and 36 deletions

View file

@ -5,11 +5,21 @@ export default {
id: "20260611192811_lush_chimera",
up(tx) {
return Effect.gen(function* () {
yield* tx.run(`ALTER TABLE \`credential\` ADD \`integration_id\` text NOT NULL;`)
yield* tx.run(`DROP INDEX IF EXISTS \`credential_connector_active_idx\`;`)
yield* tx.run(`ALTER TABLE \`credential\` DROP COLUMN \`connector_id\`;`)
yield* tx.run(`ALTER TABLE \`credential\` DROP COLUMN \`method_id\`;`)
yield* tx.run(`ALTER TABLE \`credential\` DROP COLUMN \`active\`;`)
yield* tx.run(`DROP TABLE \`credential\`;`)
yield* tx.run(`
CREATE TABLE \`credential\` (
\`id\` text PRIMARY KEY,
\`integration_id\` text,
\`label\` text NOT NULL,
\`value\` text NOT NULL,
\`connector_id\` text,
\`method_id\` text,
\`active\` integer,
\`time_created\` integer NOT NULL,
\`time_updated\` integer NOT NULL
);
`)
})
},
} satisfies DatabaseMigration.Migration