sql/extensions/convergence/connect
Written to: 4 requirements: 4 proved, 0 partly, 0 failing, 0 with no test recorded. 0019-sql-convergence FR-007, 0019-sql-convergence FR-008, 0019-sql-convergence FR-009, 0019-sql-convergence FR-010
Autonomous convergence and the version gate (commons data 0019-sql-convergence FR-007 to FR-010): on first access the plan is computed and applied if the policy allows every step, held for a person if it does not, and resumed at the next access if a step fails; and a database is checked against the state an application expects.
Source: commons/data/sql/extensions/convergence/connect.ts
2 of 5 exports are imported by a test of the run. A test that imports an export may not call it or check what it returns.
function connect(driver: Driver, dialect: Dialect, schema: LogicalSchema, desired: Desired, settings: Convergence, options?: ConnectOptions): Promise<ConnectResult>
The first access of an application to a database.
| Parameter | What it is |
|---|
driver | the database |
dialect | its dialect |
schema | the logical schema wanted |
desired | the dialect, naming, schema and what extensions add |
settings | the settings, with every default filled |
options | what plan is given, a rehearsal and what the run is given |
Returns: what it came to
Imported by 25 tests of the run (25 passed, 0 failed): the library's results
ConnectOptionsinterfaceno test imports itinterface ConnectOptions extends PlanOptions
What a first access is given besides the settings.
| Member | Type | What it is |
|---|
rehearse? | ((plan: Plan) => Promise<boolean>) | Said by a rehearsal of the plan on a copy: where it says no, the plan is held. |
run? | Omit<RunOptions, "empty"> | |
allow? | { readonly destructive?: boolean | undefined; } | |
fallback? | Fallback | Makes what the core cannot make in place, such as a table that is made again. |
manual? | readonly ManualStep[] | |
transforms? | readonly StepTransform[] | |
requireIdempotent? | boolean | Refuse, as an error value, a step that is only safe to run twice because of the ledger (0012-sql-idempotency FR-007). |
ConnectResulttypeno test imports ittype ConnectResult =
| { readonly kind: "current"; readonly applied: Applied }
| { readonly kind: "applied"; readonly applied: Applied }
| { readonly kind: "held"; readonly why: readonly Held[]; readonly plan?: Plan }
| { readonly kind: "failed"; readonly error: RunError };
What a first access came to.
GateErrortypeno test imports ittype GateError =
{ readonly kind: "state"; readonly expected: string; readonly found: string } | { readonly kind: "unsupported"; readonly why: string };
Why a database is not where an application expects.
function versionGate(driver: Driver, dialect: Dialect, expected: State, ignore?: readonly string[]): Promise<Result<string, GateError>>
Whether a database is in the state an application expects.
| Parameter | What it is |
|---|
driver | the database |
dialect | its dialect |
expected | the state the application expects |
ignore | the names of tables the reader leaves out |
Returns: the hash, or why the application should not start
Imported by 10 tests of the run (10 passed, 0 failed): the library's results