diff --git a/plugins/auth-backend/migrations/20210326100300_timestamptz.js b/plugins/auth-backend/migrations/20210326100300_timestamptz.js index 2e8fa1bc7c..d326a32211 100644 --- a/plugins/auth-backend/migrations/20210326100300_timestamptz.js +++ b/plugins/auth-backend/migrations/20210326100300_timestamptz.js @@ -20,24 +20,32 @@ * @param {import('knex').Knex} knex */ exports.up = async function up(knex) { - return knex.schema.alterTable('signing_keys', function (t) { - t.timestamp('created_at', { useTz: true, precision: 0 }) - .notNullable() - .defaultTo(knex.fn.now()) - .comment('The creation time of the key') - .alter(); - }); + // Sqlite does not support alter column. + if (knex.client.config.client !== 'sqlite3') { + await knex.schema.alterTable('signing_keys', table => { + table + .timestamp('created_at', { useTz: true, precision: 0 }) + .notNullable() + .defaultTo(knex.fn.now()) + .comment('The creation time of the key') + .alter(); + }); + } }; /** * @param {import('knex').Knex} knex */ exports.down = async function down(knex) { - return knex.schema.alterTable('signing_keys', function (t) { - t.timestamp('created_at', { useTz: false, precision: 0 }) - .notNullable() - .defaultTo(knex.fn.now()) - .comment('The creation time of the key') - .alter(); - }); + // Sqlite does not support alter column. + if (knex.client.config.client !== 'sqlite3') { + await knex.schema.alterTable('signing_keys', table => { + table + .timestamp('created_at', { useTz: false, precision: 0 }) + .notNullable() + .defaultTo(knex.fn.now()) + .comment('The creation time of the key') + .alter(); + }); + } };