MCPcopy Create free account
hub / github.com/mikro-orm/mikro-orm / storeCurrentSchema

Method storeCurrentSchema

packages/migrations/src/Migrator.ts:360–369  ·  view source on GitHub ↗
(schema?: DatabaseSchema)

Source from the content-addressed store, hash-verified

358 }
359
360 protected async storeCurrentSchema(schema?: DatabaseSchema): Promise<void> {
361 if (!this.options.snapshot) {
362 return;
363 }
364
365 const snapshotPath = await this.getSnapshotPath();
366 schema ??= this.#schemaGenerator.getTargetSchema();
367 const { fs } = await import('@mikro-orm/core/fs-utils');
368 await fs.writeFile(snapshotPath, JSON.stringify(schema, null, 2));
369 }
370
371 private async getSchemaDiff(blank: boolean, initial: boolean): Promise<{ up: string[]; down: string[] }> {
372 const up: string[] = [];

Callers 3

createMethod · 0.95
createInitialMethod · 0.95
runMigrationsMethod · 0.95

Calls 3

getSnapshotPathMethod · 0.95
getTargetSchemaMethod · 0.80
writeFileMethod · 0.80

Tested by

no test coverage detected