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
| Property | Type | Description | Defined 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 |
url | string | postgres:// 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
| Property | Type | Description | Defined in |
|---|---|---|---|
database | string | current_database(): the name an operator confirms. | packages/playerthree/src/postgres/reset.ts:28 |
host | string | Server host and port from the connection string (never the credentials). | packages/playerthree/src/postgres/reset.ts:26 |
ledger | object[] | Migration-ledger rows to drop, sorted by scope then name. | packages/playerthree/src/postgres/reset.ts:34 |
schema | string | current_schema(), where every listed table lives. | packages/playerthree/src/postgres/reset.ts:30 |
tables | string[] | 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
| Parameter | Type |
|---|---|
opts | PostgresResetOptions |
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
| Parameter | Type |
|---|---|
opts | PostgresResetOptions & object |
Returns
Promise<object[]>
