Skip to content

Commit 567b7c7

Browse files
committed
Fix migrations test
1 parent 29bed1e commit 567b7c7

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

indexer/packages/postgres/__tests__/db/migrations.test.ts

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ import {
1010
} from '../helpers/constants';
1111
import { seedData } from '../helpers/mock-generators';
1212

13-
// NOTE: If a model is modified for a migration then these
14-
// tests must be skipped until the following migration
1513
describe('Test new migration', () => {
1614
beforeEach(async () => {
1715
await migrate();
@@ -25,29 +23,44 @@ describe('Test new migration', () => {
2523
await teardown();
2624
});
2725

28-
it('test adding most recent migration', async () => {
26+
it('test UP and DOWN for most recent migration without seed data', async () => {
27+
// remove latest migration
28+
await multiDown(1);
29+
30+
// re-add latest migration
31+
await knexPrimary.migrate.latest({ loadExtensions: ['.js'] });
32+
33+
// re-remove latest migration
34+
await multiDown(1);
35+
});
36+
37+
// NOTE: If a model is modified for a migration then these
38+
// tests must be skipped until the following migration
39+
it.skip('[Will fail if a model is modified for migration - see README] test adding most recent migration', async () => {
2940
// remove latest migration
3041
await multiDown(1);
3142

3243
// add data to verify you can roll up and then later roll down
3344
await seedData();
3445

35-
// readd latest migration
46+
// re-add latest migration
3647
await knexPrimary.migrate.latest({ loadExtensions: ['.js'] });
3748

3849
// re-remove latest migration
3950
await multiDown(1);
4051
});
4152

42-
it('test adding most recent migration with rows that fail index that should only be applied going forward', async () => {
53+
// NOTE: If a model is modified for a migration then these
54+
// tests must be skipped until the following migration
55+
it.skip('[Will fail if a model is modified for migration - see README] test adding most recent migration with rows that fail index that should only be applied going forward', async () => {
4356
// remove latest migration
4457
await multiDown(1);
4558

4659
// add data to verify you can roll up and then later roll down
4760
await seedData();
4861
await OrderTable.create(defaultOrder);
4962

50-
// readd latest migration
63+
// re-add latest migration
5164
await knexPrimary.migrate.latest({ loadExtensions: ['.js'] });
5265

5366
// re-remove latest migration

0 commit comments

Comments
 (0)