@mikro-orm/sql 7.0.0-dev.326 → 7.0.0-dev.327

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/sql",
3
- "version": "7.0.0-dev.326",
3
+ "version": "7.0.0-dev.327",
4
4
  "description": "TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, PostgreSQL and SQLite databases as well as usage with vanilla JavaScript.",
5
5
  "keywords": [
6
6
  "data-mapper",
@@ -53,7 +53,7 @@
53
53
  "@mikro-orm/core": "^6.6.9"
54
54
  },
55
55
  "peerDependencies": {
56
- "@mikro-orm/core": "7.0.0-dev.326"
56
+ "@mikro-orm/core": "7.0.0-dev.327"
57
57
  },
58
58
  "engines": {
59
59
  "node": ">= 22.17.0"
@@ -1,4 +1,4 @@
1
- import { CommitOrderCalculator, Utils, } from '@mikro-orm/core';
1
+ import { CommitOrderCalculator, TableNotFoundException, Utils, } from '@mikro-orm/core';
2
2
  import { AbstractSchemaGenerator } from '@mikro-orm/core/schema';
3
3
  import { DatabaseSchema } from './DatabaseSchema.js';
4
4
  import { SchemaComparator } from './SchemaComparator.js';
@@ -128,11 +128,19 @@ export class SqlSchemaGenerator extends AbstractSchemaGenerator {
128
128
  }
129
129
  const schema = options?.schema ?? this.config.get('schema', this.platform.getDefaultSchemaName());
130
130
  for (const meta of this.getOrderedMetadata(schema).reverse()) {
131
- await this.driver
132
- .createQueryBuilder(meta.class, this.em?.getTransactionContext(), 'write', false)
133
- .withSchema(schema)
134
- .truncate()
135
- .execute();
131
+ try {
132
+ await this.driver
133
+ .createQueryBuilder(meta.class, this.em?.getTransactionContext(), 'write', false)
134
+ .withSchema(schema)
135
+ .truncate()
136
+ .execute();
137
+ }
138
+ catch (e) {
139
+ if (e instanceof TableNotFoundException) {
140
+ continue;
141
+ }
142
+ throw e;
143
+ }
136
144
  }
137
145
  if (this.options.disableForeignKeysForClear) {
138
146
  await this.execute(this.helper.enableForeignKeysSQL());