Creates schema across every configured shard, idempotently.
Wraps createSchemaAcrossShards with the two guards consumers keep
rebuilding: an in-process once flag and a KV-backed versionKey gate. Pass
either a single schema string (statements separated by ;) or an array of
statements.
Promise that resolves when schema is ensured on all shards
Throws
If CollegeDB is not initialized or a statement fails
Since
1.2.4
Example
awaitensureSchema( [ 'CREATE TABLE IF NOT EXISTS users (id TEXT PRIMARY KEY, name TEXT NOT NULL)', 'CREATE INDEX IF NOT EXISTS idx_users_name ON users (name)' ], { versionKey:'schema:version', version:'3' } );
Creates schema across every configured shard, idempotently.
Wraps createSchemaAcrossShards with the two guards consumers keep rebuilding: an in-process
onceflag and a KV-backedversionKeygate. Pass either a single schema string (statements separated by;) or an array of statements.