@mikro-orm/mariadb 7.0.0-dev.33 → 7.0.0-dev.330
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/MariaDbDriver.d.ts +5 -2
- package/MariaDbDriver.js +9 -2
- package/MariaDbMikroORM.d.ts +6 -7
- package/MariaDbMikroORM.js +6 -8
- package/MariaDbQueryBuilder.js +31 -45
- package/MariaDbSchemaHelper.d.ts +1 -0
- package/MariaDbSchemaHelper.js +52 -11
- package/README.md +7 -4
- package/index.d.ts +1 -1
- package/package.json +33 -34
package/MariaDbDriver.d.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import { type AnyEntity, type Configuration, type ConnectionType, type LoggingOptions, type Transaction } from '@mikro-orm/core';
|
|
1
|
+
import { type AnyEntity, type Configuration, type ConnectionType, type LoggingOptions, type Transaction, type Constructor, type EntityName } from '@mikro-orm/core';
|
|
2
2
|
import { MySqlDriver, type SqlEntityManager } from '@mikro-orm/mysql';
|
|
3
3
|
import { MariaDbPlatform } from './MariaDbPlatform.js';
|
|
4
4
|
import { MariaDbQueryBuilder } from './MariaDbQueryBuilder.js';
|
|
5
|
+
import { MariaDbMikroORM } from './MariaDbMikroORM.js';
|
|
5
6
|
export declare class MariaDbDriver extends MySqlDriver {
|
|
6
7
|
readonly platform: MariaDbPlatform;
|
|
7
8
|
constructor(config: Configuration);
|
|
8
|
-
createQueryBuilder<T extends AnyEntity<T>>(entityName:
|
|
9
|
+
createQueryBuilder<T extends AnyEntity<T>>(entityName: EntityName<T>, ctx?: Transaction, preferredConnectionType?: ConnectionType, convertCustomTypes?: boolean, loggerContext?: LoggingOptions, alias?: string, em?: SqlEntityManager): MariaDbQueryBuilder<T, any, any, any>;
|
|
10
|
+
/** @inheritDoc */
|
|
11
|
+
getORMClass(): Constructor<MariaDbMikroORM>;
|
|
9
12
|
}
|
package/MariaDbDriver.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { QueryFlag } from '@mikro-orm/core';
|
|
1
|
+
import { QueryFlag, } from '@mikro-orm/core';
|
|
2
2
|
import { MySqlDriver } from '@mikro-orm/mysql';
|
|
3
3
|
import { MariaDbPlatform } from './MariaDbPlatform.js';
|
|
4
4
|
import { MariaDbQueryBuilder } from './MariaDbQueryBuilder.js';
|
|
5
|
+
import { MariaDbMikroORM } from './MariaDbMikroORM.js';
|
|
5
6
|
export class MariaDbDriver extends MySqlDriver {
|
|
6
7
|
constructor(config) {
|
|
7
8
|
super(config);
|
|
@@ -9,11 +10,17 @@ export class MariaDbDriver extends MySqlDriver {
|
|
|
9
10
|
}
|
|
10
11
|
createQueryBuilder(entityName, ctx, preferredConnectionType, convertCustomTypes, loggerContext, alias, em) {
|
|
11
12
|
// do not compute the connectionType if EM is provided as it will be computed from it in the QB later on
|
|
12
|
-
const connectionType = em
|
|
13
|
+
const connectionType = em
|
|
14
|
+
? preferredConnectionType
|
|
15
|
+
: this.resolveConnectionType({ ctx, connectionType: preferredConnectionType });
|
|
13
16
|
const qb = new MariaDbQueryBuilder(entityName, this.metadata, this, ctx, alias, connectionType, em, loggerContext);
|
|
14
17
|
if (!convertCustomTypes) {
|
|
15
18
|
qb.unsetFlag(QueryFlag.CONVERT_CUSTOM_TYPES);
|
|
16
19
|
}
|
|
17
20
|
return qb;
|
|
18
21
|
}
|
|
22
|
+
/** @inheritDoc */
|
|
23
|
+
getORMClass() {
|
|
24
|
+
return MariaDbMikroORM;
|
|
25
|
+
}
|
|
19
26
|
}
|
package/MariaDbMikroORM.d.ts
CHANGED
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
import { MikroORM, type Options, type IDatabaseDriver, type EntityManager, type EntityManagerType } from '@mikro-orm/core';
|
|
1
|
+
import { type AnyEntity, type EntityClass, type EntitySchema, MikroORM, type Options, type IDatabaseDriver, type EntityManager, type EntityManagerType } from '@mikro-orm/core';
|
|
2
2
|
import type { SqlEntityManager } from '@mikro-orm/mysql';
|
|
3
3
|
import { MariaDbDriver } from './MariaDbDriver.js';
|
|
4
|
+
export type MariaDbOptions<EM extends SqlEntityManager<MariaDbDriver> = SqlEntityManager<MariaDbDriver>, Entities extends (string | EntityClass<AnyEntity> | EntitySchema)[] = (string | EntityClass<AnyEntity> | EntitySchema)[]> = Partial<Options<MariaDbDriver, EM, Entities>>;
|
|
5
|
+
export declare function defineMariaDbConfig<EM extends SqlEntityManager<MariaDbDriver> = SqlEntityManager<MariaDbDriver>, Entities extends (string | EntityClass<AnyEntity> | EntitySchema)[] = (string | EntityClass<AnyEntity> | EntitySchema)[]>(options: Partial<Options<MariaDbDriver, EM, Entities>>): Partial<Options<MariaDbDriver, EM, Entities>>;
|
|
4
6
|
/**
|
|
5
7
|
* @inheritDoc
|
|
6
8
|
*/
|
|
7
|
-
export declare class MariaDbMikroORM<EM extends
|
|
8
|
-
private static DRIVER;
|
|
9
|
+
export declare class MariaDbMikroORM<EM extends SqlEntityManager<MariaDbDriver> = SqlEntityManager<MariaDbDriver>, Entities extends (string | EntityClass<AnyEntity> | EntitySchema)[] = (string | EntityClass<AnyEntity> | EntitySchema)[]> extends MikroORM<MariaDbDriver, EM, Entities> {
|
|
9
10
|
/**
|
|
10
11
|
* @inheritDoc
|
|
11
12
|
*/
|
|
12
|
-
static init<D extends IDatabaseDriver = MariaDbDriver, EM extends EntityManager = D[typeof EntityManagerType] & EntityManager>(options
|
|
13
|
+
static init<D extends IDatabaseDriver = MariaDbDriver, EM extends EntityManager<D> = D[typeof EntityManagerType] & EntityManager<D>, Entities extends (string | EntityClass<AnyEntity> | EntitySchema)[] = (string | EntityClass<AnyEntity> | EntitySchema)[]>(options: Partial<Options<D, EM, Entities>>): Promise<MikroORM<D, EM, Entities>>;
|
|
13
14
|
/**
|
|
14
15
|
* @inheritDoc
|
|
15
16
|
*/
|
|
16
|
-
|
|
17
|
+
constructor(options: Partial<Options<MariaDbDriver, EM, Entities>>);
|
|
17
18
|
}
|
|
18
|
-
export type MariaDbOptions = Options<MariaDbDriver>;
|
|
19
|
-
export declare function defineMariaDbConfig(options: MariaDbOptions): Options<MariaDbDriver, SqlEntityManager<MariaDbDriver> & EntityManager<IDatabaseDriver<import("@mikro-orm/core").Connection>>>;
|
package/MariaDbMikroORM.js
CHANGED
|
@@ -1,24 +1,22 @@
|
|
|
1
1
|
import { defineConfig, MikroORM, } from '@mikro-orm/core';
|
|
2
2
|
import { MariaDbDriver } from './MariaDbDriver.js';
|
|
3
|
+
export function defineMariaDbConfig(options) {
|
|
4
|
+
return defineConfig({ driver: MariaDbDriver, ...options });
|
|
5
|
+
}
|
|
3
6
|
/**
|
|
4
7
|
* @inheritDoc
|
|
5
8
|
*/
|
|
6
9
|
export class MariaDbMikroORM extends MikroORM {
|
|
7
|
-
static DRIVER = MariaDbDriver;
|
|
8
10
|
/**
|
|
9
11
|
* @inheritDoc
|
|
10
12
|
*/
|
|
11
13
|
static async init(options) {
|
|
12
|
-
return super.init(options);
|
|
14
|
+
return super.init(defineMariaDbConfig(options));
|
|
13
15
|
}
|
|
14
16
|
/**
|
|
15
17
|
* @inheritDoc
|
|
16
18
|
*/
|
|
17
|
-
|
|
18
|
-
|
|
19
|
+
constructor(options) {
|
|
20
|
+
super(defineMariaDbConfig(options));
|
|
19
21
|
}
|
|
20
22
|
}
|
|
21
|
-
/* v8 ignore next 3 */
|
|
22
|
-
export function defineMariaDbConfig(options) {
|
|
23
|
-
return defineConfig({ driver: MariaDbDriver, ...options });
|
|
24
|
-
}
|
package/MariaDbQueryBuilder.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { raw, RawQueryFragment, } from '@mikro-orm/core';
|
|
1
|
+
import { raw, RawQueryFragment, Utils } from '@mikro-orm/core';
|
|
2
2
|
import { QueryBuilder } from '@mikro-orm/mysql';
|
|
3
3
|
/**
|
|
4
4
|
* @inheritDoc
|
|
@@ -7,22 +7,23 @@ export class MariaDbQueryBuilder extends QueryBuilder {
|
|
|
7
7
|
wrapPaginateSubQuery(meta) {
|
|
8
8
|
const pks = this.prepareFields(meta.primaryKeys, 'sub-query');
|
|
9
9
|
const quotedPKs = pks.map(pk => this.platform.quoteIdentifier(pk));
|
|
10
|
-
const subQuery = this.clone(['
|
|
10
|
+
const subQuery = this.clone(['orderBy', 'fields'])
|
|
11
|
+
.select(pks)
|
|
12
|
+
.groupBy(pks)
|
|
13
|
+
.limit(this.state.limit);
|
|
11
14
|
// revert the on conditions added via populateWhere, we want to apply those only once
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
subQuery.offset(this._offset);
|
|
15
|
+
Object.values(subQuery.state.joins).forEach(join => (join.cond = join.cond_ ?? {}));
|
|
16
|
+
if (this.state.offset) {
|
|
17
|
+
subQuery.offset(this.state.offset);
|
|
16
18
|
}
|
|
17
19
|
const addToSelect = [];
|
|
18
|
-
if (this.
|
|
20
|
+
if (this.state.orderBy.length > 0) {
|
|
19
21
|
const orderBy = [];
|
|
20
|
-
for (const orderMap of this.
|
|
21
|
-
for (const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
orderBy.push({ [rawField.clone()]: direction });
|
|
22
|
+
for (const orderMap of this.state.orderBy) {
|
|
23
|
+
for (const field of Utils.getObjectQueryKeys(orderMap)) {
|
|
24
|
+
const direction = orderMap[field];
|
|
25
|
+
if (RawQueryFragment.isKnownFragmentSymbol(field)) {
|
|
26
|
+
orderBy.push({ [field]: direction });
|
|
26
27
|
continue;
|
|
27
28
|
}
|
|
28
29
|
const [a, f] = this.helper.splitField(field);
|
|
@@ -38,13 +39,12 @@ export class MariaDbQueryBuilder extends QueryBuilder {
|
|
|
38
39
|
}
|
|
39
40
|
subQuery.orderBy(orderBy);
|
|
40
41
|
}
|
|
41
|
-
|
|
42
|
-
subQuery.finalized = true;
|
|
42
|
+
subQuery.state.finalized = true;
|
|
43
43
|
const innerQuery = subQuery.as(this.mainAlias.aliasName).clear('select').select(pks);
|
|
44
|
-
/* v8 ignore
|
|
44
|
+
/* v8 ignore next */
|
|
45
45
|
if (addToSelect.length > 0) {
|
|
46
46
|
addToSelect.forEach(prop => {
|
|
47
|
-
const field = this.
|
|
47
|
+
const field = this.state.fields.find(field => {
|
|
48
48
|
if (typeof field === 'object' && field && '__as' in field) {
|
|
49
49
|
return field.__as === prop;
|
|
50
50
|
}
|
|
@@ -62,39 +62,25 @@ export class MariaDbQueryBuilder extends QueryBuilder {
|
|
|
62
62
|
}
|
|
63
63
|
});
|
|
64
64
|
}
|
|
65
|
-
/* v8 ignore stop */
|
|
66
65
|
// multiple sub-queries are needed to get around mysql limitations with order by + limit + where in + group by (o.O)
|
|
67
66
|
// https://stackoverflow.com/questions/17892762/mysql-this-version-of-mysql-doesnt-yet-support-limit-in-all-any-some-subqu
|
|
68
67
|
const subSubQuery = this.platform.createNativeQueryBuilder();
|
|
69
68
|
subSubQuery.select(raw(`json_arrayagg(${quotedPKs.join(', ')})`)).from(innerQuery);
|
|
70
|
-
this.
|
|
71
|
-
this.
|
|
72
|
-
//
|
|
73
|
-
const
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
const field = hint.field.split(':')[0];
|
|
80
|
-
populate.add((prefix ? prefix + '.' : '') + field);
|
|
81
|
-
if (hint.children) {
|
|
82
|
-
addPath(hint.children, (prefix ? prefix + '.' : '') + field);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
addPath(this._populate);
|
|
87
|
-
for (const [key, join] of Object.entries(this._joins)) {
|
|
88
|
-
const path = join.path?.replace(/\[populate]|\[pivot]|:ref/g, '').replace(new RegExp(`^${meta.className}.`), '');
|
|
89
|
-
/* v8 ignore next 3 */
|
|
90
|
-
if (!populate.has(path ?? '') && !orderByAliases.includes(join.alias)) {
|
|
91
|
-
delete this._joins[key];
|
|
92
|
-
}
|
|
93
|
-
}
|
|
69
|
+
this.state.limit = undefined;
|
|
70
|
+
this.state.offset = undefined;
|
|
71
|
+
// Save the original WHERE conditions before pruning joins
|
|
72
|
+
const originalCond = this.state.cond;
|
|
73
|
+
const populatePaths = this.getPopulatePaths();
|
|
74
|
+
// Remove joins that are not used for population or ordering
|
|
75
|
+
this.pruneJoinsForPagination(meta, populatePaths);
|
|
76
|
+
// Transfer WHERE conditions to ORDER BY joins (GH #6160)
|
|
77
|
+
this.transferConditionsForOrderByJoins(meta, originalCond, populatePaths);
|
|
94
78
|
const subquerySql = subSubQuery.toString();
|
|
95
|
-
const key = meta.getPrimaryProps()[0].runtimeType === 'string'
|
|
79
|
+
const key = meta.getPrimaryProps()[0].runtimeType === 'string'
|
|
80
|
+
? `concat('"', ${quotedPKs.join(', ')}, '"')`
|
|
81
|
+
: quotedPKs.join(', ');
|
|
96
82
|
const sql = `json_contains((${subquerySql}), ${key})`;
|
|
97
|
-
this.
|
|
98
|
-
this.select(this.
|
|
83
|
+
this.state.cond = {};
|
|
84
|
+
this.select(this.state.fields).where(sql);
|
|
99
85
|
}
|
|
100
86
|
}
|
package/MariaDbSchemaHelper.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type AbstractSqlConnection, type CheckDef, type Column, type IndexDef, type DatabaseSchema, type Table, MySqlSchemaHelper } from '@mikro-orm/mysql';
|
|
2
2
|
import { type Dictionary, type Type } from '@mikro-orm/core';
|
|
3
3
|
export declare class MariaDbSchemaHelper extends MySqlSchemaHelper {
|
|
4
|
+
protected appendMySqlIndexSuffix(sql: string, index: IndexDef): string;
|
|
4
5
|
loadInformationSchema(schema: DatabaseSchema, connection: AbstractSqlConnection, tables: Table[]): Promise<void>;
|
|
5
6
|
getAllIndexes(connection: AbstractSqlConnection, tables: Table[]): Promise<Dictionary<IndexDef[]>>;
|
|
6
7
|
getAllColumns(connection: AbstractSqlConnection, tables: Table[]): Promise<Dictionary<Column[]>>;
|
package/MariaDbSchemaHelper.js
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
import { MySqlSchemaHelper, } from '@mikro-orm/mysql';
|
|
2
2
|
export class MariaDbSchemaHelper extends MySqlSchemaHelper {
|
|
3
|
+
appendMySqlIndexSuffix(sql, index) {
|
|
4
|
+
// MariaDB uses IGNORED instead of MySQL's INVISIBLE keyword
|
|
5
|
+
if (index.invisible) {
|
|
6
|
+
sql += ' ignored';
|
|
7
|
+
}
|
|
8
|
+
// MariaDB supports CLUSTERING=YES only with the Aria storage engine.
|
|
9
|
+
// Using this option with InnoDB tables will have no effect (silently ignored).
|
|
10
|
+
// See: https://mariadb.com/kb/en/create-index/#clustering-yes
|
|
11
|
+
if (index.clustered) {
|
|
12
|
+
sql += ' clustering=yes';
|
|
13
|
+
}
|
|
14
|
+
return sql;
|
|
15
|
+
}
|
|
3
16
|
async loadInformationSchema(schema, connection, tables) {
|
|
4
17
|
/* v8 ignore next */
|
|
5
18
|
if (tables.length === 0) {
|
|
@@ -18,7 +31,7 @@ export class MariaDbSchemaHelper extends MySqlSchemaHelper {
|
|
|
18
31
|
}
|
|
19
32
|
}
|
|
20
33
|
async getAllIndexes(connection, tables) {
|
|
21
|
-
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
|
|
34
|
+
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 */
|
|
22
35
|
from information_schema.statistics where table_schema = database()
|
|
23
36
|
and table_name in (${tables.map(t => this.platform.quoteValue(t.table_name)).join(', ')})
|
|
24
37
|
order by schema_name, table_name, index_name, seq_in_index`;
|
|
@@ -26,14 +39,38 @@ export class MariaDbSchemaHelper extends MySqlSchemaHelper {
|
|
|
26
39
|
const ret = {};
|
|
27
40
|
for (const index of allIndexes) {
|
|
28
41
|
const key = this.getTableKey(index);
|
|
29
|
-
|
|
30
|
-
ret[key].push({
|
|
42
|
+
const indexDef = {
|
|
31
43
|
columnNames: [index.column_name],
|
|
32
44
|
keyName: index.index_name,
|
|
33
45
|
unique: !index.non_unique,
|
|
34
46
|
primary: index.index_name === 'PRIMARY',
|
|
35
47
|
constraint: !index.non_unique,
|
|
36
|
-
}
|
|
48
|
+
};
|
|
49
|
+
// Capture column options (prefix length, sort order)
|
|
50
|
+
if (index.sub_part != null || index.sort_order === 'D') {
|
|
51
|
+
indexDef.columns = [
|
|
52
|
+
{
|
|
53
|
+
name: index.column_name,
|
|
54
|
+
...(index.sub_part != null && { length: index.sub_part }),
|
|
55
|
+
...(index.sort_order === 'D' && { sort: 'DESC' }),
|
|
56
|
+
},
|
|
57
|
+
];
|
|
58
|
+
}
|
|
59
|
+
// Capture index type for fulltext and spatial indexes
|
|
60
|
+
if (index.index_type === 'FULLTEXT') {
|
|
61
|
+
indexDef.type = 'fulltext';
|
|
62
|
+
}
|
|
63
|
+
else if (index.index_type === 'SPATIAL') {
|
|
64
|
+
/* v8 ignore next */
|
|
65
|
+
indexDef.type = 'spatial';
|
|
66
|
+
}
|
|
67
|
+
// Capture ignored flag (MariaDB 10.6+, equivalent to MySQL's INVISIBLE)
|
|
68
|
+
/* v8 ignore next */
|
|
69
|
+
if (index.ignored === 'YES') {
|
|
70
|
+
indexDef.invisible = true;
|
|
71
|
+
}
|
|
72
|
+
ret[key] ??= [];
|
|
73
|
+
ret[key].push(indexDef);
|
|
37
74
|
}
|
|
38
75
|
for (const key of Object.keys(ret)) {
|
|
39
76
|
ret[key] = await this.mapIndexes(ret[key]);
|
|
@@ -55,24 +92,28 @@ export class MariaDbSchemaHelper extends MySqlSchemaHelper {
|
|
|
55
92
|
numeric_precision as numeric_precision,
|
|
56
93
|
numeric_scale as numeric_scale,
|
|
57
94
|
ifnull(datetime_precision, character_maximum_length) length
|
|
58
|
-
from information_schema.columns where table_schema = database() and table_name in (${tables.map(t => this.platform.quoteValue(t.table_name))})
|
|
95
|
+
from information_schema.columns where table_schema = database() and table_name in (${tables.map(t => this.platform.quoteValue(t.table_name)).join(', ')})
|
|
59
96
|
order by ordinal_position`;
|
|
60
97
|
const allColumns = await connection.execute(sql);
|
|
61
|
-
const str = (val) => val != null ? '' + val : val;
|
|
98
|
+
const str = (val) => (val != null ? '' + val : val);
|
|
62
99
|
const extra = (val) => val.replace(/auto_increment|default_generated|(stored|virtual) generated/i, '').trim() || undefined;
|
|
63
100
|
const ret = {};
|
|
64
101
|
for (const col of allColumns) {
|
|
65
102
|
const mappedType = this.platform.getMappedType(col.column_type);
|
|
66
|
-
const tmp = this.normalizeDefaultValue(
|
|
103
|
+
const tmp = this.normalizeDefaultValue(mappedType.compareAsType() === 'boolean' && ['0', '1'].includes(col.column_default)
|
|
67
104
|
? ['false', 'true'][+col.column_default]
|
|
68
105
|
: col.column_default, col.length);
|
|
69
106
|
const defaultValue = str(tmp === 'NULL' && col.is_nullable === 'YES' ? null : tmp);
|
|
70
107
|
const key = this.getTableKey(col);
|
|
71
|
-
const generated = col.generation_expression
|
|
108
|
+
const generated = col.generation_expression
|
|
109
|
+
? `${col.generation_expression.replaceAll(`\\'`, `'`)} ${col.extra.match(/stored generated/i) ? 'stored' : 'virtual'}`
|
|
110
|
+
: undefined;
|
|
72
111
|
ret[key] ??= [];
|
|
73
112
|
ret[key].push({
|
|
74
113
|
name: col.column_name,
|
|
75
|
-
type: this.platform.isNumericColumn(mappedType)
|
|
114
|
+
type: this.platform.isNumericColumn(mappedType)
|
|
115
|
+
? col.column_type.replace(/ unsigned$/, '').replace(/\(\d+\)$/, '')
|
|
116
|
+
: col.column_type,
|
|
76
117
|
mappedType,
|
|
77
118
|
unsigned: col.column_type.endsWith(' unsigned'),
|
|
78
119
|
length: col.length,
|
|
@@ -96,7 +137,7 @@ export class MariaDbSchemaHelper extends MySqlSchemaHelper {
|
|
|
96
137
|
const ret = {};
|
|
97
138
|
for (const check of allChecks) {
|
|
98
139
|
const key = this.getTableKey(check);
|
|
99
|
-
const match =
|
|
140
|
+
const match = /^json_valid\(`(.*)`\)$/i.exec(check.expression);
|
|
100
141
|
const col = columns?.[key]?.find(col => col.name === match?.[1]);
|
|
101
142
|
if (col && match) {
|
|
102
143
|
col.type = 'json';
|
|
@@ -122,7 +163,7 @@ export class MariaDbSchemaHelper extends MySqlSchemaHelper {
|
|
|
122
163
|
tc.check_clause as expression,
|
|
123
164
|
/*M!100510 case when tc.level = 'Column' then tc.constraint_name else */ null /*M!100510 end */ as column_name
|
|
124
165
|
from information_schema.check_constraints tc
|
|
125
|
-
where tc.table_name in (${tables.map(t => this.platform.quoteValue(t.table_name))}) and tc.constraint_schema = database()
|
|
166
|
+
where tc.table_name in (${tables.map(t => this.platform.quoteValue(t.table_name)).join(', ')}) and tc.constraint_schema = database()
|
|
126
167
|
order by tc.constraint_name`;
|
|
127
168
|
}
|
|
128
169
|
wrap(val, type) {
|
package/README.md
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
<a href="https://mikro-orm.io"><img src="https://raw.githubusercontent.com/mikro-orm/mikro-orm/master/docs/static/img/logo-readme.svg?sanitize=true" alt="MikroORM" /></a>
|
|
3
3
|
</h1>
|
|
4
4
|
|
|
5
|
-
TypeScript ORM for Node.js based on Data Mapper, [Unit of Work](https://mikro-orm.io/docs/unit-of-work/) and [Identity Map](https://mikro-orm.io/docs/identity-map/) patterns. Supports MongoDB, MySQL, MariaDB, PostgreSQL
|
|
5
|
+
TypeScript ORM for Node.js based on Data Mapper, [Unit of Work](https://mikro-orm.io/docs/unit-of-work/) and [Identity Map](https://mikro-orm.io/docs/identity-map/) patterns. Supports MongoDB, MySQL, MariaDB, PostgreSQL, SQLite (including libSQL), MSSQL and Oracle databases.
|
|
6
6
|
|
|
7
7
|
> Heavily inspired by [Doctrine](https://www.doctrine-project.org/) and [Hibernate](https://hibernate.org/).
|
|
8
8
|
|
|
9
|
-
[](https://
|
|
10
|
-
[](https://
|
|
9
|
+
[](https://npmx.dev/package/@mikro-orm/core)
|
|
10
|
+
[](https://npmx.dev/package/@mikro-orm/core)
|
|
11
11
|
[](https://discord.gg/w8bjxFHS7X)
|
|
12
|
-
[](https://
|
|
12
|
+
[](https://npmx.dev/package/@mikro-orm/core)
|
|
13
13
|
[](https://coveralls.io/r/mikro-orm/mikro-orm?branch=master)
|
|
14
14
|
[](https://github.com/mikro-orm/mikro-orm/actions?workflow=tests)
|
|
15
15
|
|
|
@@ -181,6 +181,7 @@ yarn add @mikro-orm/core @mikro-orm/mysql # for mysql/mariadb
|
|
|
181
181
|
yarn add @mikro-orm/core @mikro-orm/mariadb # for mysql/mariadb
|
|
182
182
|
yarn add @mikro-orm/core @mikro-orm/postgresql # for postgresql
|
|
183
183
|
yarn add @mikro-orm/core @mikro-orm/mssql # for mssql
|
|
184
|
+
yarn add @mikro-orm/core @mikro-orm/oracledb # for oracle
|
|
184
185
|
yarn add @mikro-orm/core @mikro-orm/sqlite # for sqlite
|
|
185
186
|
yarn add @mikro-orm/core @mikro-orm/libsql # for libsql
|
|
186
187
|
```
|
|
@@ -381,6 +382,8 @@ See also the list of contributors who [participated](https://github.com/mikro-or
|
|
|
381
382
|
|
|
382
383
|
Please ⭐️ this repository if this project helped you!
|
|
383
384
|
|
|
385
|
+
> If you'd like to support my open-source work, consider sponsoring me directly at [github.com/sponsors/b4nan](https://github.com/sponsors/b4nan).
|
|
386
|
+
|
|
384
387
|
## 📝 License
|
|
385
388
|
|
|
386
389
|
Copyright © 2018 [Martin Adámek](https://github.com/b4nan).
|
package/index.d.ts
CHANGED
|
@@ -2,4 +2,4 @@ export * from '@mikro-orm/mysql';
|
|
|
2
2
|
export * from './MariaDbSchemaHelper.js';
|
|
3
3
|
export * from './MariaDbPlatform.js';
|
|
4
4
|
export * from './MariaDbDriver.js';
|
|
5
|
-
export { MariaDbMikroORM as MikroORM, MariaDbOptions as Options, defineMariaDbConfig as defineConfig, } from './MariaDbMikroORM.js';
|
|
5
|
+
export { MariaDbMikroORM as MikroORM, type MariaDbOptions as Options, defineMariaDbConfig as defineConfig, } from './MariaDbMikroORM.js';
|
package/package.json
CHANGED
|
@@ -1,63 +1,62 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/mariadb",
|
|
3
|
-
"
|
|
4
|
-
"version": "7.0.0-dev.33",
|
|
3
|
+
"version": "7.0.0-dev.330",
|
|
5
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.",
|
|
6
|
-
"exports": {
|
|
7
|
-
"./package.json": "./package.json",
|
|
8
|
-
".": "./index.js"
|
|
9
|
-
},
|
|
10
|
-
"repository": {
|
|
11
|
-
"type": "git",
|
|
12
|
-
"url": "git+ssh://git@github.com/mikro-orm/mikro-orm.git"
|
|
13
|
-
},
|
|
14
5
|
"keywords": [
|
|
15
|
-
"
|
|
6
|
+
"data-mapper",
|
|
7
|
+
"ddd",
|
|
8
|
+
"entity",
|
|
9
|
+
"identity-map",
|
|
10
|
+
"javascript",
|
|
11
|
+
"js",
|
|
12
|
+
"mariadb",
|
|
13
|
+
"mikro-orm",
|
|
16
14
|
"mongo",
|
|
17
15
|
"mongodb",
|
|
18
16
|
"mysql",
|
|
19
|
-
"
|
|
17
|
+
"orm",
|
|
20
18
|
"postgresql",
|
|
21
19
|
"sqlite",
|
|
22
20
|
"sqlite3",
|
|
23
21
|
"ts",
|
|
24
22
|
"typescript",
|
|
25
|
-
"
|
|
26
|
-
"javascript",
|
|
27
|
-
"entity",
|
|
28
|
-
"ddd",
|
|
29
|
-
"mikro-orm",
|
|
30
|
-
"unit-of-work",
|
|
31
|
-
"data-mapper",
|
|
32
|
-
"identity-map"
|
|
23
|
+
"unit-of-work"
|
|
33
24
|
],
|
|
34
|
-
"
|
|
35
|
-
"license": "MIT",
|
|
25
|
+
"homepage": "https://mikro-orm.io",
|
|
36
26
|
"bugs": {
|
|
37
27
|
"url": "https://github.com/mikro-orm/mikro-orm/issues"
|
|
38
28
|
},
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
|
|
29
|
+
"license": "MIT",
|
|
30
|
+
"author": "Martin Adámek",
|
|
31
|
+
"repository": {
|
|
32
|
+
"type": "git",
|
|
33
|
+
"url": "git+ssh://git@github.com/mikro-orm/mikro-orm.git"
|
|
34
|
+
},
|
|
35
|
+
"type": "module",
|
|
36
|
+
"exports": {
|
|
37
|
+
"./package.json": "./package.json",
|
|
38
|
+
".": "./index.js"
|
|
39
|
+
},
|
|
40
|
+
"publishConfig": {
|
|
41
|
+
"access": "public"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
|
-
"build": "yarn
|
|
44
|
+
"build": "yarn compile && yarn copy",
|
|
45
45
|
"clean": "yarn run -T rimraf ./dist",
|
|
46
46
|
"compile": "yarn run -T tsc -p tsconfig.build.json",
|
|
47
47
|
"copy": "node ../../scripts/copy.mjs"
|
|
48
48
|
},
|
|
49
|
-
"publishConfig": {
|
|
50
|
-
"access": "public"
|
|
51
|
-
},
|
|
52
49
|
"dependencies": {
|
|
53
|
-
"@mikro-orm/mysql": "7.0.0-dev.
|
|
50
|
+
"@mikro-orm/mysql": "7.0.0-dev.330",
|
|
51
|
+
"kysely": "0.28.11"
|
|
54
52
|
},
|
|
55
53
|
"devDependencies": {
|
|
56
|
-
"@mikro-orm/core": "^6.
|
|
57
|
-
"kysely": "0.28.7"
|
|
54
|
+
"@mikro-orm/core": "^6.6.9"
|
|
58
55
|
},
|
|
59
56
|
"peerDependencies": {
|
|
60
|
-
"@mikro-orm/core": "7.0.0-dev.
|
|
61
|
-
|
|
57
|
+
"@mikro-orm/core": "7.0.0-dev.330"
|
|
58
|
+
},
|
|
59
|
+
"engines": {
|
|
60
|
+
"node": ">= 22.17.0"
|
|
62
61
|
}
|
|
63
62
|
}
|