playerthree/postgres/reset

Operator reset of a pre-release PlayerThree database to the current schema (playerthree db reset). Owned tables are the playerthree_* tables, the migration ledger, and the tables created by the ledger-recorded migration files of each given game scope; nothing else in the database is touched. The drop runs in one transaction under the migration advisory lock and re-checks the confirmed plan first; migrations are then re-applied through openPostgresStorage. The connection string is never logged. A separate entry (playerthree/postgres/reset) so the storage runtime never loads it.

Interfaces

PostgresResetOptions

Defined in: packages/playerthree/src/postgres/reset.ts:16

Options of a database reset: the connection and the game migration sets to drop and re-apply.

Properties

PropertyTypeDescriptionDefined in
migrations?object[]Game migration sets (as openPostgresStorage's migrations) whose recorded tables are dropped and re-migrated.packages/playerthree/src/postgres/reset.ts:20
urlstringpostgres:// connection string.packages/playerthree/src/postgres/reset.ts:18

PostgresResetPlan

Defined in: packages/playerthree/src/postgres/reset.ts:24

What a reset would drop, for the operator to confirm before anything is touched.

Properties

PropertyTypeDescriptionDefined in
databasestringcurrent_database(): the name an operator confirms.packages/playerthree/src/postgres/reset.ts:28
hoststringServer host and port from the connection string (never the credentials).packages/playerthree/src/postgres/reset.ts:26
ledgerobject[]Migration-ledger rows to drop, sorted by scope then name.packages/playerthree/src/postgres/reset.ts:34
schemastringcurrent_schema(), where every listed table lives.packages/playerthree/src/postgres/reset.ts:30
tablesstring[]Existing tables to drop, sorted.packages/playerthree/src/postgres/reset.ts:32

Functions

planPostgresReset()

function planPostgresReset(opts): Promise<PostgresResetPlan>;

Defined in: packages/playerthree/src/postgres/reset.ts:121

Connects and lists what resetPostgresStorage would drop. Read-only. Throws on any ownership mismatch.

Parameters

ParameterType
optsPostgresResetOptions

Returns

Promise<PostgresResetPlan>


resetPostgresStorage()

function resetPostgresStorage(opts): Promise<object[]>;

Defined in: packages/playerthree/src/postgres/reset.ts:132

Drops exactly the confirmed plan's tables in one transaction (under the migration advisory lock, after re-checking that the database still matches the plan), then re-applies PlayerThree's and every given scope's migrations through openPostgresStorage. Returns the fresh ledger.

Parameters

ParameterType
optsPostgresResetOptions & object

Returns

Promise<object[]>