feat: batch schema manager statements

run all schema modification queries in a single batch/transaction, to enable automatic rollbacks, and to stay within cloudflare's subrequest limits in free plan.
This commit is contained in:
dswbx
2025-09-24 14:48:45 +02:00
parent 832eb6ac31
commit 06d7558c3c
4 changed files with 56 additions and 38 deletions
+1 -6
View File
@@ -34,7 +34,6 @@ export class EntityManager<TBD extends object = DefaultDB> {
private _entities: Entity[] = [];
private _relations: EntityRelation[] = [];
private _indices: EntityIndex[] = [];
private _schema?: SchemaManager;
readonly emgr: EventManager<typeof EntityManager.Events>;
static readonly Events = { ...MutatorEvents, ...RepositoryEvents };
@@ -249,11 +248,7 @@ export class EntityManager<TBD extends object = DefaultDB> {
}
schema() {
if (!this._schema) {
this._schema = new SchemaManager(this);
}
return this._schema;
return new SchemaManager(this);
}
// @todo: centralize and add tests