fix(migrations): backfill role.key column in down migration

This commit is contained in:
Ali BARIN
2024-09-04 11:30:39 +00:00
parent 63dfb6947e
commit 5591f6ccc9

View File

@@ -5,7 +5,15 @@ export async function up(knex) {
} }
export async function down(knex) { export async function down(knex) {
await knex.schema.alterTable('roles', function (table) {
table.string('key');
});
await knex('roles').update({
key: knex.raw('LOWER(??)', ['name']),
});
return await knex.schema.alterTable('roles', function (table) { return await knex.schema.alterTable('roles', function (table) {
table.string('key').notNullable(); table.string('key').notNullable().alter();
}); });
} }