mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-29 08:00:06 +00:00
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:
@@ -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',
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user