From a25efcc643f515185fbdb479e25c43910268cba3 Mon Sep 17 00:00:00 2001 From: Erik Larsson Date: Fri, 26 Mar 2021 11:36:49 +0100 Subject: [PATCH] skip sqllite Signed-off-by: Erik Larsson --- .../migrations/20210326100300_timestamptz.js | 36 +++++++++++-------- 1 file changed, 22 insertions(+), 14 deletions(-) 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(); + }); + } };