Skip to content

Commit d6565da

Browse files
committed
fix: add public.knex_migrations
1 parent 1c91b4b commit d6565da

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

src/utils.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ export async function getInsertsFromMigrations(migrationsPath) {
55
const migrations = await readdir(migrationsPath)
66
return migrations.map(
77
migration =>
8-
`INSERT INTO knex_migrations(name, batch, migration_time) VALUES ('${migration}', 1, NOW());`,
8+
`INSERT INTO public.knex_migrations(name, batch, migration_time) VALUES ('${migration}', 1, NOW());`,
99
)
1010
}
1111

1212
export async function getInsertsFromStructure(structurePath) {
1313
if (!(await exists(structurePath))) return []
1414
const structure = await readFile(structurePath, 'utf-8')
15-
const regExp = /INSERT INTO knex_migrations\(name, batch, migration_time\) VALUES \('.*', 1, NOW\(\)\);/g
15+
const regExp = /INSERT INTO public\.knex_migrations\(name, batch, migration_time\) VALUES \('.*', 1, NOW\(\)\);/g
1616

1717
const inserts = []
1818

test/__fixtures__/structure.sql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
2626

2727
-- Knex migrations
2828

29-
INSERT INTO knex_migrations(name, batch, migration_time) VALUES ('20180207153033_migration_1.js', 1, NOW());
30-
INSERT INTO knex_migrations(name, batch, migration_time) VALUES ('20180207153040_migration_2.js', 1, NOW());
31-
INSERT INTO knex_migrations(name, batch, migration_time) VALUES ('20180207153050_migration_3.js', 1, NOW());
29+
INSERT INTO public.knex_migrations(name, batch, migration_time) VALUES ('20180207153033_migration_1.js', 1, NOW());
30+
INSERT INTO public.knex_migrations(name, batch, migration_time) VALUES ('20180207153040_migration_2.js', 1, NOW());
31+
INSERT INTO public.knex_migrations(name, batch, migration_time) VALUES ('20180207153050_migration_3.js', 1, NOW());

test/utils.test.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ describe('#getInsertsFromMigrations', () => {
1414
path.join(__dirname, '__fixtures__/migrations'),
1515
)
1616
expect(inserts).toEqual([
17-
`INSERT INTO knex_migrations(name, batch, migration_time) VALUES ('20180207153033_migration_1.js', 1, NOW());`,
18-
`INSERT INTO knex_migrations(name, batch, migration_time) VALUES ('20180207153040_migration_2.js', 1, NOW());`,
17+
`INSERT INTO public.knex_migrations(name, batch, migration_time) VALUES ('20180207153033_migration_1.js', 1, NOW());`,
18+
`INSERT INTO public.knex_migrations(name, batch, migration_time) VALUES ('20180207153040_migration_2.js', 1, NOW());`,
1919
])
2020
})
2121
})
@@ -33,9 +33,9 @@ describe('#getInsertsFromStructure', () => {
3333
path.join(__dirname, '__fixtures__/structure.sql'),
3434
)
3535
expect(inserts).toEqual([
36-
`INSERT INTO knex_migrations(name, batch, migration_time) VALUES ('20180207153033_migration_1.js', 1, NOW());`,
37-
`INSERT INTO knex_migrations(name, batch, migration_time) VALUES ('20180207153040_migration_2.js', 1, NOW());`,
38-
`INSERT INTO knex_migrations(name, batch, migration_time) VALUES ('20180207153050_migration_3.js', 1, NOW());`,
36+
`INSERT INTO public.knex_migrations(name, batch, migration_time) VALUES ('20180207153033_migration_1.js', 1, NOW());`,
37+
`INSERT INTO public.knex_migrations(name, batch, migration_time) VALUES ('20180207153040_migration_2.js', 1, NOW());`,
38+
`INSERT INTO public.knex_migrations(name, batch, migration_time) VALUES ('20180207153050_migration_3.js', 1, NOW());`,
3939
])
4040
})
4141
})

0 commit comments

Comments
 (0)