fix(db): say what a schema difference means when the move to Postgres refuses it

The refusal listed the differences and nothing else. A table or column
only one side has now comes with what that means: the file is at this
version's level, the start that brought it there added every column it
could, the start log names the rest, and the operator keeps running on
SQLite and reports it. A column of TREK's own schema the move cannot copy
is listed apart and named a bug in TREK, since the file is not at fault.
The server guide describes the gap, the repair, the check and the refusal.
This commit is contained in:
Maurice
2026-11-18 15:22:37 +01:00
parent 771dab7c35
commit 85b773420c
5 changed files with 108 additions and 19 deletions
@@ -101,6 +101,7 @@ describe('planTrekTables', () => {
['users', ['id', 'avatar']],
]),
);
expect(plan.differences).toEqual([]);
expect(plan.problems).toEqual([]);
expect(plan.specs.map((spec) => spec.target)).toEqual(['"messages"', '"users"']);
expect(plan.specs[0]).toMatchObject({
@@ -145,13 +146,16 @@ describe('planTrekTables', () => {
['leftover', ['id']],
]),
);
expect(plan.problems).toEqual([
expect(plan.differences).toEqual([
'the SQLite table leftover has no Postgres table',
'the Postgres table extra has no SQLite table',
'the SQLite column messages.legacy has no Postgres column',
'the Postgres column users.avatar has no SQLite column',
]);
// What the schema itself holds that the move cannot copy is kept apart from what the file lacks.
expect(plan.problems).toEqual([
'the Postgres column messages.sent_at has the type timestamp with time zone, which the move does not know',
'messages.reply_to refers back to a table filled later and cannot be NULL meanwhile',
'the Postgres column users.avatar has no SQLite column',
]);
});
});