Documentation
¶
Overview ¶
Package storecopy copies a stopped farm's SQLite database into an empty PostgreSQL database, verbatim, in one PostgreSQL transaction, and verifies every table by row count and digest before committing. See docs/operations.md, Moving to PostgreSQL.
The schema is read from the live catalogs (schemainfo), not from a list kept here, so a new table or column is copied without a change to this package, and a column type it does not know how to copy is refused by name. SQL is built by concatenating identifiers read from those catalogs, each one double-quoted (quoteIdent doubles any embedded quote); every value travels as a bind parameter.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options struct {
SQLitePath string // the source; never written
PostgresDSN string // the target; empty, or migrated by sqi with no rows in its tables
Logger *slog.Logger
}
Options says what to copy where.
type Result ¶
type Result struct {
Tables []TableResult
Elapsed time.Duration
}
Result is what a successful copy did, tables in the order they were copied.
func Copy ¶
Copy checks every precondition of the copy (both databases locked, the source intact and at this binary's schema version, the target empty and of the same shape), then copies every table in one PostgreSQL transaction and verifies it before committing. Any failure after the preconditions rolls the transaction back, committing no sqi rows (a schema Copy migrated into an empty target stays).
type TableResult ¶
TableResult is one table's copied and verified row count.