File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19,11 +19,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1919### Added
2020- ** Batch schema sync for remote DDL in kernel bootstrap** — ` ObjectQLPlugin.syncRegisteredSchemas() `
2121 now groups objects by driver and uses ` syncSchemasBatch() ` when the driver advertises
22- ` supports.batchSchemaSync = true ` . This sends all DDL (CREATE TABLE / ALTER TABLE ADD COLUMN)
23- in a single ` client.batch() ` call instead of N sequential round-trips, reducing cold-start times
24- from 58+ seconds to under 10 seconds for 100+ objects on remote drivers (e.g. Turso cloud).
22+ ` supports.batchSchemaSync = true ` . This reduces the number of remote DDL round-trips from
23+ roughly N×(2–3) individual calls (introspection + optional PRAGMA + DDL write per object)
24+ to a small constant number of batched ` client.batch() ` calls, cutting cold-start times from
25+ 58+ seconds to under 10 seconds for 100+ objects on remote drivers (e.g. Turso cloud).
2526 Falls back to sequential ` syncSchema() ` per object for drivers without batch support or if the
26- batch call fails at runtime. Added ` batchSchemaSync ` capability flag to ` DriverCapabilitiesSchema ` ,
27+ batched calls fail at runtime. Added ` batchSchemaSync ` capability flag to ` DriverCapabilitiesSchema ` ,
2728 optional ` syncSchemasBatch() ` to ` IDataDriver ` , and ` RemoteTransport.syncSchemasBatch() ` using
2829 ` @libsql/client ` 's ` batch() ` API.
2930- ** ` @objectstack/driver-turso ` — dual transport architecture** — TursoDriver now supports three
Original file line number Diff line number Diff line change @@ -378,15 +378,17 @@ export class RemoteTransport {
378378 }
379379
380380 /**
381- * Batch-synchronize multiple object schemas in a single round-trip .
381+ * Batch-synchronize multiple object schemas using batched libsql calls .
382382 *
383383 * Collects all DDL statements (CREATE TABLE / ALTER TABLE ADD COLUMN)
384- * for every schema and submits them via `client.batch()` in a single
385- * network call. This reduces N × (2–3) HTTP round-trips to exactly 2:
386- * one batch to introspect existing tables, and one batch to apply DDL.
384+ * for every schema and uses `client.batch()` to minimize network
385+ * round-trips. The process may perform up to three batch calls:
386+ * one to introspect existing tables, one to introspect columns for
387+ * existing tables, and one to apply DDL statements.
387388 *
388- * Falls back to sequential `syncSchema()` if the batch call fails
389- * (e.g. unsupported by the libsql endpoint).
389+ * This method does not implement an internal fallback to sequential
390+ * `syncSchema()`. Any fallback behavior is expected to be handled
391+ * by the caller if a batch operation is not supported or fails.
390392 */
391393 async syncSchemasBatch ( schemas : Array < { object : string ; schema : any } > ) : Promise < void > {
392394 this . ensureClient ( ) ;
Original file line number Diff line number Diff line change @@ -154,7 +154,7 @@ export interface IDataDriver {
154154 syncSchema ( object : string , schema : unknown , options ?: DriverOptions ) : Promise < void > ;
155155
156156 /**
157- * Batch-synchronize multiple object schemas in a single round-trip .
157+ * Batch-synchronize multiple object schemas with fewer round-trips .
158158 *
159159 * Drivers that set `supports.batchSchemaSync = true` MUST implement this.
160160 * The engine calls it once with all `{ object, schema }` pairs instead
Original file line number Diff line number Diff line change @@ -216,11 +216,11 @@ export const DriverCapabilitiesSchema = z.object({
216216
217217 /**
218218 * Whether the driver supports batching multiple schema sync operations
219- * into a single round-trip. When true, the engine may call
220- * `syncSchemasBatch()` instead of calling `syncSchema()` per object,
221- * drastically reducing network round-trips for remote drivers.
219+ * into a single (or fewer) round-trips for the DDL phase. When true,
220+ * the engine may call `syncSchemasBatch()` instead of calling
221+ * `syncSchema()` per object, reducing network round-trips for remote drivers.
222222 */
223- batchSchemaSync : z . boolean ( ) . default ( false ) . describe ( 'Supports batched schema sync (single round-trip DDL) ' ) ,
223+ batchSchemaSync : z . boolean ( ) . default ( false ) . describe ( 'Supports batched schema sync to reduce schema DDL round-trips ' ) ,
224224
225225 /**
226226 * Whether the driver supports database migrations.
@@ -585,7 +585,7 @@ export const DriverInterfaceSchema = z.object({
585585 . describe ( 'Sync object schema to DB' ) ,
586586
587587 /**
588- * Batch-synchronize multiple object schemas in a single round-trip .
588+ * Batch-synchronize multiple object schemas with fewer round-trips .
589589 *
590590 * Drivers that advertise `supports.batchSchemaSync = true` MUST implement
591591 * this method. The engine will call it once with every
You can’t perform that action at this time.
0 commit comments