@voltro/database 0.74.0 → 0.76.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/sql.d.ts CHANGED
@@ -161,13 +161,7 @@ declare type AnyView = View<string, Record<string, ColumnDefinition<unknown>>>;
161
161
  */
162
162
  export declare const appliedAtValue: (sql: SqlClient.SqlClient, iso: string) => Effect.Effect<string>;
163
163
 
164
- /**
165
- * The ids recorded as applied file migrations on THIS database — exported for
166
- * the deploy compensation, which compares the set before a run with the set
167
- * after it to know which `down`s to run. An absent ledger table reads as an
168
- * empty set: a virgin database has applied nothing.
169
- */
170
- export declare const appliedFileMigrationIds: (sql: SqlClient.SqlClient) => Effect.Effect<ReadonlyArray<string>, never>;
164
+ export declare const appliedFileMigrationIds: (sql: SqlClient.SqlClient) => Effect.Effect<ReadonlyArray<string>, SqlError_2>;
171
165
 
172
166
  /**
173
167
  * The applied file migrations WITH the body hash recorded at the time.
@@ -181,7 +175,7 @@ export declare const appliedFileMigrationIds: (sql: SqlClient.SqlClient) => Effe
181
175
  export declare const appliedFileMigrations: (sql: SqlClient.SqlClient) => Effect.Effect<ReadonlyArray<{
182
176
  readonly id: string;
183
177
  readonly hash: string;
184
- }>, never>;
178
+ }>, SqlError_2>;
185
179
 
186
180
  /**
187
181
  * The operations the resume ledger says RAN — `started`, `added` or `applied` —
@@ -2620,6 +2614,21 @@ export declare const ensureDeployLedgerTable: (sql: SqlClient.SqlClient, dialect
2620
2614
  */
2621
2615
  export declare const ensureLedgerTable: (sql: SqlClient.SqlClient, dialect: DialectId) => Effect.Effect<void, SqlError_2>;
2622
2616
 
2617
+ /**
2618
+ * The PLAN ledger (`_voltro_migration_plans`) — same bootstrap, one caller.
2619
+ *
2620
+ * A file migration records itself here, and the file pass runs BEFORE the
2621
+ * planner that would otherwise create this table. On a database that does not
2622
+ * have it yet, `up()` therefore succeeded and the recording INSERT failed —
2623
+ * `FileMigrationLedgerError`, the one outcome whose whole message is "do not
2624
+ * re-run this". Same reason the resume ledger above is created by the applier
2625
+ * rather than planned: a run needs it before any DDL of its own has happened.
2626
+ *
2627
+ * Index-free like the others, so the planner still owns the table's shape and a
2628
+ * re-plan converges by adding the indexes it declares.
2629
+ */
2630
+ export declare const ensurePlanLedgerTable: (sql: SqlClient.SqlClient, dialect: DialectId) => Effect.Effect<void, SqlError_2>;
2631
+
2623
2632
  /** Exported for the same reason as {@link enumTypeBlocks}, and it MUST run
2624
2633
  * before it — see that function's note on ordering. */
2625
2634
  export declare const enumRenameBlocks: (tables: ReadonlyArray<AnyTable>, dialect: DialectId) => string;
@@ -2853,6 +2862,9 @@ export declare interface FileMigrationContextInput {
2853
2862
  * Its own error type because the recovery is the opposite of the ordinary one:
2854
2863
  * do NOT re-run. The change has landed; what is missing is the record that says
2855
2864
  * so, and every future invocation will apply it again until that row exists.
2865
+ * Unless the write failed because the row is ALREADY there — another process
2866
+ * recorded the same migration — and then the message says the opposite: the
2867
+ * record is correct and the body ran twice.
2856
2868
  */
2857
2869
  export declare class FileMigrationLedgerError extends Error {
2858
2870
  readonly migrationId: string;
@@ -3941,6 +3953,13 @@ export declare interface PlanInput {
3941
3953
  */
3942
3954
  export declare const planMigrations: (input: PlanInput) => MigrationPlan;
3943
3955
 
3956
+ /** Tables whose shape the app migration planner owns. Runtime-owned tables
3957
+ * remain visible when explicitly declared; unrelated app tables stay visible
3958
+ * so unexpected additions are still detected. */
3959
+ export declare const plannableLiveTables: <T extends {
3960
+ readonly name: string;
3961
+ }>(tables: ReadonlyArray<T>, declaredNames: ReadonlySet<string>) => ReadonlyArray<T>;
3962
+
3944
3963
  /**
3945
3964
  * One row in a `MigrationPlan` — a concrete operation paired with the
3946
3965
  * planner's classification + any blocking reason.
@@ -4781,6 +4800,8 @@ export declare const recordUpToDate: (sql: SqlClient.SqlClient, plan: MigrationP
4781
4800
  readonly source: string;
4782
4801
  }) => Effect.Effect<"recorded" | "already-current", never>;
4783
4802
 
4803
+ /* Excluded from this release type: registerSqlPoolCapacity */
4804
+
4784
4805
  export declare type RehearsalOutcome =
4785
4806
  /** The plan applied on the branch and the re-plan was empty. Nothing lossy. */
4786
4807
  'clean'
@@ -4836,6 +4857,8 @@ export declare interface RewriteOptions extends EachOptions {
4836
4857
  * addition to the columns the patch itself changes. A JSON column cannot be
4837
4858
  * compared by value on every dialect, so a rewrite of one guards on what
4838
4859
  * you name here — an `updatedAt`, a `version` — rather than on the document.
4860
+ * Temporal comparisons retain the database's full precision, even though
4861
+ * the callback's Date values only represent milliseconds.
4839
4862
  */
4840
4863
  readonly guard?: ReadonlyArray<string>;
4841
4864
  /**