@@ -126,6 +126,39 @@ export interface Client {
126126 mode ?: TransactionMode ,
127127 ) : Promise < Array < ResultSet > > ;
128128
129+ /** Execute a batch of SQL statements in a transaction with PRAGMA foreign_keys=off; before and PRAGMA foreign_keys=on; after.
130+ *
131+ * The batch is executed in its own logical database connection and the statements are wrapped in a
132+ * transaction. This ensures that the batch is applied atomically: either all or no changes are applied.
133+ *
134+ * The transaction mode is `"deferred"`.
135+ *
136+ * If any of the statements in the batch fails with an error, the batch is aborted, the transaction is
137+ * rolled back and the returned promise is rejected.
138+ *
139+ * ```javascript
140+ * const rss = await client.migrate([
141+ * // statement without arguments
142+ * "CREATE TABLE test (a INT)",
143+ *
144+ * // statement with positional arguments
145+ * {
146+ * sql: "INSERT INTO books (name, author, published_at) VALUES (?, ?, ?)",
147+ * args: ["First Impressions", "Jane Austen", 1813],
148+ * },
149+ *
150+ * // statement with named arguments
151+ * {
152+ * sql: "UPDATE books SET name = $new WHERE name = $old",
153+ * args: {old: "First Impressions", new: "Pride and Prejudice"},
154+ * },
155+ * ]);
156+ * ```
157+ */
158+ migrate (
159+ stmts : Array < InStatement > ,
160+ ) : Promise < Array < ResultSet > > ;
161+
129162 /** Start an interactive transaction.
130163 *
131164 * Interactive transactions allow you to interleave execution of SQL statements with your application
0 commit comments