Docker images / prepare-release (push) Successful in 12s
Docker images / backend-test (push) Successful in 4m9s
Docker images / frontend-image (push) Successful in 4m28s
Docker images / updater-image (push) Successful in 58s
Docker images / backend-image (push) Successful in 2m49s
Docker images / notify-webhook (push) Skipped
Docker images / publish-release (push) Successful in 11s
При старте backend накатывает схему PostgreSQL 18 и, если база пустая, один раз импортирует mikrotik.db с тома. Повторный старт не копирует данные. Бэкап в UI идёт через pg_dump. Co-authored-by: Cursor <cursoragent@cursor.com>
21 lines
855 B
TypeScript
21 lines
855 B
TypeScript
import { env } from "../config.js"
|
|
import { closePool, pool } from "../db/index.js"
|
|
import { applySqlMigrations } from "../db/migrate.js"
|
|
import { ensurePartitionsAround } from "../db/partitions.js"
|
|
import { importSqliteToPostgres } from "../db/sqlite-import.js"
|
|
|
|
const sqlitePath = process.argv.find((a) => a.startsWith("--sqlite="))?.slice(9) ?? env.DATABASE_PATH
|
|
const dryRun = process.argv.includes("--dry-run")
|
|
const fullHistory = process.argv.includes("--full-history")
|
|
const strict = process.argv.includes("--strict") || !dryRun
|
|
|
|
await applySqlMigrations(pool)
|
|
await ensurePartitionsAround(pool)
|
|
const report = await importSqliteToPostgres(pool, sqlitePath, { dryRun, strict, fullHistory })
|
|
console.log(JSON.stringify(report, null, 2))
|
|
if (!dryRun && report.rejects.length > 0 && strict) {
|
|
await closePool()
|
|
process.exit(1)
|
|
}
|
|
await closePool()
|