catalog-backend: fix migration script not using uuid for ID

This commit is contained in:
Patrik Oldsberg
2020-08-13 01:02:44 +02:00
parent 4a58445d33
commit aea535b0aa
3 changed files with 6 additions and 5 deletions
@@ -23,7 +23,7 @@ exports.up = async function up(knex) {
// Adds a single 'bootstrap' location that can be used to trigger work in processors.
// This is primarily here to fulfill foreign key constraints.
await knex('locations').insert({
id: 'bootstrap',
id: require('uuid').v4(),
type: 'bootstrap',
target: 'bootstrap',
});
@@ -35,7 +35,8 @@ exports.up = async function up(knex) {
exports.down = async function down(knex) {
await knex('locations')
.where({
id: 'bootstrap',
type: 'bootstrap',
target: 'bootstrap',
})
.del();
};
@@ -18,7 +18,7 @@ import { DatabaseManager } from '../database';
import { DatabaseLocationsCatalog } from './DatabaseLocationsCatalog';
const bootstrapLocation = {
id: 'bootstrap',
id: expect.any(String),
type: 'bootstrap',
target: 'bootstrap',
};
@@ -25,7 +25,7 @@ import type {
} from './types';
const bootstrapLocation = {
id: 'bootstrap',
id: expect.any(String),
type: 'bootstrap',
target: 'bootstrap',
message: null,
@@ -98,7 +98,7 @@ describe('CommonDatabase', () => {
expect.arrayContaining([output, bootstrapLocation]),
);
const location = await db.location(
locations.find(l => l.id !== 'bootstrap')!.id,
locations.find(l => l.type !== 'bootstrap')!.id,
);
expect(location).toEqual(output);