diff --git a/Makefile b/Makefile index 8760c350e..a85ad22f1 100644 --- a/Makefile +++ b/Makefile @@ -72,16 +72,12 @@ fake-s3-server-persistent: migrations: node_version node lib/bin/run-migrations.js -.PHONY: check-migrations -check-migrations: node_version - node lib/bin/check-migrations.js - ################################################################################ # RUN SERVER .PHONY: base -base: node_modules node_version migrations check-migrations +base: node_modules node_version migrations .PHONY: dev dev: base diff --git a/lib/bin/check-migrations.js b/lib/bin/check-migrations.js deleted file mode 100644 index 8608c587a..000000000 --- a/lib/bin/check-migrations.js +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2022 ODK Central Developers -// See the NOTICE file at the top-level directory of this distribution and at -// https://github.com/getodk/central-backend/blob/master/NOTICE. -// This file is part of ODK Central. It is subject to the license terms in -// the LICENSE file found in the top-level directory of this distribution and at -// https://www.apache.org/licenses/LICENSE-2.0. No part of ODK Central, -// including this file, may be copied, modified, propagated, or distributed -// except according to the terms contained in the LICENSE file. - -const { withKnex, checkMigrations } = require('../model/knex-migrator'); - -(async () => { - try { - await withKnex(require('config').get('default.database'))(checkMigrations); - } catch (err) { - console.error('Error:', err.message); - process.exit(1); - } -})(); diff --git a/lib/model/knex-migrator.js b/lib/model/knex-migrator.js index 0fc5a3c03..d2c3f8bd7 100644 --- a/lib/model/knex-migrator.js +++ b/lib/model/knex-migrator.js @@ -25,13 +25,5 @@ const withKnex = (config) => (mutator) => { // Given a database, initiates migrations on it. const migrate = (db) => db.migrate.latest({ directory: `${__dirname}/migrations` }); -// Checks for pending migrations and returns an exit code of 1 if any are -// still pending/unapplied (e.g. automatically running migrations just failed). -const checkMigrations = (db) => db.migrate.list({ directory: `${__dirname}/migrations` }) - .then((res) => { - if (res[1].length > 0) - process.exitCode = 1; - }); - -module.exports = { checkMigrations, knexConnect, withKnex, migrate }; +module.exports = { knexConnect, withKnex, migrate };