fix(auth): user_created_at migration non constant defaults to remedy SQLiteError

Signed-off-by: Justin Bryant <justintbry@gmail.com>
This commit is contained in:
Justin Bryant
2025-11-17 13:05:25 -05:00
parent c53629a2af
commit 7ffc873b78
2 changed files with 18 additions and 1 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-auth-backend': minor
---
Fix user_created_at migration causing SQLiteError regarding use of non-constants for defaults
@@ -22,7 +22,19 @@
exports.up = async function up(knex) {
await knex.schema.alterTable('user_info', table => {
table.renameColumn('exp', 'updated_at');
table.timestamp('created_at').notNullable().defaultTo(knex.fn.now());
table.timestamp('created_at').nullable();
});
await knex('user_info').update({
created_at: knex.fn.now(),
});
await knex.schema.alterTable('user_info', table => {
table
.timestamp('created_at')
.notNullable()
.defaultTo(knex.fn.now())
.alter();
});
};