@mikro-orm/mariadb 7.0.7-dev.12 → 7.0.7-dev.13
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/MariaDbSchemaHelper.d.ts +5 -5
- package/MariaDbSchemaHelper.js +12 -12
- package/package.json +3 -3
package/MariaDbSchemaHelper.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { type AbstractSqlConnection, type CheckDef, type Column, type IndexDef, type DatabaseSchema, type Table, MySqlSchemaHelper } from '@mikro-orm/mysql';
|
|
2
|
-
import { type Dictionary, type Type } from '@mikro-orm/core';
|
|
2
|
+
import { type Dictionary, type Transaction, type Type } from '@mikro-orm/core';
|
|
3
3
|
/** Schema introspection helper for MariaDB. */
|
|
4
4
|
export declare class MariaDbSchemaHelper extends MySqlSchemaHelper {
|
|
5
5
|
protected appendMySqlIndexSuffix(sql: string, index: IndexDef): string;
|
|
6
|
-
loadInformationSchema(schema: DatabaseSchema, connection: AbstractSqlConnection, tables: Table[]): Promise<void>;
|
|
7
|
-
getAllIndexes(connection: AbstractSqlConnection, tables: Table[]): Promise<Dictionary<IndexDef[]>>;
|
|
8
|
-
getAllColumns(connection: AbstractSqlConnection, tables: Table[]): Promise<Dictionary<Column[]>>;
|
|
9
|
-
getAllChecks(connection: AbstractSqlConnection, tables: Table[], columns?: Dictionary<Column[]>): Promise<Dictionary<CheckDef[]>>;
|
|
6
|
+
loadInformationSchema(schema: DatabaseSchema, connection: AbstractSqlConnection, tables: Table[], schemas?: string[], ctx?: Transaction): Promise<void>;
|
|
7
|
+
getAllIndexes(connection: AbstractSqlConnection, tables: Table[], ctx?: Transaction): Promise<Dictionary<IndexDef[]>>;
|
|
8
|
+
getAllColumns(connection: AbstractSqlConnection, tables: Table[], ctx?: Transaction): Promise<Dictionary<Column[]>>;
|
|
9
|
+
getAllChecks(connection: AbstractSqlConnection, tables: Table[], ctx?: Transaction, columns?: Dictionary<Column[]>): Promise<Dictionary<CheckDef[]>>;
|
|
10
10
|
protected getChecksSQL(tables: Table[]): string;
|
|
11
11
|
protected wrap(val: string | undefined | null, type: Type<unknown>): string | undefined | null;
|
|
12
12
|
}
|
package/MariaDbSchemaHelper.js
CHANGED
|
@@ -14,16 +14,16 @@ export class MariaDbSchemaHelper extends MySqlSchemaHelper {
|
|
|
14
14
|
}
|
|
15
15
|
return sql;
|
|
16
16
|
}
|
|
17
|
-
async loadInformationSchema(schema, connection, tables) {
|
|
17
|
+
async loadInformationSchema(schema, connection, tables, schemas, ctx) {
|
|
18
18
|
/* v8 ignore next */
|
|
19
19
|
if (tables.length === 0) {
|
|
20
20
|
return;
|
|
21
21
|
}
|
|
22
|
-
const columns = await this.getAllColumns(connection, tables);
|
|
23
|
-
const indexes = await this.getAllIndexes(connection, tables);
|
|
24
|
-
const checks = await this.getAllChecks(connection, tables, columns);
|
|
25
|
-
const fks = await this.getAllForeignKeys(connection, tables);
|
|
26
|
-
const enums = await this.getAllEnumDefinitions(connection, tables);
|
|
22
|
+
const columns = await this.getAllColumns(connection, tables, ctx);
|
|
23
|
+
const indexes = await this.getAllIndexes(connection, tables, ctx);
|
|
24
|
+
const checks = await this.getAllChecks(connection, tables, ctx, columns);
|
|
25
|
+
const fks = await this.getAllForeignKeys(connection, tables, ctx);
|
|
26
|
+
const enums = await this.getAllEnumDefinitions(connection, tables, ctx);
|
|
27
27
|
for (const t of tables) {
|
|
28
28
|
const key = this.getTableKey(t);
|
|
29
29
|
const table = schema.addTable(t.table_name, t.schema_name, t.table_comment);
|
|
@@ -31,12 +31,12 @@ export class MariaDbSchemaHelper extends MySqlSchemaHelper {
|
|
|
31
31
|
table.init(columns[key], indexes[key], checks[key], pks, fks[key], enums[key]);
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
async getAllIndexes(connection, tables) {
|
|
34
|
+
async getAllIndexes(connection, tables, ctx) {
|
|
35
35
|
const sql = `select table_name as table_name, nullif(table_schema, schema()) as schema_name, index_name as index_name, non_unique as non_unique, column_name as column_name, index_type as index_type, sub_part as sub_part, collation as sort_order /*M!100600 , ignored as ignored */
|
|
36
36
|
from information_schema.statistics where table_schema = database()
|
|
37
37
|
and table_name in (${tables.map(t => this.platform.quoteValue(t.table_name)).join(', ')})
|
|
38
38
|
order by schema_name, table_name, index_name, seq_in_index`;
|
|
39
|
-
const allIndexes = await connection.execute(sql);
|
|
39
|
+
const allIndexes = await connection.execute(sql, [], 'all', ctx);
|
|
40
40
|
const ret = {};
|
|
41
41
|
for (const index of allIndexes) {
|
|
42
42
|
const key = this.getTableKey(index);
|
|
@@ -78,7 +78,7 @@ export class MariaDbSchemaHelper extends MySqlSchemaHelper {
|
|
|
78
78
|
}
|
|
79
79
|
return ret;
|
|
80
80
|
}
|
|
81
|
-
async getAllColumns(connection, tables) {
|
|
81
|
+
async getAllColumns(connection, tables, ctx) {
|
|
82
82
|
const sql = `select table_name as table_name,
|
|
83
83
|
nullif(table_schema, schema()) as schema_name,
|
|
84
84
|
column_name as column_name,
|
|
@@ -95,7 +95,7 @@ export class MariaDbSchemaHelper extends MySqlSchemaHelper {
|
|
|
95
95
|
ifnull(datetime_precision, character_maximum_length) length
|
|
96
96
|
from information_schema.columns where table_schema = database() and table_name in (${tables.map(t => this.platform.quoteValue(t.table_name)).join(', ')})
|
|
97
97
|
order by ordinal_position`;
|
|
98
|
-
const allColumns = await connection.execute(sql);
|
|
98
|
+
const allColumns = await connection.execute(sql, [], 'all', ctx);
|
|
99
99
|
const str = (val) => (val != null ? '' + val : val);
|
|
100
100
|
const extra = (val) => val.replace(/auto_increment|default_generated|(stored|virtual) generated/i, '').trim() || undefined;
|
|
101
101
|
const ret = {};
|
|
@@ -132,9 +132,9 @@ export class MariaDbSchemaHelper extends MySqlSchemaHelper {
|
|
|
132
132
|
}
|
|
133
133
|
return ret;
|
|
134
134
|
}
|
|
135
|
-
async getAllChecks(connection, tables, columns) {
|
|
135
|
+
async getAllChecks(connection, tables, ctx, columns) {
|
|
136
136
|
const sql = this.getChecksSQL(tables);
|
|
137
|
-
const allChecks = await connection.execute(sql);
|
|
137
|
+
const allChecks = await connection.execute(sql, [], 'all', ctx);
|
|
138
138
|
const ret = {};
|
|
139
139
|
for (const check of allChecks) {
|
|
140
140
|
const key = this.getTableKey(check);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/mariadb",
|
|
3
|
-
"version": "7.0.7-dev.
|
|
3
|
+
"version": "7.0.7-dev.13",
|
|
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",
|
|
@@ -47,14 +47,14 @@
|
|
|
47
47
|
"copy": "node ../../scripts/copy.mjs"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@mikro-orm/mysql": "7.0.7-dev.
|
|
50
|
+
"@mikro-orm/mysql": "7.0.7-dev.13",
|
|
51
51
|
"kysely": "0.28.14"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@mikro-orm/core": "^7.0.6"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
57
|
-
"@mikro-orm/core": "7.0.7-dev.
|
|
57
|
+
"@mikro-orm/core": "7.0.7-dev.13"
|
|
58
58
|
},
|
|
59
59
|
"engines": {
|
|
60
60
|
"node": ">= 22.17.0"
|