Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

627 B
Raw Blame
const { queriesRunner, dbName } = require('./setup')

const queries = [
  `ALTER TABLE ${dbName}.user ADD COLUMN IF NOT EXISTS twoFactorAuthenticationSecret Nullable(String) CODEC(ZSTD(3))`,
  `ALTER TABLE ${dbName}.user ADD COLUMN IF NOT EXISTS twoFactorRecoveryCode Nullable(String) CODEC(ZSTD(3))`,
  `ALTER TABLE ${dbName}.user ADD COLUMN IF NOT EXISTS isTwoFactorAuthenticationEnabled Int8 DEFAULT 0`,
]

async function run() {
  try {
    await queriesRunner(queries)
    console.log('[INFO] Selfhosted 2FA migration finished')
  } catch (reason) {
    console.error('[ERROR] 2FA migration failed:', reason)
  }
}

run()