@mikro-orm/mariadb 6.6.10 → 6.6.11-dev.1
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,10 +1,10 @@
|
|
|
1
1
|
import { type AbstractSqlConnection, type CheckDef, type Column, type IndexDef, type DatabaseSchema, type Table, MySqlSchemaHelper } from '@mikro-orm/knex';
|
|
2
|
-
import { type Dictionary, type Type } from '@mikro-orm/core';
|
|
2
|
+
import { type Dictionary, type Transaction, type Type } from '@mikro-orm/core';
|
|
3
3
|
export declare class MariaDbSchemaHelper extends MySqlSchemaHelper {
|
|
4
|
-
loadInformationSchema(schema: DatabaseSchema, connection: AbstractSqlConnection, tables: Table[]): Promise<void>;
|
|
5
|
-
getAllIndexes(connection: AbstractSqlConnection, tables: Table[]): Promise<Dictionary<IndexDef[]>>;
|
|
6
|
-
getAllColumns(connection: AbstractSqlConnection, tables: Table[]): Promise<Dictionary<Column[]>>;
|
|
7
|
-
getAllChecks(connection: AbstractSqlConnection, tables: Table[], columns?: Dictionary<Column[]>): Promise<Dictionary<CheckDef[]>>;
|
|
4
|
+
loadInformationSchema(schema: DatabaseSchema, connection: AbstractSqlConnection, tables: Table[], schemas?: string[], ctx?: Transaction): Promise<void>;
|
|
5
|
+
getAllIndexes(connection: AbstractSqlConnection, tables: Table[], ctx?: Transaction): Promise<Dictionary<IndexDef[]>>;
|
|
6
|
+
getAllColumns(connection: AbstractSqlConnection, tables: Table[], ctx?: Transaction): Promise<Dictionary<Column[]>>;
|
|
7
|
+
getAllChecks(connection: AbstractSqlConnection, tables: Table[], ctx?: Transaction, columns?: Dictionary<Column[]>): Promise<Dictionary<CheckDef[]>>;
|
|
8
8
|
protected getChecksSQL(tables: Table[]): string;
|
|
9
9
|
getChecks(connection: AbstractSqlConnection, tableName: string, schemaName: string, columns?: Column[]): Promise<CheckDef[]>;
|
|
10
10
|
protected wrap(val: string | undefined | null, type: Type<unknown>): string | undefined | null;
|
package/MariaDbSchemaHelper.js
CHANGED
|
@@ -3,16 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.MariaDbSchemaHelper = void 0;
|
|
4
4
|
const knex_1 = require("@mikro-orm/knex");
|
|
5
5
|
class MariaDbSchemaHelper extends knex_1.MySqlSchemaHelper {
|
|
6
|
-
async loadInformationSchema(schema, connection, tables) {
|
|
6
|
+
async loadInformationSchema(schema, connection, tables, schemas, ctx) {
|
|
7
7
|
/* istanbul ignore next */
|
|
8
8
|
if (tables.length === 0) {
|
|
9
9
|
return;
|
|
10
10
|
}
|
|
11
|
-
const columns = await this.getAllColumns(connection, tables);
|
|
12
|
-
const indexes = await this.getAllIndexes(connection, tables);
|
|
13
|
-
const checks = await this.getAllChecks(connection, tables, columns);
|
|
14
|
-
const fks = await this.getAllForeignKeys(connection, tables);
|
|
15
|
-
const enums = await this.getAllEnumDefinitions(connection, tables);
|
|
11
|
+
const columns = await this.getAllColumns(connection, tables, ctx);
|
|
12
|
+
const indexes = await this.getAllIndexes(connection, tables, ctx);
|
|
13
|
+
const checks = await this.getAllChecks(connection, tables, ctx, columns);
|
|
14
|
+
const fks = await this.getAllForeignKeys(connection, tables, ctx);
|
|
15
|
+
const enums = await this.getAllEnumDefinitions(connection, tables, ctx);
|
|
16
16
|
for (const t of tables) {
|
|
17
17
|
const key = this.getTableKey(t);
|
|
18
18
|
const table = schema.addTable(t.table_name, t.schema_name, t.table_comment);
|
|
@@ -20,12 +20,12 @@ class MariaDbSchemaHelper extends knex_1.MySqlSchemaHelper {
|
|
|
20
20
|
table.init(columns[key], indexes[key], checks[key], pks, fks[key], enums[key]);
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
-
async getAllIndexes(connection, tables) {
|
|
23
|
+
async getAllIndexes(connection, tables, ctx) {
|
|
24
24
|
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
|
|
25
25
|
from information_schema.statistics where table_schema = database()
|
|
26
26
|
and table_name in (${tables.map(t => this.platform.quoteValue(t.table_name)).join(', ')})
|
|
27
27
|
order by schema_name, table_name, index_name, seq_in_index`;
|
|
28
|
-
const allIndexes = await connection.execute(sql);
|
|
28
|
+
const allIndexes = await connection.execute(sql, [], 'all', ctx);
|
|
29
29
|
const ret = {};
|
|
30
30
|
for (const index of allIndexes) {
|
|
31
31
|
const key = this.getTableKey(index);
|
|
@@ -43,7 +43,7 @@ class MariaDbSchemaHelper extends knex_1.MySqlSchemaHelper {
|
|
|
43
43
|
}
|
|
44
44
|
return ret;
|
|
45
45
|
}
|
|
46
|
-
async getAllColumns(connection, tables) {
|
|
46
|
+
async getAllColumns(connection, tables, ctx) {
|
|
47
47
|
const sql = `select table_name as table_name,
|
|
48
48
|
nullif(table_schema, schema()) as schema_name,
|
|
49
49
|
column_name as column_name,
|
|
@@ -60,7 +60,7 @@ class MariaDbSchemaHelper extends knex_1.MySqlSchemaHelper {
|
|
|
60
60
|
ifnull(datetime_precision, character_maximum_length) length
|
|
61
61
|
from information_schema.columns where table_schema = database() and table_name in (${tables.map(t => this.platform.quoteValue(t.table_name))})
|
|
62
62
|
order by ordinal_position`;
|
|
63
|
-
const allColumns = await connection.execute(sql);
|
|
63
|
+
const allColumns = await connection.execute(sql, [], 'all', ctx);
|
|
64
64
|
const str = (val) => val != null ? '' + val : val;
|
|
65
65
|
const extra = (val) => val.replace(/auto_increment|default_generated|(stored|virtual) generated/i, '').trim() || undefined;
|
|
66
66
|
const ret = {};
|
|
@@ -93,9 +93,9 @@ class MariaDbSchemaHelper extends knex_1.MySqlSchemaHelper {
|
|
|
93
93
|
}
|
|
94
94
|
return ret;
|
|
95
95
|
}
|
|
96
|
-
async getAllChecks(connection, tables, columns) {
|
|
96
|
+
async getAllChecks(connection, tables, ctx, columns) {
|
|
97
97
|
const sql = this.getChecksSQL(tables);
|
|
98
|
-
const allChecks = await connection.execute(sql);
|
|
98
|
+
const allChecks = await connection.execute(sql, [], 'all', ctx);
|
|
99
99
|
const ret = {};
|
|
100
100
|
for (const check of allChecks) {
|
|
101
101
|
const key = this.getTableKey(check);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/mariadb",
|
|
3
|
-
"version": "6.6.
|
|
3
|
+
"version": "6.6.11-dev.1",
|
|
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
|
"main": "index.js",
|
|
6
6
|
"module": "index.mjs",
|
|
@@ -58,13 +58,13 @@
|
|
|
58
58
|
"access": "public"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@mikro-orm/knex": "6.6.
|
|
61
|
+
"@mikro-orm/knex": "6.6.11-dev.1",
|
|
62
62
|
"mariadb": "3.4.5"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"@mikro-orm/core": "^6.6.10"
|
|
66
66
|
},
|
|
67
67
|
"peerDependencies": {
|
|
68
|
-
"@mikro-orm/core": "
|
|
68
|
+
"@mikro-orm/core": "6.6.11-dev.1"
|
|
69
69
|
}
|
|
70
70
|
}
|