diff --git a/bin/spark.js b/bin/spark.js index eb0b1a67..14f2b52a 100644 --- a/bin/spark.js +++ b/bin/spark.js @@ -7,6 +7,7 @@ import fs from 'node:fs/promises' import { join, dirname } from 'node:path' import { fileURLToPath } from 'node:url' import { createRoundGetter } from '../lib/round-tracker.js' +import { migrate } from '../lib/migrate.js' import assert from 'node:assert' const { @@ -52,6 +53,7 @@ client.on('error', err => { // https://github.com/brianc/node-postgres/issues/1324#issuecomment-308778405 console.error('An idle client has experienced an error', err.stack) }) +await migrate(client) const getCurrentRound = await createRoundGetter(client) diff --git a/index.js b/index.js index 7d68f9a9..abeab1c2 100644 --- a/index.js +++ b/index.js @@ -1,6 +1,5 @@ import { json } from 'http-responders' import Sentry from '@sentry/node' -import { migrate } from './lib/migrate.js' import getRawBody from 'raw-body' import assert from 'http-assert' import { validate } from './lib/validate.js' @@ -271,7 +270,6 @@ export const createHandler = async ({ getCurrentRound, domain }) => { - await migrate(client) return (req, res) => { const start = new Date() logger.info(`${req.method} ${req.url} ...`)