@mikro-orm/knex 7.0.0-dev.67 → 7.0.0-dev.69
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/knex",
|
|
3
|
-
"version": "7.0.0-dev.
|
|
3
|
+
"version": "7.0.0-dev.69",
|
|
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
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -57,6 +57,6 @@
|
|
|
57
57
|
"@mikro-orm/core": "^6.6.1"
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|
|
60
|
-
"@mikro-orm/core": "7.0.0-dev.
|
|
60
|
+
"@mikro-orm/core": "7.0.0-dev.69"
|
|
61
61
|
}
|
|
62
62
|
}
|
|
@@ -14,7 +14,7 @@ export declare class SqlSchemaGenerator extends AbstractSchemaGenerator<Abstract
|
|
|
14
14
|
};
|
|
15
15
|
protected lastEnsuredDatabase?: string;
|
|
16
16
|
static register(orm: MikroORM): void;
|
|
17
|
-
|
|
17
|
+
create(options?: CreateSchemaOptions): Promise<void>;
|
|
18
18
|
/**
|
|
19
19
|
* Returns true if the database was created.
|
|
20
20
|
*/
|
|
@@ -22,13 +22,13 @@ export declare class SqlSchemaGenerator extends AbstractSchemaGenerator<Abstract
|
|
|
22
22
|
getTargetSchema(schema?: string): DatabaseSchema;
|
|
23
23
|
protected getOrderedMetadata(schema?: string): EntityMetadata[];
|
|
24
24
|
getCreateSchemaSQL(options?: CreateSchemaOptions): Promise<string>;
|
|
25
|
-
|
|
25
|
+
drop(options?: DropSchemaOptions): Promise<void>;
|
|
26
26
|
createNamespace(name: string): Promise<void>;
|
|
27
27
|
dropNamespace(name: string): Promise<void>;
|
|
28
|
-
|
|
28
|
+
clear(options?: ClearDatabaseOptions): Promise<void>;
|
|
29
29
|
getDropSchemaSQL(options?: Omit<DropSchemaOptions, 'dropDb'>): Promise<string>;
|
|
30
30
|
private getSchemaName;
|
|
31
|
-
|
|
31
|
+
update(options?: UpdateSchemaOptions<DatabaseSchema>): Promise<void>;
|
|
32
32
|
getUpdateSchemaSQL(options?: UpdateSchemaOptions<DatabaseSchema>): Promise<string>;
|
|
33
33
|
getUpdateSchemaMigrationSQL(options?: UpdateSchemaOptions<DatabaseSchema>): Promise<{
|
|
34
34
|
up: string;
|
|
@@ -8,7 +8,7 @@ export class SqlSchemaGenerator extends AbstractSchemaGenerator {
|
|
|
8
8
|
static register(orm) {
|
|
9
9
|
orm.config.registerExtension('@mikro-orm/schema-generator', () => new SqlSchemaGenerator(orm.em));
|
|
10
10
|
}
|
|
11
|
-
async
|
|
11
|
+
async create(options) {
|
|
12
12
|
await this.ensureDatabase();
|
|
13
13
|
const sql = await this.getCreateSchemaSQL(options);
|
|
14
14
|
await this.execute(sql);
|
|
@@ -32,12 +32,13 @@ export class SqlSchemaGenerator extends AbstractSchemaGenerator {
|
|
|
32
32
|
await this.createDatabase(dbName, { skipOnConnect: true });
|
|
33
33
|
}
|
|
34
34
|
if (options?.create) {
|
|
35
|
-
await this.
|
|
35
|
+
await this.create(options);
|
|
36
36
|
}
|
|
37
37
|
return true;
|
|
38
38
|
}
|
|
39
|
+
/* v8 ignore next 3 */
|
|
39
40
|
if (options?.clear) {
|
|
40
|
-
await this.
|
|
41
|
+
await this.clear({ ...options, clearIdentityMap: false });
|
|
41
42
|
}
|
|
42
43
|
return false;
|
|
43
44
|
}
|
|
@@ -88,7 +89,7 @@ export class SqlSchemaGenerator extends AbstractSchemaGenerator {
|
|
|
88
89
|
}
|
|
89
90
|
return this.wrapSchema(ret, options);
|
|
90
91
|
}
|
|
91
|
-
async
|
|
92
|
+
async drop(options = {}) {
|
|
92
93
|
if (options.dropDb) {
|
|
93
94
|
const name = this.config.get('dbName');
|
|
94
95
|
return this.dropDatabase(name);
|
|
@@ -104,11 +105,11 @@ export class SqlSchemaGenerator extends AbstractSchemaGenerator {
|
|
|
104
105
|
const sql = this.helper.getDropNamespaceSQL(name);
|
|
105
106
|
await this.execute(sql);
|
|
106
107
|
}
|
|
107
|
-
async
|
|
108
|
+
async clear(options) {
|
|
108
109
|
// truncate by default, so no value is considered as true
|
|
109
110
|
/* v8 ignore next 3 */
|
|
110
111
|
if (options?.truncate === false) {
|
|
111
|
-
return super.
|
|
112
|
+
return super.clear(options);
|
|
112
113
|
}
|
|
113
114
|
await this.execute(this.helper.disableForeignKeysSQL());
|
|
114
115
|
const schema = options?.schema ?? this.config.get('schema', this.platform.getDefaultSchemaName());
|
|
@@ -166,7 +167,7 @@ export class SqlSchemaGenerator extends AbstractSchemaGenerator {
|
|
|
166
167
|
}
|
|
167
168
|
return resolvedName;
|
|
168
169
|
}
|
|
169
|
-
async
|
|
170
|
+
async update(options = {}) {
|
|
170
171
|
const sql = await this.getUpdateSchemaSQL(options);
|
|
171
172
|
await this.execute(sql);
|
|
172
173
|
}
|