Fix location key migrations

Co-authored-by: Patrik Oldsberg <poldsberg@gmail.com>

Signed-off-by: Johan Haals <johan.haals@gmail.com>
This commit is contained in:
Johan Haals
2021-06-28 14:04:30 +02:00
committed by Patrik Oldsberg
parent d0a13d227e
commit ba3061f53e
2 changed files with 8 additions and 3 deletions
@@ -65,8 +65,6 @@ exports.up = async function up(knex) {
.dateTime('last_discovery_at') // TODO: timezone or change to epoch-millis or similar
.notNullable()
.comment('The last timestamp of which this entity was discovered');
// TODO: get migrations to work for this field instead. should be removed before merge.
table.text('location_key').nullable().comment('Location key');
table.unique(['entity_ref'], 'refresh_state_entity_ref_uniq');
table.index('entity_id', 'refresh_state_entity_id_idx');
table.index('entity_ref', 'refresh_state_entity_ref_idx');
@@ -21,7 +21,13 @@
*/
exports.up = async function up(knex) {
await knex.schema.alterTable('refresh_state', table => {
table.text('location_key').nullable().comment('').alter();
table
.text('location_key')
.nullable()
.comment(
'An opaque key that uniquely identifies the location of an entity in order to support conflict resolution',
);
// table.index(['location_key'], 'refresh_state_location_key_idx');
});
};
@@ -31,5 +37,6 @@ exports.up = async function up(knex) {
exports.down = async function down(knex) {
await knex.schema.alterTable('refresh_state', table => {
table.dropColumn('location_key');
// table.dropIndex([], 'refresh_state_location_key_idx');
});
};