@mikro-orm/sql 7.0.4-dev.8 → 7.0.4
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/AbstractSqlConnection.d.ts +94 -58
- package/AbstractSqlConnection.js +235 -238
- package/AbstractSqlDriver.d.ts +410 -155
- package/AbstractSqlDriver.js +2064 -1941
- package/AbstractSqlPlatform.d.ts +83 -73
- package/AbstractSqlPlatform.js +162 -158
- package/PivotCollectionPersister.d.ts +33 -15
- package/PivotCollectionPersister.js +158 -160
- package/README.md +1 -1
- package/SqlEntityManager.d.ts +67 -22
- package/SqlEntityManager.js +54 -38
- package/SqlEntityRepository.d.ts +14 -14
- package/SqlEntityRepository.js +23 -23
- package/dialects/mssql/MsSqlNativeQueryBuilder.d.ts +12 -12
- package/dialects/mssql/MsSqlNativeQueryBuilder.js +192 -194
- package/dialects/mysql/BaseMySqlPlatform.d.ts +64 -45
- package/dialects/mysql/BaseMySqlPlatform.js +134 -131
- package/dialects/mysql/MySqlExceptionConverter.d.ts +6 -6
- package/dialects/mysql/MySqlExceptionConverter.js +91 -77
- package/dialects/mysql/MySqlNativeQueryBuilder.d.ts +3 -3
- package/dialects/mysql/MySqlNativeQueryBuilder.js +66 -69
- package/dialects/mysql/MySqlSchemaHelper.d.ts +39 -39
- package/dialects/mysql/MySqlSchemaHelper.js +327 -319
- package/dialects/oracledb/OracleDialect.d.ts +81 -52
- package/dialects/oracledb/OracleDialect.js +155 -149
- package/dialects/oracledb/OracleNativeQueryBuilder.d.ts +12 -12
- package/dialects/oracledb/OracleNativeQueryBuilder.js +232 -236
- package/dialects/postgresql/BasePostgreSqlPlatform.d.ts +109 -105
- package/dialects/postgresql/BasePostgreSqlPlatform.js +354 -350
- package/dialects/postgresql/FullTextType.d.ts +10 -6
- package/dialects/postgresql/FullTextType.js +51 -51
- package/dialects/postgresql/PostgreSqlExceptionConverter.d.ts +5 -5
- package/dialects/postgresql/PostgreSqlExceptionConverter.js +55 -43
- package/dialects/postgresql/PostgreSqlNativeQueryBuilder.d.ts +1 -1
- package/dialects/postgresql/PostgreSqlNativeQueryBuilder.js +4 -4
- package/dialects/postgresql/PostgreSqlSchemaHelper.d.ts +102 -82
- package/dialects/postgresql/PostgreSqlSchemaHelper.js +733 -705
- package/dialects/sqlite/BaseSqliteConnection.d.ts +3 -5
- package/dialects/sqlite/BaseSqliteConnection.js +21 -19
- package/dialects/sqlite/NodeSqliteDialect.d.ts +1 -1
- package/dialects/sqlite/NodeSqliteDialect.js +23 -23
- package/dialects/sqlite/SqliteDriver.d.ts +1 -1
- package/dialects/sqlite/SqliteDriver.js +3 -3
- package/dialects/sqlite/SqliteExceptionConverter.d.ts +6 -6
- package/dialects/sqlite/SqliteExceptionConverter.js +67 -51
- package/dialects/sqlite/SqliteNativeQueryBuilder.d.ts +2 -2
- package/dialects/sqlite/SqliteNativeQueryBuilder.js +7 -7
- package/dialects/sqlite/SqlitePlatform.d.ts +63 -72
- package/dialects/sqlite/SqlitePlatform.js +139 -139
- package/dialects/sqlite/SqliteSchemaHelper.d.ts +70 -60
- package/dialects/sqlite/SqliteSchemaHelper.js +533 -520
- package/package.json +3 -3
- package/plugin/index.d.ts +42 -35
- package/plugin/index.js +43 -36
- package/plugin/transformer.d.ts +117 -94
- package/plugin/transformer.js +890 -881
- package/query/ArrayCriteriaNode.d.ts +4 -4
- package/query/ArrayCriteriaNode.js +18 -18
- package/query/CriteriaNode.d.ts +35 -25
- package/query/CriteriaNode.js +133 -123
- package/query/CriteriaNodeFactory.d.ts +49 -6
- package/query/CriteriaNodeFactory.js +97 -94
- package/query/NativeQueryBuilder.d.ts +118 -118
- package/query/NativeQueryBuilder.js +484 -480
- package/query/ObjectCriteriaNode.d.ts +12 -12
- package/query/ObjectCriteriaNode.js +298 -282
- package/query/QueryBuilder.d.ts +1557 -905
- package/query/QueryBuilder.js +2322 -2192
- package/query/QueryBuilderHelper.d.ts +153 -72
- package/query/QueryBuilderHelper.js +1079 -1028
- package/query/ScalarCriteriaNode.d.ts +3 -3
- package/query/ScalarCriteriaNode.js +53 -46
- package/query/enums.d.ts +14 -14
- package/query/enums.js +14 -14
- package/query/raw.d.ts +16 -6
- package/query/raw.js +10 -10
- package/schema/DatabaseSchema.d.ts +73 -50
- package/schema/DatabaseSchema.js +331 -307
- package/schema/DatabaseTable.d.ts +96 -73
- package/schema/DatabaseTable.js +1012 -927
- package/schema/SchemaComparator.d.ts +70 -66
- package/schema/SchemaComparator.js +766 -740
- package/schema/SchemaHelper.d.ts +109 -95
- package/schema/SchemaHelper.js +675 -659
- package/schema/SqlSchemaGenerator.d.ts +78 -58
- package/schema/SqlSchemaGenerator.js +535 -501
- package/typings.d.ts +380 -266
|
@@ -2,13 +2,17 @@ import { Type, type TransformContext, type RawQueryFragment } from '@mikro-orm/c
|
|
|
2
2
|
import type { BasePostgreSqlPlatform } from './BasePostgreSqlPlatform.js';
|
|
3
3
|
type FullTextWeight = 'A' | 'B' | 'C' | 'D';
|
|
4
4
|
export type WeightedFullTextValue = {
|
|
5
|
-
|
|
5
|
+
[K in FullTextWeight]?: string | null;
|
|
6
6
|
};
|
|
7
7
|
export declare class FullTextType extends Type<string | WeightedFullTextValue, string | null | RawQueryFragment> {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
regconfig: string;
|
|
9
|
+
constructor(regconfig?: string);
|
|
10
|
+
compareAsType(): string;
|
|
11
|
+
getColumnType(): string;
|
|
12
|
+
convertToDatabaseValue(
|
|
13
|
+
value: string | WeightedFullTextValue,
|
|
14
|
+
platform: BasePostgreSqlPlatform,
|
|
15
|
+
context?: TransformContext | boolean,
|
|
16
|
+
): string | null | RawQueryFragment;
|
|
13
17
|
}
|
|
14
18
|
export {};
|
|
@@ -1,59 +1,59 @@
|
|
|
1
1
|
import { raw, Type } from '@mikro-orm/core';
|
|
2
2
|
export class FullTextType extends Type {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
regconfig;
|
|
4
|
+
constructor(regconfig = 'simple') {
|
|
5
|
+
super();
|
|
6
|
+
this.regconfig = regconfig;
|
|
7
|
+
}
|
|
8
|
+
compareAsType() {
|
|
9
|
+
return 'any';
|
|
10
|
+
}
|
|
11
|
+
getColumnType() {
|
|
12
|
+
return 'tsvector';
|
|
13
|
+
}
|
|
14
|
+
// Use convertToDatabaseValue to prepare insert queries as this method has
|
|
15
|
+
// access to the raw JS value. Return Knex#raw to prevent QueryBuilderHelper#mapData
|
|
16
|
+
// from sanitizing the returned chaing of SQL functions.
|
|
17
|
+
convertToDatabaseValue(value, platform, context) {
|
|
18
|
+
// Don't convert to values from select queries to the to_tsvector notation
|
|
19
|
+
// these should be compared as string using a special oparator or function
|
|
20
|
+
// this behaviour is defined in Platform#getFullTextWhereClause.
|
|
21
|
+
// This is always a string.
|
|
22
|
+
if (typeof context === 'object' && context.fromQuery) {
|
|
23
|
+
return value;
|
|
7
24
|
}
|
|
8
|
-
|
|
9
|
-
|
|
25
|
+
// Null values should not be processed
|
|
26
|
+
if (!value) {
|
|
27
|
+
return null;
|
|
10
28
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
//
|
|
15
|
-
//
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
//
|
|
21
|
-
//
|
|
22
|
-
if (
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
// Null values should not be processed
|
|
26
|
-
if (!value) {
|
|
27
|
-
return null;
|
|
29
|
+
// the object from that looks like { A: 'test data', B: 'test data2' ... }
|
|
30
|
+
// must be converted to
|
|
31
|
+
// setweight(to_tsvector(regconfig, value), A) || setweight(to_tsvector(regconfig, value), B)... etc
|
|
32
|
+
// use Knex#raw to do binding of the values sanitization of the boundvalues
|
|
33
|
+
// as we return a raw string which should not be sanitzed anymore
|
|
34
|
+
if (typeof value === 'object') {
|
|
35
|
+
const bindings = [];
|
|
36
|
+
const sqlParts = [];
|
|
37
|
+
for (const [weight, data] of Object.entries(value)) {
|
|
38
|
+
// Check whether the weight is valid according to Postgres,
|
|
39
|
+
// Postgres allows the weight to be upper and lowercase.
|
|
40
|
+
if (!['A', 'B', 'C', 'D'].includes(weight.toUpperCase())) {
|
|
41
|
+
throw new Error('Weight should be one of A, B, C, D.');
|
|
28
42
|
}
|
|
29
|
-
//
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
// as we return a raw string which should not be sanitzed anymore
|
|
34
|
-
if (typeof value === 'object') {
|
|
35
|
-
const bindings = [];
|
|
36
|
-
const sqlParts = [];
|
|
37
|
-
for (const [weight, data] of Object.entries(value)) {
|
|
38
|
-
// Check whether the weight is valid according to Postgres,
|
|
39
|
-
// Postgres allows the weight to be upper and lowercase.
|
|
40
|
-
if (!['A', 'B', 'C', 'D'].includes(weight.toUpperCase())) {
|
|
41
|
-
throw new Error('Weight should be one of A, B, C, D.');
|
|
42
|
-
}
|
|
43
|
-
// Ignore all values that are not a string
|
|
44
|
-
if (typeof data === 'string') {
|
|
45
|
-
sqlParts.push('setweight(to_tsvector(?, ?), ?)');
|
|
46
|
-
bindings.push(this.regconfig, data, weight);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
// Return null if the object has no valid strings
|
|
50
|
-
if (sqlParts.length === 0) {
|
|
51
|
-
return null;
|
|
52
|
-
}
|
|
53
|
-
// Join all the `setweight` parts using the PostgreSQL tsvector `||` concatenation operator
|
|
54
|
-
return raw(sqlParts.join(' || '), bindings);
|
|
43
|
+
// Ignore all values that are not a string
|
|
44
|
+
if (typeof data === 'string') {
|
|
45
|
+
sqlParts.push('setweight(to_tsvector(?, ?), ?)');
|
|
46
|
+
bindings.push(this.regconfig, data, weight);
|
|
55
47
|
}
|
|
56
|
-
|
|
57
|
-
|
|
48
|
+
}
|
|
49
|
+
// Return null if the object has no valid strings
|
|
50
|
+
if (sqlParts.length === 0) {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
// Join all the `setweight` parts using the PostgreSQL tsvector `||` concatenation operator
|
|
54
|
+
return raw(sqlParts.join(' || '), bindings);
|
|
58
55
|
}
|
|
56
|
+
// if it's not an object, it is expected to be string which does not have to be wrapped in setweight.
|
|
57
|
+
return raw('to_tsvector(?, ?)', [this.regconfig, value]);
|
|
58
|
+
}
|
|
59
59
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ExceptionConverter, type Dictionary, type DriverException } from '@mikro-orm/core';
|
|
2
2
|
export declare class PostgreSqlExceptionConverter extends ExceptionConverter {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
/**
|
|
4
|
+
* @see http://www.postgresql.org/docs/9.4/static/errcodes-appendix.html
|
|
5
|
+
* @see https://github.com/doctrine/dbal/blob/master/src/Driver/AbstractPostgreSQLDriver.php
|
|
6
|
+
*/
|
|
7
|
+
convertException(exception: Error & Dictionary): DriverException;
|
|
8
8
|
}
|
|
@@ -1,47 +1,59 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
DeadlockException,
|
|
3
|
+
ExceptionConverter,
|
|
4
|
+
ForeignKeyConstraintViolationException,
|
|
5
|
+
InvalidFieldNameException,
|
|
6
|
+
NonUniqueFieldNameException,
|
|
7
|
+
NotNullConstraintViolationException,
|
|
8
|
+
SyntaxErrorException,
|
|
9
|
+
TableExistsException,
|
|
10
|
+
TableNotFoundException,
|
|
11
|
+
UniqueConstraintViolationException,
|
|
12
|
+
CheckConstraintViolationException,
|
|
13
|
+
} from '@mikro-orm/core';
|
|
2
14
|
export class PostgreSqlExceptionConverter extends ExceptionConverter {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
break;
|
|
26
|
-
case '23502':
|
|
27
|
-
return new NotNullConstraintViolationException(exception);
|
|
28
|
-
case '23503':
|
|
29
|
-
return new ForeignKeyConstraintViolationException(exception);
|
|
30
|
-
case '23505':
|
|
31
|
-
return new UniqueConstraintViolationException(exception);
|
|
32
|
-
case '23514':
|
|
33
|
-
return new CheckConstraintViolationException(exception);
|
|
34
|
-
case '42601':
|
|
35
|
-
return new SyntaxErrorException(exception);
|
|
36
|
-
case '42702':
|
|
37
|
-
return new NonUniqueFieldNameException(exception);
|
|
38
|
-
case '42703':
|
|
39
|
-
return new InvalidFieldNameException(exception);
|
|
40
|
-
case '42P01':
|
|
41
|
-
return new TableNotFoundException(exception);
|
|
42
|
-
case '42P07':
|
|
43
|
-
return new TableExistsException(exception);
|
|
15
|
+
/**
|
|
16
|
+
* @see http://www.postgresql.org/docs/9.4/static/errcodes-appendix.html
|
|
17
|
+
* @see https://github.com/doctrine/dbal/blob/master/src/Driver/AbstractPostgreSQLDriver.php
|
|
18
|
+
*/
|
|
19
|
+
convertException(exception) {
|
|
20
|
+
if (exception.detail?.toString().trim()) {
|
|
21
|
+
exception.message += '\n - detail: ' + exception.detail;
|
|
22
|
+
}
|
|
23
|
+
if (exception.hint?.toString().trim()) {
|
|
24
|
+
exception.message += '\n - hint: ' + exception.hint;
|
|
25
|
+
}
|
|
26
|
+
/* v8 ignore next */
|
|
27
|
+
switch (exception.code) {
|
|
28
|
+
case '40001':
|
|
29
|
+
case '40P01':
|
|
30
|
+
return new DeadlockException(exception);
|
|
31
|
+
case '0A000':
|
|
32
|
+
// Foreign key constraint violations during a TRUNCATE operation
|
|
33
|
+
// are considered "feature not supported" in PostgreSQL.
|
|
34
|
+
if (exception.message.includes('truncate')) {
|
|
35
|
+
return new ForeignKeyConstraintViolationException(exception);
|
|
44
36
|
}
|
|
45
|
-
|
|
37
|
+
break;
|
|
38
|
+
case '23502':
|
|
39
|
+
return new NotNullConstraintViolationException(exception);
|
|
40
|
+
case '23503':
|
|
41
|
+
return new ForeignKeyConstraintViolationException(exception);
|
|
42
|
+
case '23505':
|
|
43
|
+
return new UniqueConstraintViolationException(exception);
|
|
44
|
+
case '23514':
|
|
45
|
+
return new CheckConstraintViolationException(exception);
|
|
46
|
+
case '42601':
|
|
47
|
+
return new SyntaxErrorException(exception);
|
|
48
|
+
case '42702':
|
|
49
|
+
return new NonUniqueFieldNameException(exception);
|
|
50
|
+
case '42703':
|
|
51
|
+
return new InvalidFieldNameException(exception);
|
|
52
|
+
case '42P01':
|
|
53
|
+
return new TableNotFoundException(exception);
|
|
54
|
+
case '42P07':
|
|
55
|
+
return new TableExistsException(exception);
|
|
46
56
|
}
|
|
57
|
+
return super.convertException(exception);
|
|
58
|
+
}
|
|
47
59
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { NativeQueryBuilder } from '../../query/NativeQueryBuilder.js';
|
|
2
2
|
/** @internal */
|
|
3
3
|
export class PostgreSqlNativeQueryBuilder extends NativeQueryBuilder {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
compileTruncate() {
|
|
5
|
+
super.compileTruncate();
|
|
6
|
+
this.parts.push('restart identity cascade');
|
|
7
|
+
}
|
|
8
8
|
}
|
|
@@ -5,86 +5,106 @@ import type { CheckDef, Column, ForeignKey, IndexDef, Table, TableDifference } f
|
|
|
5
5
|
import type { DatabaseSchema } from '../../schema/DatabaseSchema.js';
|
|
6
6
|
import type { DatabaseTable } from '../../schema/DatabaseTable.js';
|
|
7
7
|
export declare class PostgreSqlSchemaHelper extends SchemaHelper {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
8
|
+
static readonly DEFAULT_VALUES: {
|
|
9
|
+
'now()': string[];
|
|
10
|
+
'current_timestamp(?)': string[];
|
|
11
|
+
"('now'::text)::timestamp(?) with time zone": string[];
|
|
12
|
+
"('now'::text)::timestamp(?) without time zone": string[];
|
|
13
|
+
'null::character varying': string[];
|
|
14
|
+
'null::timestamp with time zone': string[];
|
|
15
|
+
'null::timestamp without time zone': string[];
|
|
16
|
+
};
|
|
17
|
+
getSchemaBeginning(charset: string, disableForeignKeys?: boolean): string;
|
|
18
|
+
getCreateDatabaseSQL(name: string): string;
|
|
19
|
+
getListTablesSQL(): string;
|
|
20
|
+
private getIgnoredViewsCondition;
|
|
21
|
+
getListViewsSQL(): string;
|
|
22
|
+
loadViews(schema: DatabaseSchema, connection: AbstractSqlConnection): Promise<void>;
|
|
23
|
+
getListMaterializedViewsSQL(): string;
|
|
24
|
+
loadMaterializedViews(schema: DatabaseSchema, connection: AbstractSqlConnection, schemaName?: string): Promise<void>;
|
|
25
|
+
createMaterializedView(name: string, schema: string | undefined, definition: string, withData?: boolean): string;
|
|
26
|
+
dropMaterializedViewIfExists(name: string, schema?: string): string;
|
|
27
|
+
refreshMaterializedView(name: string, schema?: string, concurrently?: boolean): string;
|
|
28
|
+
getNamespaces(connection: AbstractSqlConnection): Promise<string[]>;
|
|
29
|
+
private getIgnoredNamespacesConditionSQL;
|
|
30
|
+
loadInformationSchema(
|
|
31
|
+
schema: DatabaseSchema,
|
|
32
|
+
connection: AbstractSqlConnection,
|
|
33
|
+
tables: Table[],
|
|
34
|
+
schemas?: string[],
|
|
35
|
+
): Promise<void>;
|
|
36
|
+
getAllIndexes(connection: AbstractSqlConnection, tables: Table[]): Promise<Dictionary<IndexDef[]>>;
|
|
37
|
+
/**
|
|
38
|
+
* Parses column definitions from the full CREATE INDEX expression.
|
|
39
|
+
* Since pg_get_indexdef(oid, col_num, true) doesn't include sort modifiers,
|
|
40
|
+
* we extract them from the full expression instead.
|
|
41
|
+
*
|
|
42
|
+
* We use columnDefs (from individual pg_get_indexdef calls) as the source
|
|
43
|
+
* of column names, and find their modifiers in the expression.
|
|
44
|
+
*/
|
|
45
|
+
private parseIndexColumnsFromExpression;
|
|
46
|
+
/**
|
|
47
|
+
* Extracts the content inside parentheses starting at the given position.
|
|
48
|
+
* Handles nested parentheses correctly.
|
|
49
|
+
*/
|
|
50
|
+
private extractParenthesizedContent;
|
|
51
|
+
getAllColumns(
|
|
52
|
+
connection: AbstractSqlConnection,
|
|
53
|
+
tablesBySchemas: Map<string | undefined, Table[]>,
|
|
54
|
+
nativeEnums?: Dictionary<{
|
|
55
|
+
name: string;
|
|
56
|
+
schema?: string;
|
|
57
|
+
items: string[];
|
|
58
|
+
}>,
|
|
59
|
+
): Promise<Dictionary<Column[]>>;
|
|
60
|
+
getAllChecks(
|
|
61
|
+
connection: AbstractSqlConnection,
|
|
62
|
+
tablesBySchemas: Map<string | undefined, Table[]>,
|
|
63
|
+
): Promise<Dictionary<CheckDef[]>>;
|
|
64
|
+
getAllForeignKeys(
|
|
65
|
+
connection: AbstractSqlConnection,
|
|
66
|
+
tablesBySchemas: Map<string | undefined, Table[]>,
|
|
67
|
+
): Promise<Dictionary<Dictionary<ForeignKey>>>;
|
|
68
|
+
getNativeEnumDefinitions(
|
|
69
|
+
connection: AbstractSqlConnection,
|
|
70
|
+
schemas: string[],
|
|
71
|
+
): Promise<
|
|
72
|
+
Dictionary<{
|
|
73
|
+
name: string;
|
|
74
|
+
schema?: string;
|
|
75
|
+
items: string[];
|
|
76
|
+
}>
|
|
77
|
+
>;
|
|
78
|
+
getCreateNativeEnumSQL(name: string, values: unknown[], schema?: string): string;
|
|
79
|
+
getDropNativeEnumSQL(name: string, schema?: string): string;
|
|
80
|
+
getAlterNativeEnumSQL(name: string, schema?: string, value?: string, items?: string[], oldItems?: string[]): string;
|
|
81
|
+
private getEnumDefinitions;
|
|
82
|
+
createTableColumn(column: Column, table: DatabaseTable): string | undefined;
|
|
83
|
+
getPreAlterTable(tableDiff: TableDifference, safe: boolean): string[];
|
|
84
|
+
castColumn(name: string, type: string): string;
|
|
85
|
+
dropForeignKey(tableName: string, constraintName: string): string;
|
|
86
|
+
getPostAlterTable(tableDiff: TableDifference, safe: boolean): string[];
|
|
87
|
+
private getAlterColumnAutoincrement;
|
|
88
|
+
getChangeColumnCommentSQL(tableName: string, to: Column, schemaName?: string): string;
|
|
89
|
+
alterTableComment(table: DatabaseTable, comment?: string): string;
|
|
90
|
+
normalizeDefaultValue(defaultValue: string, length: number): string | number;
|
|
91
|
+
appendComments(table: DatabaseTable): string[];
|
|
92
|
+
getDatabaseExistsSQL(name: string): string;
|
|
93
|
+
getDatabaseNotExistsError(dbName: string): string;
|
|
94
|
+
getManagementDbName(): string;
|
|
95
|
+
disableForeignKeysSQL(): string;
|
|
96
|
+
enableForeignKeysSQL(): string;
|
|
97
|
+
getRenameIndexSQL(tableName: string, index: IndexDef, oldIndexName: string): string[];
|
|
98
|
+
dropIndex(table: string, index: IndexDef, oldIndexName?: string): string;
|
|
99
|
+
/**
|
|
100
|
+
* Build the column list for a PostgreSQL index.
|
|
101
|
+
*/
|
|
102
|
+
protected getIndexColumns(index: IndexDef): string;
|
|
103
|
+
/**
|
|
104
|
+
* PostgreSQL-specific index options like fill factor.
|
|
105
|
+
*/
|
|
106
|
+
protected getCreateIndexSuffix(index: IndexDef): string;
|
|
107
|
+
private getIndexesSQL;
|
|
108
|
+
private getChecksSQL;
|
|
109
|
+
inferLengthFromColumnType(type: string): number | undefined;
|
|
90
110
|
}
|