@voltro/database 0.74.0 → 0.75.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;