typeorm 0.2.42-dev.ece0da0 → 0.2.42-dev.f224f24

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.
Files changed (58) hide show
  1. package/browser/connection/BaseConnectionOptions.d.ts +5 -0
  2. package/browser/connection/BaseConnectionOptions.js.map +1 -1
  3. package/browser/connection/Connection.d.ts +4 -0
  4. package/browser/connection/Connection.js +1 -0
  5. package/browser/connection/Connection.js.map +1 -1
  6. package/browser/connection/options-reader/ConnectionOptionsEnvReader.js +1 -0
  7. package/browser/connection/options-reader/ConnectionOptionsEnvReader.js.map +1 -1
  8. package/browser/driver/postgres/PostgresQueryRunner.js +38 -14
  9. package/browser/driver/postgres/PostgresQueryRunner.js.map +1 -1
  10. package/browser/entity-schema/EntitySchemaRelationOptions.d.ts +6 -0
  11. package/browser/entity-schema/EntitySchemaRelationOptions.js.map +1 -1
  12. package/browser/entity-schema/EntitySchemaTransformer.js +1 -0
  13. package/browser/entity-schema/EntitySchemaTransformer.js.map +1 -1
  14. package/browser/find-options/operator/Not.d.ts +1 -1
  15. package/browser/find-options/operator/Not.js +1 -1
  16. package/browser/find-options/operator/Not.js.map +1 -1
  17. package/browser/query-builder/SelectQueryBuilder.d.ts +9 -0
  18. package/browser/query-builder/SelectQueryBuilder.js +27 -20
  19. package/browser/query-builder/SelectQueryBuilder.js.map +1 -1
  20. package/browser/query-runner/BaseQueryRunner.d.ts +2 -2
  21. package/browser/query-runner/BaseQueryRunner.js +3 -3
  22. package/browser/query-runner/BaseQueryRunner.js.map +1 -1
  23. package/browser/schema-builder/RdbmsSchemaBuilder.js +1 -1
  24. package/browser/schema-builder/RdbmsSchemaBuilder.js.map +1 -1
  25. package/commands/CommandUtils.d.ts +4 -0
  26. package/commands/CommandUtils.js +10 -0
  27. package/commands/CommandUtils.js.map +1 -1
  28. package/commands/MigrationCreateCommand.d.ts +2 -0
  29. package/commands/MigrationCreateCommand.js +7 -1
  30. package/commands/MigrationCreateCommand.js.map +1 -1
  31. package/commands/MigrationGenerateCommand.d.ts +2 -0
  32. package/commands/MigrationGenerateCommand.js +7 -1
  33. package/commands/MigrationGenerateCommand.js.map +1 -1
  34. package/connection/BaseConnectionOptions.d.ts +5 -0
  35. package/connection/BaseConnectionOptions.js.map +1 -1
  36. package/connection/Connection.d.ts +4 -0
  37. package/connection/Connection.js +1 -0
  38. package/connection/Connection.js.map +1 -1
  39. package/connection/options-reader/ConnectionOptionsEnvReader.js +1 -0
  40. package/connection/options-reader/ConnectionOptionsEnvReader.js.map +1 -1
  41. package/driver/postgres/PostgresQueryRunner.js +38 -14
  42. package/driver/postgres/PostgresQueryRunner.js.map +1 -1
  43. package/entity-schema/EntitySchemaRelationOptions.d.ts +6 -0
  44. package/entity-schema/EntitySchemaRelationOptions.js.map +1 -1
  45. package/entity-schema/EntitySchemaTransformer.js +1 -0
  46. package/entity-schema/EntitySchemaTransformer.js.map +1 -1
  47. package/find-options/operator/Not.d.ts +1 -1
  48. package/find-options/operator/Not.js +1 -1
  49. package/find-options/operator/Not.js.map +1 -1
  50. package/package.json +1 -1
  51. package/query-builder/SelectQueryBuilder.d.ts +9 -0
  52. package/query-builder/SelectQueryBuilder.js +27 -20
  53. package/query-builder/SelectQueryBuilder.js.map +1 -1
  54. package/query-runner/BaseQueryRunner.d.ts +2 -2
  55. package/query-runner/BaseQueryRunner.js +3 -3
  56. package/query-runner/BaseQueryRunner.js.map +1 -1
  57. package/schema-builder/RdbmsSchemaBuilder.js +1 -1
  58. package/schema-builder/RdbmsSchemaBuilder.js.map +1 -1
@@ -131,7 +131,7 @@ export declare abstract class BaseQueryRunner {
131
131
  protected getTablePath(target: EntityMetadata | Table | View | TableForeignKey | string): string;
132
132
  protected getTypeormMetadataTableName(): string;
133
133
  /**
134
- * Generates SQL query to insert a record into "typeorm_metadata" table.
134
+ * Generates SQL query to insert a record into typeorm metadata table.
135
135
  */
136
136
  protected insertTypeormMetadataSql({ database, schema, table, type, name, value }: {
137
137
  database?: string;
@@ -142,7 +142,7 @@ export declare abstract class BaseQueryRunner {
142
142
  value?: string;
143
143
  }): Query;
144
144
  /**
145
- * Generates SQL query to delete a record from "typeorm_metadata" table.
145
+ * Generates SQL query to delete a record from typeorm metadata table.
146
146
  */
147
147
  protected deleteTypeormMetadataSql({ database, schema, table, type, name }: {
148
148
  database?: string;
@@ -347,10 +347,10 @@ var BaseQueryRunner = /** @class */ (function () {
347
347
  };
348
348
  BaseQueryRunner.prototype.getTypeormMetadataTableName = function () {
349
349
  var options = this.connection.driver.options;
350
- return this.connection.driver.buildTableName("typeorm_metadata", options.schema, options.database);
350
+ return this.connection.driver.buildTableName(this.connection.metadataTableName, options.schema, options.database);
351
351
  };
352
352
  /**
353
- * Generates SQL query to insert a record into "typeorm_metadata" table.
353
+ * Generates SQL query to insert a record into typeorm metadata table.
354
354
  */
355
355
  BaseQueryRunner.prototype.insertTypeormMetadataSql = function (_a) {
356
356
  var database = _a.database, schema = _a.schema, table = _a.table, type = _a.type, name = _a.name, value = _a.value;
@@ -362,7 +362,7 @@ var BaseQueryRunner = /** @class */ (function () {
362
362
  return new Query(query, parameters);
363
363
  };
364
364
  /**
365
- * Generates SQL query to delete a record from "typeorm_metadata" table.
365
+ * Generates SQL query to delete a record from typeorm metadata table.
366
366
  */
367
367
  BaseQueryRunner.prototype.deleteTypeormMetadataSql = function (_a) {
368
368
  var database = _a.database, schema = _a.schema, table = _a.table, type = _a.type, name = _a.name;
@@ -1 +1 @@
1
- {"version":3,"sources":["../browser/src/query-runner/BaseQueryRunner.ts"],"names":[],"mappings":";AACA,OAAO,EAAC,KAAK,EAAC,MAAM,iBAAiB,CAAC;AACtC,OAAO,EAAC,WAAW,EAAC,MAAM,uBAAuB,CAAC;AASlD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAGrD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAG5C;IAAA;QAEI,4EAA4E;QAC5E,oBAAoB;QACpB,4EA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;;;;;;wBAC/E,IAAI,SAAS,YAAY,KAAK;4BAC1B,SAAS,GAAG,CAAC,SAAS,CAAC,CAAC;wBAC5B,IAAI,WAAW,YAAY,KAAK;4BAC5B,WAAW,GAAG,CAAC,WAAW,CAAC,CAAC;wBAEhC,CAAA,KAAA,IAAI,CAAC,WAAW,CAAC,SAAS,CAAA,CAAC,IAAI,oCAAI,SAAS,WAAE;wBAC9C,CAAA,KAAA,IAAI,CAAC,WAAW,CAAC,WAAW,CAAA,CAAC,IAAI,oCAAI,WAAW,WAAE;wBAElD,8EAA8E;wBAC9E,IAAI,IAAI,CAAC,aAAa,KAAK,IAAI;4BAC3B,sBAAO,OAAO,CAAC,OAAO,EAAkB,EAAC;;;;wBAEX,cAAA,SAAA,SAAS,CAAA;;;;wBAAhC,wBAAmB,EAAlB,KAAK,WAAA,EAAE,UAAU,gBAAA;wBACzB,qBAAM,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,UAAU,CAAC,EAAA;;wBAAnC,SAAmC,CAAC;;;;;;;;;;;;;;;;;;;;KAE3C;IAEL,sBAAC;AAAD,CAxeA,AAweC,IAAA","file":"BaseQueryRunner.js","sourcesContent":["import {PostgresConnectionOptions} from \"../driver/postgres/PostgresConnectionOptions\";\nimport {Query} from \"../driver/Query\";\nimport {SqlInMemory} from \"../driver/SqlInMemory\";\nimport {SqlServerConnectionOptions} from \"../driver/sqlserver/SqlServerConnectionOptions\";\nimport {View} from \"../schema-builder/view/View\";\nimport {Connection} from \"../connection/Connection\";\nimport {Table} from \"../schema-builder/table/Table\";\nimport {EntityManager} from \"../entity-manager/EntityManager\";\nimport {TableColumn} from \"../schema-builder/table/TableColumn\";\nimport {Broadcaster} from \"../subscriber/Broadcaster\";\nimport {ReplicationMode} from \"../driver/types/ReplicationMode\";\nimport { TypeORMError } from \"../error/TypeORMError\";\nimport { EntityMetadata } from \"../metadata/EntityMetadata\";\nimport { TableForeignKey } from \"../schema-builder/table/TableForeignKey\";\nimport { OrmUtils } from \"../util/OrmUtils\";\nimport {MetadataTableType} from \"../driver/types/MetadataTableType\";\n\nexport abstract class BaseQueryRunner {\n\n // -------------------------------------------------------------------------\n // Public Properties\n // -------------------------------------------------------------------------\n\n /**\n * Connection used by this query runner.\n */\n connection: Connection;\n\n /**\n * Entity manager working only with current query runner.\n */\n manager: EntityManager;\n\n /**\n * Indicates if connection for this query runner is released.\n * Once its released, query runner cannot run queries anymore.\n */\n isReleased = false;\n\n /**\n * Indicates if transaction is in progress.\n */\n isTransactionActive = false;\n\n /**\n * Stores temporarily user data.\n * Useful for sharing data with subscribers.\n */\n data = {};\n\n /**\n * All synchronized tables in the database.\n */\n loadedTables: Table[] = [];\n\n /**\n * All synchronized views in the database.\n */\n loadedViews: View[] = [];\n\n /**\n * Broadcaster used on this query runner to broadcast entity events.\n */\n broadcaster: Broadcaster;\n\n // -------------------------------------------------------------------------\n // Protected Properties\n // -------------------------------------------------------------------------\n\n /**\n * Real database connection from a connection pool used to perform queries.\n */\n protected databaseConnection: any;\n\n /**\n * Indicates if special query runner mode in which sql queries won't be executed is enabled.\n */\n protected sqlMemoryMode: boolean = false;\n\n /**\n * Sql-s stored if \"sql in memory\" mode is enabled.\n */\n protected sqlInMemory: SqlInMemory = new SqlInMemory();\n\n /**\n * Mode in which query runner executes.\n * Used for replication.\n * If replication is not setup its value is ignored.\n */\n protected mode: ReplicationMode;\n\n private cachedTablePaths: Record<string, string> = {};\n\n // -------------------------------------------------------------------------\n // Public Abstract Methods\n // -------------------------------------------------------------------------\n\n /**\n * Executes a given SQL query.\n */\n abstract query(query: string, parameters?: any[], useStructuredResult?: boolean): Promise<any>;\n\n // -------------------------------------------------------------------------\n // Protected Abstract Methods\n // -------------------------------------------------------------------------\n\n protected abstract loadTables(tablePaths?: string[]): Promise<Table[]>;\n\n protected abstract loadViews(tablePaths?: string[]): Promise<View[]>;\n\n // -------------------------------------------------------------------------\n // Public Methods\n // -------------------------------------------------------------------------\n\n /**\n * Loads given table's data from the database.\n */\n async getTable(tablePath: string): Promise<Table|undefined> {\n this.loadedTables = await this.loadTables([tablePath]);\n return this.loadedTables.length > 0 ? this.loadedTables[0] : undefined;\n }\n\n /**\n * Loads all tables (with given names) from the database.\n */\n async getTables(tableNames?: string[]): Promise<Table[]> {\n if (!tableNames) {\n // Don't cache in this case.\n // This is the new case & isn't used anywhere else anyway.\n return await this.loadTables(tableNames);\n }\n\n this.loadedTables = await this.loadTables(tableNames);\n return this.loadedTables;\n }\n\n /**\n * Loads given view's data from the database.\n */\n async getView(viewPath: string): Promise<View|undefined> {\n this.loadedViews = await this.loadViews([viewPath]);\n return this.loadedViews.length > 0 ? this.loadedViews[0] : undefined;\n }\n\n /**\n * Loads given view's data from the database.\n */\n async getViews(viewPaths?: string[]): Promise<View[]> {\n this.loadedViews = await this.loadViews(viewPaths);\n return this.loadedViews;\n }\n\n /**\n * Enables special query runner mode in which sql queries won't be executed,\n * instead they will be memorized into a special variable inside query runner.\n * You can get memorized sql using getMemorySql() method.\n */\n enableSqlMemory(): void {\n this.sqlInMemory = new SqlInMemory();\n this.sqlMemoryMode = true;\n }\n\n /**\n * Disables special query runner mode in which sql queries won't be executed\n * started by calling enableSqlMemory() method.\n *\n * Previously memorized sql will be flushed.\n */\n disableSqlMemory(): void {\n this.sqlInMemory = new SqlInMemory();\n this.sqlMemoryMode = false;\n }\n\n /**\n * Flushes all memorized sqls.\n */\n clearSqlMemory(): void {\n this.sqlInMemory = new SqlInMemory();\n }\n\n /**\n * Gets sql stored in the memory. Parameters in the sql are already replaced.\n */\n getMemorySql(): SqlInMemory {\n return this.sqlInMemory;\n }\n\n /**\n * Executes up sql queries.\n */\n async executeMemoryUpSql(): Promise<void> {\n for (const {query, parameters} of this.sqlInMemory.upQueries) {\n await this.query(query, parameters);\n }\n }\n\n /**\n * Executes down sql queries.\n */\n async executeMemoryDownSql(): Promise<void> {\n for (const {query, parameters} of this.sqlInMemory.downQueries.reverse()) {\n await this.query(query, parameters);\n }\n }\n\n getReplicationMode(): ReplicationMode {\n return this.mode;\n }\n\n // -------------------------------------------------------------------------\n // Protected Methods\n // -------------------------------------------------------------------------\n\n /**\n * Gets view from previously loaded views, otherwise loads it from database.\n */\n protected async getCachedView(viewName: string): Promise<View> {\n const view = this.loadedViews.find(view => view.name === viewName);\n if (view) return view;\n\n const foundViews = await this.loadViews([viewName]);\n if (foundViews.length > 0) {\n this.loadedViews.push(foundViews[0]);\n return foundViews[0];\n } else {\n throw new TypeORMError(`View \"${viewName}\" does not exist.`);\n }\n }\n\n /**\n * Gets table from previously loaded tables, otherwise loads it from database.\n */\n protected async getCachedTable(tableName: string): Promise<Table> {\n if (tableName in this.cachedTablePaths) {\n const tablePath = this.cachedTablePaths[tableName];\n const table = this.loadedTables.find(table => this.getTablePath(table) === tablePath);\n\n if (table) {\n return table;\n }\n }\n\n const foundTables = await this.loadTables([tableName]);\n\n if (foundTables.length > 0) {\n const foundTablePath = this.getTablePath(foundTables[0]);\n\n const cachedTable = this.loadedTables.find((table) => this.getTablePath(table) === foundTablePath);\n\n if (!cachedTable) {\n this.cachedTablePaths[tableName] = this.getTablePath(foundTables[0]);\n this.loadedTables.push(foundTables[0]);\n return foundTables[0];\n } else {\n return cachedTable;\n }\n } else {\n throw new TypeORMError(`Table \"${tableName}\" does not exist.`);\n }\n }\n\n /**\n * Replaces loaded table with given changed table.\n */\n protected replaceCachedTable(table: Table, changedTable: Table): void {\n const oldTablePath = this.getTablePath(table);\n const foundTable = this.loadedTables.find(loadedTable => this.getTablePath(loadedTable) === oldTablePath);\n\n // Clean up the lookup cache..\n for (const [key, cachedPath] of Object.entries(this.cachedTablePaths)) {\n if (cachedPath === oldTablePath) {\n this.cachedTablePaths[key] = this.getTablePath(changedTable);\n }\n }\n\n if (foundTable) {\n foundTable.database = changedTable.database;\n foundTable.schema = changedTable.schema;\n foundTable.name = changedTable.name;\n foundTable.columns = changedTable.columns;\n foundTable.indices = changedTable.indices;\n foundTable.foreignKeys = changedTable.foreignKeys;\n foundTable.uniques = changedTable.uniques;\n foundTable.checks = changedTable.checks;\n foundTable.justCreated = changedTable.justCreated;\n foundTable.engine = changedTable.engine;\n }\n }\n\n protected getTablePath(target: EntityMetadata | Table | View | TableForeignKey | string): string {\n const parsed = this.connection.driver.parseTableName(target);\n\n return this.connection.driver.buildTableName(\n parsed.tableName,\n parsed.schema,\n parsed.database\n );\n }\n\n protected getTypeormMetadataTableName(): string {\n const options = <SqlServerConnectionOptions|PostgresConnectionOptions>this.connection.driver.options;\n return this.connection.driver.buildTableName(\"typeorm_metadata\", options.schema, options.database);\n }\n\n /**\n * Generates SQL query to insert a record into \"typeorm_metadata\" table.\n */\n protected insertTypeormMetadataSql({\n database,\n schema,\n table,\n type,\n name,\n value\n }: {\n database?: string,\n schema?: string,\n table?: string,\n type: MetadataTableType\n name: string,\n value?: string\n }): Query {\n const [query, parameters] = this.connection.createQueryBuilder()\n .insert()\n .into(this.getTypeormMetadataTableName())\n .values({ database: database, schema: schema, table: table, type: type, name: name, value: value })\n .getQueryAndParameters();\n\n return new Query(query, parameters);\n }\n\n /**\n * Generates SQL query to delete a record from \"typeorm_metadata\" table.\n */\n protected deleteTypeormMetadataSql({\n database,\n schema,\n table,\n type,\n name\n }: {\n database?: string,\n schema?: string,\n table?: string,\n type: MetadataTableType,\n name: string\n }): Query {\n\n const qb = this.connection.createQueryBuilder();\n const deleteQb = qb.delete()\n .from(this.getTypeormMetadataTableName())\n .where(`${qb.escape(\"type\")} = :type`, { type })\n .andWhere(`${qb.escape(\"name\")} = :name`, { name });\n\n if (database) {\n deleteQb.andWhere(`${qb.escape(\"database\")} = :database`, { database });\n }\n\n if (schema) {\n deleteQb.andWhere(`${qb.escape(\"schema\")} = :schema`, { schema });\n }\n\n if (table) {\n deleteQb.andWhere(`${qb.escape(\"table\")} = :table`, { table });\n }\n\n const [query, parameters] = deleteQb.getQueryAndParameters();\n return new Query(query, parameters);\n }\n\n /**\n * Checks if at least one of column properties was changed.\n * Does not checks column type, length and autoincrement, because these properties changes separately.\n */\n protected isColumnChanged(oldColumn: TableColumn, newColumn: TableColumn, checkDefault?: boolean, checkComment?: boolean): boolean {\n // this logs need to debug issues in column change detection. Do not delete it!\n\n // console.log(\"charset ---------------\");\n // console.log(oldColumn.charset !== newColumn.charset);\n // console.log(oldColumn.charset, newColumn.charset);\n // console.log(\"collation ---------------\");\n // console.log(oldColumn.collation !== newColumn.collation);\n // console.log(oldColumn.collation, newColumn.collation);\n // console.log(\"precision ---------------\");\n // console.log(oldColumn.precision !== newColumn.precision);\n // console.log(oldColumn.precision, newColumn.precision);\n // console.log(\"scale ---------------\");\n // console.log(oldColumn.scale !== newColumn.scale);\n // console.log(oldColumn.scale, newColumn.scale);\n // console.log(\"default ---------------\");\n // console.log((checkDefault && oldColumn.default !== newColumn.default));\n // console.log(oldColumn.default, newColumn.default);\n // console.log(\"isNullable ---------------\");\n // console.log(oldColumn.isNullable !== newColumn.isNullable);\n // console.log(oldColumn.isNullable, newColumn.isNullable);\n // console.log(\"comment ---------------\");\n // console.log((checkComment && oldColumn.comment !== newColumn.comment));\n // console.log(oldColumn.comment, newColumn.comment);\n // console.log(\"enum ---------------\");\n // console.log(!OrmUtils.isArraysEqual(oldColumn.enum || [], newColumn.enum || []));\n // console.log(oldColumn.enum, newColumn.enum);\n\n return oldColumn.charset !== newColumn.charset\n || oldColumn.collation !== newColumn.collation\n || oldColumn.precision !== newColumn.precision\n || oldColumn.scale !== newColumn.scale\n || oldColumn.width !== newColumn.width // MySQL only\n || oldColumn.zerofill !== newColumn.zerofill // MySQL only\n || oldColumn.unsigned !== newColumn.unsigned // MySQL only\n || oldColumn.asExpression !== newColumn.asExpression // MySQL only\n || (checkDefault && oldColumn.default !== newColumn.default)\n || oldColumn.onUpdate !== newColumn.onUpdate // MySQL only\n || oldColumn.isNullable !== newColumn.isNullable\n || (checkComment && oldColumn.comment !== newColumn.comment)\n || !OrmUtils.isArraysEqual(oldColumn.enum || [], newColumn.enum || []);\n }\n\n /**\n * Checks if column length is by default.\n */\n protected isDefaultColumnLength(table: Table, column: TableColumn, length: string): boolean {\n // if table have metadata, we check if length is specified in column metadata\n if (this.connection.hasMetadata(table.name)) {\n const metadata = this.connection.getMetadata(table.name);\n const columnMetadata = metadata.findColumnWithDatabaseName(column.name);\n\n if (columnMetadata) {\n const columnMetadataLength = this.connection.driver.getColumnLength(columnMetadata);\n if (columnMetadataLength)\n return false;\n }\n }\n\n if (this.connection.driver.dataTypeDefaults\n && this.connection.driver.dataTypeDefaults[column.type]\n && this.connection.driver.dataTypeDefaults[column.type].length) {\n return this.connection.driver.dataTypeDefaults[column.type].length!.toString() === length.toString();\n }\n\n return false;\n }\n\n /**\n * Checks if column precision is by default.\n */\n protected isDefaultColumnPrecision(table: Table, column: TableColumn, precision: number): boolean {\n // if table have metadata, we check if length is specified in column metadata\n if (this.connection.hasMetadata(table.name)) {\n const metadata = this.connection.getMetadata(table.name);\n const columnMetadata = metadata.findColumnWithDatabaseName(column.name);\n if (columnMetadata && columnMetadata.precision !== null && columnMetadata.precision !== undefined)\n return false;\n }\n\n if (this.connection.driver.dataTypeDefaults\n && this.connection.driver.dataTypeDefaults[column.type]\n && this.connection.driver.dataTypeDefaults[column.type].precision !== null\n && this.connection.driver.dataTypeDefaults[column.type].precision !== undefined)\n return this.connection.driver.dataTypeDefaults[column.type].precision === precision;\n\n return false;\n }\n\n /**\n * Checks if column scale is by default.\n */\n protected isDefaultColumnScale(table: Table, column: TableColumn, scale: number): boolean {\n // if table have metadata, we check if length is specified in column metadata\n if (this.connection.hasMetadata(table.name)) {\n const metadata = this.connection.getMetadata(table.name);\n const columnMetadata = metadata.findColumnWithDatabaseName(column.name);\n if (columnMetadata && columnMetadata.scale !== null && columnMetadata.scale !== undefined)\n return false;\n }\n\n if (this.connection.driver.dataTypeDefaults\n && this.connection.driver.dataTypeDefaults[column.type]\n && this.connection.driver.dataTypeDefaults[column.type].scale !== null\n && this.connection.driver.dataTypeDefaults[column.type].scale !== undefined)\n return this.connection.driver.dataTypeDefaults[column.type].scale === scale;\n\n return false;\n }\n\n /**\n * Executes sql used special for schema build.\n */\n protected async executeQueries(upQueries: Query|Query[], downQueries: Query|Query[]): Promise<void> {\n if (upQueries instanceof Query)\n upQueries = [upQueries];\n if (downQueries instanceof Query)\n downQueries = [downQueries];\n\n this.sqlInMemory.upQueries.push(...upQueries);\n this.sqlInMemory.downQueries.push(...downQueries);\n\n // if sql-in-memory mode is enabled then simply store sql in memory and return\n if (this.sqlMemoryMode === true)\n return Promise.resolve() as Promise<any>;\n\n for (const {query, parameters} of upQueries) {\n await this.query(query, parameters);\n }\n }\n\n}\n"],"sourceRoot":".."}
1
+ {"version":3,"sources":["../browser/src/query-runner/BaseQueryRunner.ts"],"names":[],"mappings":";AACA,OAAO,EAAC,KAAK,EAAC,MAAM,iBAAiB,CAAC;AACtC,OAAO,EAAC,WAAW,EAAC,MAAM,uBAAuB,CAAC;AASlD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAGrD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAG5C;IAAA;QAEI,4EAA4E;QAC5E,oBAAoB;QACpB,4EAA4E;QAY5E;;;WAGG;QACH,eAAU,GAAG,KAAK,CAAC;QAEnB;;WAEG;QACH,wBAAmB,GAAG,KAAK,CAAC;QAE5B;;;WAGG;QACH,SAAI,GAAG,EAAE,CAAC;QAEV;;WAEG;QACH,iBAAY,GAAY,EAAE,CAAC;QAE3B;;WAEG;QACH,gBAAW,GAAW,EAAE,CAAC;QAgBzB;;WAEG;QACO,kBAAa,GAAY,KAAK,CAAC;QAEzC;;WAEG;QACO,gBAAW,GAAgB,IAAI,WAAW,EAAE,CAAC;QAS/C,qBAAgB,GAA2B,EAAE,CAAC;IA8Z1D,CAAC;IA3YG,4EAA4E;IAC5E,iBAAiB;IACjB,4EAA4E;IAE5E;;OAEG;IACG,kCAAQ,GAAd,UAAe,SAAiB;;;;;;wBAC5B,KAAA,IAAI,CAAA;wBAAgB,qBAAM,IAAI,CA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KAAK,WAAA,EAAE,UAAU,gBAAA;wBACzB,qBAAM,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,UAAU,CAAC,EAAA;;wBAAnC,SAAmC,CAAC;;;;;;;;;;;;;;;;;;;;KAE3C;IAEL,sBAAC;AAAD,CAxeA,AAweC,IAAA","file":"BaseQueryRunner.js","sourcesContent":["import {PostgresConnectionOptions} from \"../driver/postgres/PostgresConnectionOptions\";\nimport {Query} from \"../driver/Query\";\nimport {SqlInMemory} from \"../driver/SqlInMemory\";\nimport {SqlServerConnectionOptions} from \"../driver/sqlserver/SqlServerConnectionOptions\";\nimport {View} from \"../schema-builder/view/View\";\nimport {Connection} from \"../connection/Connection\";\nimport {Table} from \"../schema-builder/table/Table\";\nimport {EntityManager} from \"../entity-manager/EntityManager\";\nimport {TableColumn} from \"../schema-builder/table/TableColumn\";\nimport {Broadcaster} from \"../subscriber/Broadcaster\";\nimport {ReplicationMode} from \"../driver/types/ReplicationMode\";\nimport { TypeORMError } from \"../error/TypeORMError\";\nimport { EntityMetadata } from \"../metadata/EntityMetadata\";\nimport { TableForeignKey } from \"../schema-builder/table/TableForeignKey\";\nimport { OrmUtils } from \"../util/OrmUtils\";\nimport {MetadataTableType} from \"../driver/types/MetadataTableType\";\n\nexport abstract class BaseQueryRunner {\n\n // -------------------------------------------------------------------------\n // Public Properties\n // -------------------------------------------------------------------------\n\n /**\n * Connection used by this query runner.\n */\n connection: Connection;\n\n /**\n * Entity manager working only with current query runner.\n */\n manager: EntityManager;\n\n /**\n * Indicates if connection for this query runner is released.\n * Once its released, query runner cannot run queries anymore.\n */\n isReleased = false;\n\n /**\n * Indicates if transaction is in progress.\n */\n isTransactionActive = false;\n\n /**\n * Stores temporarily user data.\n * Useful for sharing data with subscribers.\n */\n data = {};\n\n /**\n * All synchronized tables in the database.\n */\n loadedTables: Table[] = [];\n\n /**\n * All synchronized views in the database.\n */\n loadedViews: View[] = [];\n\n /**\n * Broadcaster used on this query runner to broadcast entity events.\n */\n broadcaster: Broadcaster;\n\n // -------------------------------------------------------------------------\n // Protected Properties\n // -------------------------------------------------------------------------\n\n /**\n * Real database connection from a connection pool used to perform queries.\n */\n protected databaseConnection: any;\n\n /**\n * Indicates if special query runner mode in which sql queries won't be executed is enabled.\n */\n protected sqlMemoryMode: boolean = false;\n\n /**\n * Sql-s stored if \"sql in memory\" mode is enabled.\n */\n protected sqlInMemory: SqlInMemory = new SqlInMemory();\n\n /**\n * Mode in which query runner executes.\n * Used for replication.\n * If replication is not setup its value is ignored.\n */\n protected mode: ReplicationMode;\n\n private cachedTablePaths: Record<string, string> = {};\n\n // -------------------------------------------------------------------------\n // Public Abstract Methods\n // -------------------------------------------------------------------------\n\n /**\n * Executes a given SQL query.\n */\n abstract query(query: string, parameters?: any[], useStructuredResult?: boolean): Promise<any>;\n\n // -------------------------------------------------------------------------\n // Protected Abstract Methods\n // -------------------------------------------------------------------------\n\n protected abstract loadTables(tablePaths?: string[]): Promise<Table[]>;\n\n protected abstract loadViews(tablePaths?: string[]): Promise<View[]>;\n\n // -------------------------------------------------------------------------\n // Public Methods\n // -------------------------------------------------------------------------\n\n /**\n * Loads given table's data from the database.\n */\n async getTable(tablePath: string): Promise<Table|undefined> {\n this.loadedTables = await this.loadTables([tablePath]);\n return this.loadedTables.length > 0 ? this.loadedTables[0] : undefined;\n }\n\n /**\n * Loads all tables (with given names) from the database.\n */\n async getTables(tableNames?: string[]): Promise<Table[]> {\n if (!tableNames) {\n // Don't cache in this case.\n // This is the new case & isn't used anywhere else anyway.\n return await this.loadTables(tableNames);\n }\n\n this.loadedTables = await this.loadTables(tableNames);\n return this.loadedTables;\n }\n\n /**\n * Loads given view's data from the database.\n */\n async getView(viewPath: string): Promise<View|undefined> {\n this.loadedViews = await this.loadViews([viewPath]);\n return this.loadedViews.length > 0 ? this.loadedViews[0] : undefined;\n }\n\n /**\n * Loads given view's data from the database.\n */\n async getViews(viewPaths?: string[]): Promise<View[]> {\n this.loadedViews = await this.loadViews(viewPaths);\n return this.loadedViews;\n }\n\n /**\n * Enables special query runner mode in which sql queries won't be executed,\n * instead they will be memorized into a special variable inside query runner.\n * You can get memorized sql using getMemorySql() method.\n */\n enableSqlMemory(): void {\n this.sqlInMemory = new SqlInMemory();\n this.sqlMemoryMode = true;\n }\n\n /**\n * Disables special query runner mode in which sql queries won't be executed\n * started by calling enableSqlMemory() method.\n *\n * Previously memorized sql will be flushed.\n */\n disableSqlMemory(): void {\n this.sqlInMemory = new SqlInMemory();\n this.sqlMemoryMode = false;\n }\n\n /**\n * Flushes all memorized sqls.\n */\n clearSqlMemory(): void {\n this.sqlInMemory = new SqlInMemory();\n }\n\n /**\n * Gets sql stored in the memory. Parameters in the sql are already replaced.\n */\n getMemorySql(): SqlInMemory {\n return this.sqlInMemory;\n }\n\n /**\n * Executes up sql queries.\n */\n async executeMemoryUpSql(): Promise<void> {\n for (const {query, parameters} of this.sqlInMemory.upQueries) {\n await this.query(query, parameters);\n }\n }\n\n /**\n * Executes down sql queries.\n */\n async executeMemoryDownSql(): Promise<void> {\n for (const {query, parameters} of this.sqlInMemory.downQueries.reverse()) {\n await this.query(query, parameters);\n }\n }\n\n getReplicationMode(): ReplicationMode {\n return this.mode;\n }\n\n // -------------------------------------------------------------------------\n // Protected Methods\n // -------------------------------------------------------------------------\n\n /**\n * Gets view from previously loaded views, otherwise loads it from database.\n */\n protected async getCachedView(viewName: string): Promise<View> {\n const view = this.loadedViews.find(view => view.name === viewName);\n if (view) return view;\n\n const foundViews = await this.loadViews([viewName]);\n if (foundViews.length > 0) {\n this.loadedViews.push(foundViews[0]);\n return foundViews[0];\n } else {\n throw new TypeORMError(`View \"${viewName}\" does not exist.`);\n }\n }\n\n /**\n * Gets table from previously loaded tables, otherwise loads it from database.\n */\n protected async getCachedTable(tableName: string): Promise<Table> {\n if (tableName in this.cachedTablePaths) {\n const tablePath = this.cachedTablePaths[tableName];\n const table = this.loadedTables.find(table => this.getTablePath(table) === tablePath);\n\n if (table) {\n return table;\n }\n }\n\n const foundTables = await this.loadTables([tableName]);\n\n if (foundTables.length > 0) {\n const foundTablePath = this.getTablePath(foundTables[0]);\n\n const cachedTable = this.loadedTables.find((table) => this.getTablePath(table) === foundTablePath);\n\n if (!cachedTable) {\n this.cachedTablePaths[tableName] = this.getTablePath(foundTables[0]);\n this.loadedTables.push(foundTables[0]);\n return foundTables[0];\n } else {\n return cachedTable;\n }\n } else {\n throw new TypeORMError(`Table \"${tableName}\" does not exist.`);\n }\n }\n\n /**\n * Replaces loaded table with given changed table.\n */\n protected replaceCachedTable(table: Table, changedTable: Table): void {\n const oldTablePath = this.getTablePath(table);\n const foundTable = this.loadedTables.find(loadedTable => this.getTablePath(loadedTable) === oldTablePath);\n\n // Clean up the lookup cache..\n for (const [key, cachedPath] of Object.entries(this.cachedTablePaths)) {\n if (cachedPath === oldTablePath) {\n this.cachedTablePaths[key] = this.getTablePath(changedTable);\n }\n }\n\n if (foundTable) {\n foundTable.database = changedTable.database;\n foundTable.schema = changedTable.schema;\n foundTable.name = changedTable.name;\n foundTable.columns = changedTable.columns;\n foundTable.indices = changedTable.indices;\n foundTable.foreignKeys = changedTable.foreignKeys;\n foundTable.uniques = changedTable.uniques;\n foundTable.checks = changedTable.checks;\n foundTable.justCreated = changedTable.justCreated;\n foundTable.engine = changedTable.engine;\n }\n }\n\n protected getTablePath(target: EntityMetadata | Table | View | TableForeignKey | string): string {\n const parsed = this.connection.driver.parseTableName(target);\n\n return this.connection.driver.buildTableName(\n parsed.tableName,\n parsed.schema,\n parsed.database\n );\n }\n\n protected getTypeormMetadataTableName(): string {\n const options = <SqlServerConnectionOptions|PostgresConnectionOptions>this.connection.driver.options;\n return this.connection.driver.buildTableName(this.connection.metadataTableName, options.schema, options.database);\n }\n\n /**\n * Generates SQL query to insert a record into typeorm metadata table.\n */\n protected insertTypeormMetadataSql({\n database,\n schema,\n table,\n type,\n name,\n value\n }: {\n database?: string,\n schema?: string,\n table?: string,\n type: MetadataTableType\n name: string,\n value?: string\n }): Query {\n const [query, parameters] = this.connection.createQueryBuilder()\n .insert()\n .into(this.getTypeormMetadataTableName())\n .values({ database: database, schema: schema, table: table, type: type, name: name, value: value })\n .getQueryAndParameters();\n\n return new Query(query, parameters);\n }\n\n /**\n * Generates SQL query to delete a record from typeorm metadata table.\n */\n protected deleteTypeormMetadataSql({\n database,\n schema,\n table,\n type,\n name\n }: {\n database?: string,\n schema?: string,\n table?: string,\n type: MetadataTableType,\n name: string\n }): Query {\n\n const qb = this.connection.createQueryBuilder();\n const deleteQb = qb.delete()\n .from(this.getTypeormMetadataTableName())\n .where(`${qb.escape(\"type\")} = :type`, { type })\n .andWhere(`${qb.escape(\"name\")} = :name`, { name });\n\n if (database) {\n deleteQb.andWhere(`${qb.escape(\"database\")} = :database`, { database });\n }\n\n if (schema) {\n deleteQb.andWhere(`${qb.escape(\"schema\")} = :schema`, { schema });\n }\n\n if (table) {\n deleteQb.andWhere(`${qb.escape(\"table\")} = :table`, { table });\n }\n\n const [query, parameters] = deleteQb.getQueryAndParameters();\n return new Query(query, parameters);\n }\n\n /**\n * Checks if at least one of column properties was changed.\n * Does not checks column type, length and autoincrement, because these properties changes separately.\n */\n protected isColumnChanged(oldColumn: TableColumn, newColumn: TableColumn, checkDefault?: boolean, checkComment?: boolean): boolean {\n // this logs need to debug issues in column change detection. Do not delete it!\n\n // console.log(\"charset ---------------\");\n // console.log(oldColumn.charset !== newColumn.charset);\n // console.log(oldColumn.charset, newColumn.charset);\n // console.log(\"collation ---------------\");\n // console.log(oldColumn.collation !== newColumn.collation);\n // console.log(oldColumn.collation, newColumn.collation);\n // console.log(\"precision ---------------\");\n // console.log(oldColumn.precision !== newColumn.precision);\n // console.log(oldColumn.precision, newColumn.precision);\n // console.log(\"scale ---------------\");\n // console.log(oldColumn.scale !== newColumn.scale);\n // console.log(oldColumn.scale, newColumn.scale);\n // console.log(\"default ---------------\");\n // console.log((checkDefault && oldColumn.default !== newColumn.default));\n // console.log(oldColumn.default, newColumn.default);\n // console.log(\"isNullable ---------------\");\n // console.log(oldColumn.isNullable !== newColumn.isNullable);\n // console.log(oldColumn.isNullable, newColumn.isNullable);\n // console.log(\"comment ---------------\");\n // console.log((checkComment && oldColumn.comment !== newColumn.comment));\n // console.log(oldColumn.comment, newColumn.comment);\n // console.log(\"enum ---------------\");\n // console.log(!OrmUtils.isArraysEqual(oldColumn.enum || [], newColumn.enum || []));\n // console.log(oldColumn.enum, newColumn.enum);\n\n return oldColumn.charset !== newColumn.charset\n || oldColumn.collation !== newColumn.collation\n || oldColumn.precision !== newColumn.precision\n || oldColumn.scale !== newColumn.scale\n || oldColumn.width !== newColumn.width // MySQL only\n || oldColumn.zerofill !== newColumn.zerofill // MySQL only\n || oldColumn.unsigned !== newColumn.unsigned // MySQL only\n || oldColumn.asExpression !== newColumn.asExpression // MySQL only\n || (checkDefault && oldColumn.default !== newColumn.default)\n || oldColumn.onUpdate !== newColumn.onUpdate // MySQL only\n || oldColumn.isNullable !== newColumn.isNullable\n || (checkComment && oldColumn.comment !== newColumn.comment)\n || !OrmUtils.isArraysEqual(oldColumn.enum || [], newColumn.enum || []);\n }\n\n /**\n * Checks if column length is by default.\n */\n protected isDefaultColumnLength(table: Table, column: TableColumn, length: string): boolean {\n // if table have metadata, we check if length is specified in column metadata\n if (this.connection.hasMetadata(table.name)) {\n const metadata = this.connection.getMetadata(table.name);\n const columnMetadata = metadata.findColumnWithDatabaseName(column.name);\n\n if (columnMetadata) {\n const columnMetadataLength = this.connection.driver.getColumnLength(columnMetadata);\n if (columnMetadataLength)\n return false;\n }\n }\n\n if (this.connection.driver.dataTypeDefaults\n && this.connection.driver.dataTypeDefaults[column.type]\n && this.connection.driver.dataTypeDefaults[column.type].length) {\n return this.connection.driver.dataTypeDefaults[column.type].length!.toString() === length.toString();\n }\n\n return false;\n }\n\n /**\n * Checks if column precision is by default.\n */\n protected isDefaultColumnPrecision(table: Table, column: TableColumn, precision: number): boolean {\n // if table have metadata, we check if length is specified in column metadata\n if (this.connection.hasMetadata(table.name)) {\n const metadata = this.connection.getMetadata(table.name);\n const columnMetadata = metadata.findColumnWithDatabaseName(column.name);\n if (columnMetadata && columnMetadata.precision !== null && columnMetadata.precision !== undefined)\n return false;\n }\n\n if (this.connection.driver.dataTypeDefaults\n && this.connection.driver.dataTypeDefaults[column.type]\n && this.connection.driver.dataTypeDefaults[column.type].precision !== null\n && this.connection.driver.dataTypeDefaults[column.type].precision !== undefined)\n return this.connection.driver.dataTypeDefaults[column.type].precision === precision;\n\n return false;\n }\n\n /**\n * Checks if column scale is by default.\n */\n protected isDefaultColumnScale(table: Table, column: TableColumn, scale: number): boolean {\n // if table have metadata, we check if length is specified in column metadata\n if (this.connection.hasMetadata(table.name)) {\n const metadata = this.connection.getMetadata(table.name);\n const columnMetadata = metadata.findColumnWithDatabaseName(column.name);\n if (columnMetadata && columnMetadata.scale !== null && columnMetadata.scale !== undefined)\n return false;\n }\n\n if (this.connection.driver.dataTypeDefaults\n && this.connection.driver.dataTypeDefaults[column.type]\n && this.connection.driver.dataTypeDefaults[column.type].scale !== null\n && this.connection.driver.dataTypeDefaults[column.type].scale !== undefined)\n return this.connection.driver.dataTypeDefaults[column.type].scale === scale;\n\n return false;\n }\n\n /**\n * Executes sql used special for schema build.\n */\n protected async executeQueries(upQueries: Query|Query[], downQueries: Query|Query[]): Promise<void> {\n if (upQueries instanceof Query)\n upQueries = [upQueries];\n if (downQueries instanceof Query)\n downQueries = [downQueries];\n\n this.sqlInMemory.upQueries.push(...upQueries);\n this.sqlInMemory.downQueries.push(...downQueries);\n\n // if sql-in-memory mode is enabled then simply store sql in memory and return\n if (this.sqlMemoryMode === true)\n return Promise.resolve() as Promise<any>;\n\n for (const {query, parameters} of upQueries) {\n await this.query(query, parameters);\n }\n }\n\n}\n"],"sourceRoot":".."}
@@ -1801,7 +1801,7 @@ var RdbmsSchemaBuilder = /** @class */ (function () {
1801
1801
  case 0:
1802
1802
  schema = this.currentSchema;
1803
1803
  database = this.currentDatabase;
1804
- typeormMetadataTable = this.connection.driver.buildTableName("typeorm_metadata", schema, database);
1804
+ typeormMetadataTable = this.connection.driver.buildTableName(this.connection.metadataTableName, schema, database);
1805
1805
  return [4 /*yield*/, queryRunner.createTable(new Table({
1806
1806
  database: database,
1807
1807
  schema: schema,
@@ -1 +1 @@
1
- {"version":3,"sources":["../browser/src/schema-builder/RdbmsSchemaBuilder.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,eAAe,EAAC,MAAM,uCAAuC,CAAC;AACtE,OAAO,EAAC,KAAK,EAAC,MAAM,eAAe,CAAC;AACpC,OAAO,EAAC,WAAW,EAAC,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAC,eAAe,EAAC,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAC,UAAU,EAAC,MAAM,oBAAoB,CAAC;AAO9C,OAAO,EAAC,UAAU,EAAC,MAAM,mBAAmB,CAAC;AAE7C,OAAO,EAAC,cAAc,EAAC,MAAM,mCAAmC,CAAC;AACjE,OAAO,EAAC,WAAW,EAAC,MAAM,6BAA6B,CAAC;AACxD,OAAO,EAAC,WAAW,EAAC,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAC,UAAU,EAAC,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAC,cAAc,EAAC,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAC,IAAI,EAAC,MAAM,aAAa,CAAC;AACjC,OAAO,EAAC,SAAS,EAAC,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAC,mBAAmB,EAAC,MAAM,+CAA+C,CAAC;AAElF;;;;;;;;;;;;;GAaG;AACH;IAUI,4EAA4E;IAC5E,cAAc;IACd,4EAA4E;IAE5E,4BAAsB,UAAsB;QAAtB,eAAU,GAAV,UAAU,CAAY;IAC5C,CAAC;IAED,4EAA4E;IAC5E,iBAAiB;IACjB,4EAA4E;IAE5E;;OAEG;IACG,kCAAK,GAAX;;;;;;;wBACI,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,UAAU,CAAC,iBAAiB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ACI,IAAI,EAAE,MAAM;wCACZ,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,aAAa,CAAC,EAAC,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,eAAe,CAAC,YAAY,EAAC,CAAC;wCACvG,UAAU,EAAE,IAAI;qCACnB;oCACD;wCACI,IAAI,EAAE,OAAO;wCACb,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,aAAa,CAAC,EAAC,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,eAAe,CAAC,aAAa,EAAC,CAAC;wCACxG,UAAU,EAAE,IAAI;qCACnB;iCACJ;6BACJ,CACJ,EAAE,IAAI,CAAC,EAAA;;wBAtCR,SAsCQ,CAAC;;;;;KACZ;IACL,yBAAC;AAAD,CAz0BA,AAy0BC,IAAA","file":"RdbmsSchemaBuilder.js","sourcesContent":["import {CockroachDriver} from \"../driver/cockroachdb/CockroachDriver\";\nimport {Table} from \"./table/Table\";\nimport {TableColumn} from \"./table/TableColumn\";\nimport {TableForeignKey} from \"./table/TableForeignKey\";\nimport {TableIndex} from \"./table/TableIndex\";\nimport {QueryRunner} from \"../query-runner/QueryRunner\";\nimport {ColumnMetadata} from \"../metadata/ColumnMetadata\";\nimport {EntityMetadata} from \"../metadata/EntityMetadata\";\nimport {Connection} from \"../connection/Connection\";\nimport {SchemaBuilder} from \"./SchemaBuilder\";\nimport {SqlInMemory} from \"../driver/SqlInMemory\";\nimport {TableUtils} from \"./util/TableUtils\";\nimport {TableColumnOptions} from \"./options/TableColumnOptions\";\nimport {PostgresDriver} from \"../driver/postgres/PostgresDriver\";\nimport {MysqlDriver} from \"../driver/mysql/MysqlDriver\";\nimport {TableUnique} from \"./table/TableUnique\";\nimport {TableCheck} from \"./table/TableCheck\";\nimport {TableExclusion} from \"./table/TableExclusion\";\nimport {View} from \"./view/View\";\nimport {ViewUtils} from \"./util/ViewUtils\";\nimport {AuroraDataApiDriver} from \"../driver/aurora-data-api/AuroraDataApiDriver\";\n\n/**\n * Creates complete tables schemas in the database based on the entity metadatas.\n *\n * Steps how schema is being built:\n * 1. load list of all tables with complete column and keys information from the db\n * 2. drop all (old) foreign keys that exist in the table, but does not exist in the metadata\n * 3. create new tables that does not exist in the db, but exist in the metadata\n * 4. drop all columns exist (left old) in the db table, but does not exist in the metadata\n * 5. add columns from metadata which does not exist in the table\n * 6. update all exist columns which metadata has changed\n * 7. update primary keys - update old and create new primary key from changed columns\n * 8. create foreign keys which does not exist in the table yet\n * 9. create indices which are missing in db yet, and drops indices which exist in the db, but does not exist in the metadata anymore\n */\nexport class RdbmsSchemaBuilder implements SchemaBuilder {\n /**\n * Used to execute schema creation queries in a single connection.\n */\n protected queryRunner: QueryRunner;\n\n private currentDatabase?: string;\n\n private currentSchema?: string;\n\n // -------------------------------------------------------------------------\n // Constructor\n // -------------------------------------------------------------------------\n\n constructor(protected connection: Connection) {\n }\n\n // -------------------------------------------------------------------------\n // Public Methods\n // -------------------------------------------------------------------------\n\n /**\n * Creates complete schemas for the given entity metadatas.\n */\n async build(): Promise<void> {\n this.queryRunner = this.connection.createQueryRunner();\n\n // this.connection.driver.database || this.currentDatabase;\n this.currentDatabase = this.connection.driver.database;\n this.currentSchema = this.connection.driver.schema;\n\n // CockroachDB implements asynchronous schema sync operations which can not been executed in transaction.\n // E.g. if you try to DROP column and ADD it again in the same transaction, crdb throws error.\n const isUsingTransactions = (\n !(this.connection.driver instanceof CockroachDriver) &&\n this.connection.options.migrationsTransactionMode !== \"none\"\n );\n\n if (isUsingTransactions) {\n await this.queryRunner.startTransaction();\n }\n\n try {\n await this.createMetadataTableIfNecessary(this.queryRunner);\n // Flush the queryrunner table & view cache\n const tablePaths = this.entityToSyncMetadatas.map(metadata => this.getTablePath(metadata));\n\n await this.queryRunner.getTables(tablePaths);\n await this.queryRunner.getViews([]);\n\n await this.executeSchemaSyncOperationsInProperOrder();\n\n // if cache is enabled then perform cache-synchronization as well\n if (this.connection.queryResultCache)\n await this.connection.queryResultCache.synchronize(this.queryRunner);\n\n if (isUsingTransactions) {\n await this.queryRunner.commitTransaction();\n }\n\n } catch (error) {\n\n try { // we throw original error even if rollback thrown an error\n if (isUsingTransactions) {\n await this.queryRunner.rollbackTransaction();\n }\n } catch (rollbackError) { }\n throw error;\n\n } finally {\n await this.queryRunner.release();\n }\n }\n\n /**\n * If the schema contains views, create the typeorm_metadata table if it doesn't exist yet\n */\n async createMetadataTableIfNecessary(queryRunner: QueryRunner): Promise<void> {\n if (this.viewEntityToSyncMetadatas.length > 0 || (this.connection.driver instanceof PostgresDriver && this.connection.driver.isGeneratedColumnsSupported)) {\n await this.createTypeormMetadataTable(queryRunner);\n }\n }\n\n /**\n * Returns sql queries to be executed by schema builder.\n */\n async log(): Promise<SqlInMemory> {\n this.queryRunner = this.connection.createQueryRunner();\n try {\n // Flush the queryrunner table & view cache\n const tablePaths = this.entityToSyncMetadatas.map(metadata => this.getTablePath(metadata));\n await this.queryRunner.getTables(tablePaths);\n await this.queryRunner.getViews([]);\n\n this.queryRunner.enableSqlMemory();\n await this.executeSchemaSyncOperationsInProperOrder();\n\n // if cache is enabled then perform cache-synchronization as well\n if (this.connection.queryResultCache) // todo: check this functionality\n await this.connection.queryResultCache.synchronize(this.queryRunner);\n\n return this.queryRunner.getMemorySql();\n\n } finally {\n // its important to disable this mode despite the fact we are release query builder\n // because there exist drivers which reuse same query runner. Also its important to disable\n // sql memory after call of getMemorySql() method because last one flushes sql memory.\n this.queryRunner.disableSqlMemory();\n await this.queryRunner.release();\n }\n }\n\n // -------------------------------------------------------------------------\n // Protected Methods\n // -------------------------------------------------------------------------\n\n /**\n * Returns only entities that should be synced in the database.\n */\n protected get entityToSyncMetadatas(): EntityMetadata[] {\n return this.connection.entityMetadatas.filter(metadata => metadata.synchronize && metadata.tableType !== \"entity-child\" && metadata.tableType !== \"view\");\n }\n\n /**\n * Returns only entities that should be synced in the database.\n */\n protected get viewEntityToSyncMetadatas(): EntityMetadata[] {\n return this.connection.entityMetadatas\n .filter(metadata => metadata.tableType === \"view\" && metadata.synchronize)\n // sort views in creation order by dependencies\n .sort(ViewUtils.viewMetadataCmp);\n }\n\n /**\n * Executes schema sync operations in a proper order.\n * Order of operations matter here.\n */\n protected async executeSchemaSyncOperationsInProperOrder(): Promise<void> {\n await this.dropOldViews();\n await this.dropOldForeignKeys();\n await this.dropOldIndices();\n await this.dropOldChecks();\n await this.dropOldExclusions();\n await this.dropCompositeUniqueConstraints();\n // await this.renameTables();\n await this.renameColumns();\n await this.createNewTables();\n await this.dropRemovedColumns();\n await this.addNewColumns();\n await this.updatePrimaryKeys();\n await this.updateExistColumns();\n await this.createNewIndices();\n await this.createNewChecks();\n await this.createNewExclusions();\n await this.createCompositeUniqueConstraints();\n await this.createForeignKeys();\n await this.createViews();\n }\n\n private getTablePath(target: EntityMetadata | Table | View | TableForeignKey | string): string {\n const parsed = this.connection.driver.parseTableName(target);\n\n return this.connection.driver.buildTableName(\n parsed.tableName,\n parsed.schema || this.currentSchema,\n parsed.database || this.currentDatabase\n );\n }\n\n /**\n * Drops all (old) foreign keys that exist in the tables, but do not exist in the entity metadata.\n */\n protected async dropOldForeignKeys(): Promise<void> {\n for (const metadata of this.entityToSyncMetadatas) {\n const table = this.queryRunner.loadedTables.find(table => this.getTablePath(table) === this.getTablePath(metadata));\n if (!table)\n continue;\n\n // find foreign keys that exist in the schemas but does not exist in the entity metadata\n const tableForeignKeysToDrop = table.foreignKeys.filter(tableForeignKey => {\n const metadataFK = metadata.foreignKeys.find(metadataForeignKey => (\n (tableForeignKey.name === metadataForeignKey.name) &&\n (this.getTablePath(tableForeignKey) === this.getTablePath(metadataForeignKey.referencedEntityMetadata))\n ));\n return !metadataFK\n || (metadataFK.onDelete && metadataFK.onDelete !== tableForeignKey.onDelete)\n || (metadataFK.onUpdate && metadataFK.onUpdate !== tableForeignKey.onUpdate);\n });\n if (tableForeignKeysToDrop.length === 0)\n continue;\n\n this.connection.logger.logSchemaBuild(`dropping old foreign keys of ${table.name}: ${tableForeignKeysToDrop.map(dbForeignKey => dbForeignKey.name).join(\", \")}`);\n\n // drop foreign keys from the database\n await this.queryRunner.dropForeignKeys(table, tableForeignKeysToDrop);\n }\n }\n\n /**\n * Rename tables\n */\n protected async renameTables(): Promise<void> {\n // for (const metadata of this.entityToSyncMetadatas) {\n // const table = this.queryRunner.loadedTables.find(table => this.getTablePath(table) === this.getTablePath(metadata));\n // }\n }\n\n /**\n * Renames columns.\n * Works if only one column per table was changed.\n * Changes only column name. If something besides name was changed, these changes will be ignored.\n */\n protected async renameColumns(): Promise<void> {\n for (const metadata of this.entityToSyncMetadatas) {\n const table = this.queryRunner.loadedTables.find(table => this.getTablePath(table) === this.getTablePath(metadata));\n if (!table)\n continue;\n\n if (metadata.columns.length !== table.columns.length)\n continue;\n\n const renamedMetadataColumns = metadata.columns.filter(column => {\n return !table.columns.find(tableColumn => {\n return tableColumn.name === column.databaseName\n && tableColumn.type === this.connection.driver.normalizeType(column)\n && tableColumn.isNullable === column.isNullable\n && tableColumn.isUnique === this.connection.driver.normalizeIsUnique(column);\n });\n });\n\n if (renamedMetadataColumns.length === 0 || renamedMetadataColumns.length > 1)\n continue;\n\n const renamedTableColumns = table.columns.filter(tableColumn => {\n return !metadata.columns.find(column => {\n return column.databaseName === tableColumn.name\n && this.connection.driver.normalizeType(column) === tableColumn.type\n && column.isNullable === tableColumn.isNullable\n && this.connection.driver.normalizeIsUnique(column) === tableColumn.isUnique;\n });\n });\n\n if (renamedTableColumns.length === 0 || renamedTableColumns.length > 1)\n continue;\n\n const renamedColumn = renamedTableColumns[0].clone();\n renamedColumn.name = renamedMetadataColumns[0].databaseName;\n\n this.connection.logger.logSchemaBuild(`renaming column \"${renamedTableColumns[0].name}\" in to \"${renamedColumn.name}\"`);\n await this.queryRunner.renameColumn(table, renamedTableColumns[0], renamedColumn);\n }\n }\n\n protected async dropOldIndices(): Promise<void> {\n for (const metadata of this.entityToSyncMetadatas) {\n const table = this.queryRunner.loadedTables.find(table => this.getTablePath(table) === this.getTablePath(metadata));\n if (!table)\n continue;\n\n const dropQueries = table.indices\n .filter(tableIndex => {\n const indexMetadata = metadata.indices.find(index => index.name === tableIndex.name);\n if (indexMetadata) {\n if (indexMetadata.synchronize === false)\n return false;\n\n if (indexMetadata.isUnique !== tableIndex.isUnique)\n return true;\n\n if (indexMetadata.isSpatial !== tableIndex.isSpatial)\n return true;\n\n if (this.connection.driver.isFullTextColumnTypeSupported() && indexMetadata.isFulltext !== tableIndex.isFulltext)\n return true;\n\n if (indexMetadata.columns.length !== tableIndex.columnNames.length)\n return true;\n\n return !indexMetadata.columns.every(column => tableIndex.columnNames.indexOf(column.databaseName) !== -1);\n }\n\n return true;\n })\n .map(async tableIndex => {\n this.connection.logger.logSchemaBuild(`dropping an index: \"${tableIndex.name}\" from table ${table.name}`);\n await this.queryRunner.dropIndex(table, tableIndex);\n });\n\n await Promise.all(dropQueries);\n }\n }\n\n protected async dropOldChecks(): Promise<void> {\n // Mysql does not support check constraints\n if (this.connection.driver instanceof MysqlDriver || this.connection.driver instanceof AuroraDataApiDriver)\n return;\n\n for (const metadata of this.entityToSyncMetadatas) {\n const table = this.queryRunner.loadedTables.find(table => this.getTablePath(table) === this.getTablePath(metadata));\n if (!table)\n continue;\n\n const oldChecks = table.checks.filter(tableCheck => {\n return !metadata.checks.find(checkMetadata => checkMetadata.name === tableCheck.name);\n });\n\n if (oldChecks.length === 0)\n continue;\n\n this.connection.logger.logSchemaBuild(`dropping old check constraint: ${oldChecks.map(check => `\"${check.name}\"`).join(\", \")} from table \"${table.name}\"`);\n await this.queryRunner.dropCheckConstraints(table, oldChecks);\n }\n }\n\n protected async dropCompositeUniqueConstraints(): Promise<void> {\n for (const metadata of this.entityToSyncMetadatas) {\n const table = this.queryRunner.loadedTables.find(table => this.getTablePath(table) === this.getTablePath(metadata));\n if (!table)\n continue;\n\n const compositeUniques = table.uniques.filter(tableUnique => {\n return tableUnique.columnNames.length > 1 && !metadata.uniques.find(uniqueMetadata => uniqueMetadata.name === tableUnique.name);\n });\n\n if (compositeUniques.length === 0)\n continue;\n\n this.connection.logger.logSchemaBuild(`dropping old unique constraint: ${compositeUniques.map(unique => `\"${unique.name}\"`).join(\", \")} from table \"${table.name}\"`);\n await this.queryRunner.dropUniqueConstraints(table, compositeUniques);\n }\n }\n\n protected async dropOldExclusions(): Promise<void> {\n // Only PostgreSQL supports exclusion constraints\n if (!(this.connection.driver instanceof PostgresDriver))\n return;\n\n for (const metadata of this.entityToSyncMetadatas) {\n const table = this.queryRunner.loadedTables.find(table => this.getTablePath(table) === this.getTablePath(metadata));\n if (!table)\n continue;\n\n const oldExclusions = table.exclusions.filter(tableExclusion => {\n return !metadata.exclusions.find(exclusionMetadata => exclusionMetadata.name === tableExclusion.name);\n });\n\n if (oldExclusions.length === 0)\n continue;\n\n this.connection.logger.logSchemaBuild(`dropping old exclusion constraint: ${oldExclusions.map(exclusion => `\"${exclusion.name}\"`).join(\", \")} from table \"${table.name}\"`);\n await this.queryRunner.dropExclusionConstraints(table, oldExclusions);\n }\n }\n\n /**\n * Creates tables that do not exist in the database yet.\n * New tables are created without foreign and primary keys.\n * Primary key only can be created in conclusion with auto generated column.\n */\n protected async createNewTables(): Promise<void> {\n for (const metadata of this.entityToSyncMetadatas) {\n // check if table does not exist yet\n const existTable = this.queryRunner.loadedTables.find(table => this.getTablePath(table) === this.getTablePath(metadata));\n if (existTable)\n continue;\n\n this.connection.logger.logSchemaBuild(`creating a new table: ${this.getTablePath(metadata)}`);\n\n // create a new table and sync it in the database\n const table = Table.create(metadata, this.connection.driver);\n await this.queryRunner.createTable(table, false, false);\n this.queryRunner.loadedTables.push(table);\n }\n }\n\n protected async createViews(): Promise<void> {\n for (const metadata of this.viewEntityToSyncMetadatas) {\n // check if view does not exist yet\n const existView = this.queryRunner.loadedViews.find(view => {\n const viewExpression = typeof view.expression === \"string\" ? view.expression.trim() : view.expression(this.connection).getQuery();\n const metadataExpression = typeof metadata.expression === \"string\" ? metadata.expression.trim() : metadata.expression!(this.connection).getQuery();\n return this.getTablePath(view) === this.getTablePath(metadata) && viewExpression === metadataExpression;\n });\n if (existView)\n continue;\n\n this.connection.logger.logSchemaBuild(`creating a new view: ${this.getTablePath(metadata)}`);\n\n // create a new view and sync it in the database\n const view = View.create(metadata, this.connection.driver);\n await this.queryRunner.createView(view);\n this.queryRunner.loadedViews.push(view);\n }\n }\n\n protected async dropOldViews(): Promise<void> {\n const droppedViews: Array<View> = [];\n const viewEntityToSyncMetadatas = this.viewEntityToSyncMetadatas;\n // BuIld lookup cache for finding views metadata\n const viewToMetadata = new Map<View, EntityMetadata>();\n for (const view of this.queryRunner.loadedViews) {\n const viewMetadata = viewEntityToSyncMetadatas.find(metadata => {\n return this.getTablePath(view) === this.getTablePath(metadata);\n });\n if(viewMetadata){\n viewToMetadata.set(view, viewMetadata);\n }\n }\n // Gather all changed view, that need a drop\n for (const view of this.queryRunner.loadedViews) {\n const viewMetadata = viewToMetadata.get(view);\n if(!viewMetadata){\n continue;\n }\n const viewExpression = typeof view.expression === \"string\" ? view.expression.trim() : view.expression(this.connection).getQuery();\n const metadataExpression = typeof viewMetadata.expression === \"string\" ? viewMetadata.expression.trim() : viewMetadata.expression!(this.connection).getQuery();\n\n if (viewExpression === metadataExpression)\n continue;\n\n this.connection.logger.logSchemaBuild(`dropping an old view: ${view.name}`);\n\n // Collect view to be dropped\n droppedViews.push(view);\n }\n\n // Helper function that for a given view, will recursively return list of the view and all views that depend on it\n const viewDependencyChain = (view: View): View[] => {\n // Get the view metadata\n const viewMetadata = viewToMetadata.get(view);\n let viewWithDependencies = [view];\n // If no metadata is known for the view, simply return the view itself\n if(!viewMetadata){\n return viewWithDependencies;\n }\n // Iterate over all known views\n for(const [currentView, currentMetadata] of viewToMetadata.entries()){\n // Ignore self reference\n if(currentView === view) {\n continue;\n }\n // If the currently iterated view depends on the passed in view\n if(currentMetadata.dependsOn && (\n currentMetadata.dependsOn.has(viewMetadata.target) ||\n currentMetadata.dependsOn.has(viewMetadata.name)\n )){\n // Recursively add currently iterate view and its dependents\n viewWithDependencies = viewWithDependencies.concat(viewDependencyChain(currentView));\n }\n }\n // Return all collected views\n return viewWithDependencies;\n };\n\n // Collect final list of views to be dropped in a Set so there are no duplicates\n const droppedViewsWithDependencies: Set<View> = new Set(\n // Collect all dropped views, and their dependencies\n droppedViews.map(view => viewDependencyChain(view))\n // Flattened to single Array ( can be replaced with flatMap, once supported)\n .reduce((all, segment) => {\n return all.concat(segment);\n }, [])\n // Sort the views to be dropped in creation order\n .sort((a, b)=> {\n return ViewUtils.viewMetadataCmp(viewToMetadata.get(a), viewToMetadata.get(b));\n })\n // reverse order to get drop order\n .reverse()\n );\n\n // Finally emit all drop views\n for(const view of droppedViewsWithDependencies){\n await this.queryRunner.dropView(view);\n }\n this.queryRunner.loadedViews = this.queryRunner.loadedViews.filter(view => !droppedViewsWithDependencies.has(view));\n }\n\n /**\n * Drops all columns that exist in the table, but does not exist in the metadata (left old).\n * We drop their keys too, since it should be safe.\n */\n protected async dropRemovedColumns(): Promise<void> {\n for (const metadata of this.entityToSyncMetadatas) {\n const table = this.queryRunner.loadedTables.find(table => this.getTablePath(table) === this.getTablePath(metadata));\n if (!table)\n continue;\n\n // find columns that exist in the database but does not exist in the metadata\n const droppedTableColumns = table.columns.filter(tableColumn => {\n return !metadata.columns.find(columnMetadata => columnMetadata.databaseName === tableColumn.name);\n });\n if (droppedTableColumns.length === 0)\n continue;\n\n this.connection.logger.logSchemaBuild(`columns dropped in ${table.name}: ` + droppedTableColumns.map(column => column.name).join(\", \"));\n\n // drop columns from the database\n await this.queryRunner.dropColumns(table, droppedTableColumns);\n }\n }\n\n /**\n * Adds columns from metadata which does not exist in the table.\n * Columns are created without keys.\n */\n protected async addNewColumns(): Promise<void> {\n for (const metadata of this.entityToSyncMetadatas) {\n const table = this.queryRunner.loadedTables.find(table => this.getTablePath(table) === this.getTablePath(metadata));\n if (!table)\n continue;\n\n // find which columns are new\n const newColumnMetadatas = metadata.columns.filter(columnMetadata => {\n return !table.columns.find(tableColumn => tableColumn.name === columnMetadata.databaseName);\n });\n if (newColumnMetadatas.length === 0)\n continue;\n\n // create columns in the database\n const newTableColumnOptions = this.metadataColumnsToTableColumnOptions(newColumnMetadatas);\n const newTableColumns = newTableColumnOptions.map(option => new TableColumn(option));\n\n if (newTableColumns.length === 0)\n continue;\n\n this.connection.logger.logSchemaBuild(`new columns added: ` + newColumnMetadatas.map(column => column.databaseName).join(\", \"));\n await this.queryRunner.addColumns(table, newTableColumns);\n }\n }\n\n /**\n * Updates composite primary keys.\n */\n protected async updatePrimaryKeys(): Promise<void> {\n for (const metadata of this.entityToSyncMetadatas) {\n const table = this.queryRunner.loadedTables.find(table => this.getTablePath(table) === this.getTablePath(metadata));\n if (!table)\n continue;\n\n const primaryMetadataColumns = metadata.columns.filter(column => column.isPrimary);\n const primaryTableColumns = table.columns.filter(column => column.isPrimary);\n if (primaryTableColumns.length !== primaryMetadataColumns.length && primaryMetadataColumns.length > 1) {\n const changedPrimaryColumns = primaryMetadataColumns.map(primaryMetadataColumn => {\n return new TableColumn(TableUtils.createTableColumnOptions(primaryMetadataColumn, this.connection.driver));\n });\n await this.queryRunner.updatePrimaryKeys(table, changedPrimaryColumns);\n }\n }\n }\n\n /**\n * Update all exist columns which metadata has changed.\n * Still don't create keys. Also we don't touch foreign keys of the changed columns.\n */\n protected async updateExistColumns(): Promise<void> {\n for (const metadata of this.entityToSyncMetadatas) {\n const table = this.queryRunner.loadedTables.find(table => this.getTablePath(table) === this.getTablePath(metadata));\n if (!table)\n continue;\n\n const changedColumns = this.connection.driver.findChangedColumns(table.columns, metadata.columns);\n if (changedColumns.length === 0)\n continue;\n\n // drop all foreign keys that point to this column\n for (const changedColumn of changedColumns) {\n await this.dropColumnReferencedForeignKeys(this.getTablePath(metadata), changedColumn.databaseName);\n }\n\n // drop all composite indices related to this column\n for (const changedColumn of changedColumns) {\n await this.dropColumnCompositeIndices(this.getTablePath(metadata), changedColumn.databaseName);\n }\n\n // drop all composite uniques related to this column\n // Mysql does not support unique constraints.\n if (!(this.connection.driver instanceof MysqlDriver || this.connection.driver instanceof AuroraDataApiDriver)) {\n for (const changedColumn of changedColumns) {\n await this.dropColumnCompositeUniques(this.getTablePath(metadata), changedColumn.databaseName);\n }\n }\n\n // generate a map of new/old columns\n const newAndOldTableColumns = changedColumns.map(changedColumn => {\n const oldTableColumn = table.columns.find(column => column.name === changedColumn.databaseName)!;\n const newTableColumnOptions = TableUtils.createTableColumnOptions(changedColumn, this.connection.driver);\n const newTableColumn = new TableColumn(newTableColumnOptions);\n\n return {\n oldColumn: oldTableColumn,\n newColumn: newTableColumn\n };\n });\n\n if (newAndOldTableColumns.length === 0)\n continue;\n\n this.connection.logger.logSchemaBuild(`columns changed in \"${table.name}\". updating: ` + changedColumns.map(column => column.databaseName).join(\", \"));\n await this.queryRunner.changeColumns(table, newAndOldTableColumns);\n }\n }\n\n /**\n * Creates composite indices which are missing in db yet.\n */\n protected async createNewIndices(): Promise<void> {\n for (const metadata of this.entityToSyncMetadatas) {\n const table = this.queryRunner.loadedTables.find(table => this.getTablePath(table) === this.getTablePath(metadata));\n if (!table)\n continue;\n\n const newIndices = metadata.indices\n .filter(indexMetadata => !table.indices.find(tableIndex => tableIndex.name === indexMetadata.name) && indexMetadata.synchronize === true)\n .map(indexMetadata => TableIndex.create(indexMetadata));\n\n if (newIndices.length === 0)\n continue;\n\n this.connection.logger.logSchemaBuild(`adding new indices ${newIndices.map(index => `\"${index.name}\"`).join(\", \")} in table \"${table.name}\"`);\n await this.queryRunner.createIndices(table, newIndices);\n }\n }\n\n protected async createNewChecks(): Promise<void> {\n // Mysql does not support check constraints\n if (this.connection.driver instanceof MysqlDriver || this.connection.driver instanceof AuroraDataApiDriver)\n return;\n\n for (const metadata of this.entityToSyncMetadatas) {\n const table = this.queryRunner.loadedTables.find(table => this.getTablePath(table) === this.getTablePath(metadata));\n if (!table)\n continue;\n\n const newChecks = metadata.checks\n .filter(checkMetadata => !table.checks.find(tableCheck => tableCheck.name === checkMetadata.name))\n .map(checkMetadata => TableCheck.create(checkMetadata));\n\n if (newChecks.length === 0)\n continue;\n\n this.connection.logger.logSchemaBuild(`adding new check constraints: ${newChecks.map(index => `\"${index.name}\"`).join(\", \")} in table \"${table.name}\"`);\n await this.queryRunner.createCheckConstraints(table, newChecks);\n }\n }\n\n /**\n * Creates composite uniques which are missing in db yet.\n */\n protected async createCompositeUniqueConstraints(): Promise<void> {\n for (const metadata of this.entityToSyncMetadatas) {\n const table = this.queryRunner.loadedTables.find(table => this.getTablePath(table) === this.getTablePath(metadata));\n if (!table)\n continue;\n\n const compositeUniques = metadata.uniques\n .filter(uniqueMetadata => uniqueMetadata.columns.length > 1 && !table.uniques.find(tableUnique => tableUnique.name === uniqueMetadata.name))\n .map(uniqueMetadata => TableUnique.create(uniqueMetadata));\n\n if (compositeUniques.length === 0)\n continue;\n\n this.connection.logger.logSchemaBuild(`adding new unique constraints: ${compositeUniques.map(unique => `\"${unique.name}\"`).join(\", \")} in table \"${table.name}\"`);\n await this.queryRunner.createUniqueConstraints(table, compositeUniques);\n }\n }\n\n /**\n * Creates exclusions which are missing in db yet.\n */\n protected async createNewExclusions(): Promise<void> {\n // Only PostgreSQL supports exclusion constraints\n if (!(this.connection.driver instanceof PostgresDriver))\n return;\n\n for (const metadata of this.entityToSyncMetadatas) {\n const table = this.queryRunner.loadedTables.find(table => this.getTablePath(table) === this.getTablePath(metadata));\n if (!table)\n continue;\n\n const newExclusions = metadata.exclusions\n .filter(exclusionMetadata => !table.exclusions.find(tableExclusion => tableExclusion.name === exclusionMetadata.name))\n .map(exclusionMetadata => TableExclusion.create(exclusionMetadata));\n\n if (newExclusions.length === 0)\n continue;\n\n this.connection.logger.logSchemaBuild(`adding new exclusion constraints: ${newExclusions.map(exclusion => `\"${exclusion.name}\"`).join(\", \")} in table \"${table.name}\"`);\n await this.queryRunner.createExclusionConstraints(table, newExclusions);\n }\n }\n\n /**\n * Creates foreign keys which does not exist in the table yet.\n */\n protected async createForeignKeys(): Promise<void> {\n for (const metadata of this.entityToSyncMetadatas) {\n const table = this.queryRunner.loadedTables.find(table => this.getTablePath(table) === this.getTablePath(metadata));\n if (!table)\n continue;\n\n const newKeys = metadata.foreignKeys\n .filter(foreignKey => {\n return !table.foreignKeys.find(dbForeignKey => (\n (dbForeignKey.name === foreignKey.name) &&\n (this.getTablePath(dbForeignKey) === this.getTablePath(foreignKey.referencedEntityMetadata))\n ));\n });\n if (newKeys.length === 0)\n continue;\n\n const dbForeignKeys = newKeys.map(foreignKeyMetadata => TableForeignKey.create(foreignKeyMetadata, this.connection.driver));\n this.connection.logger.logSchemaBuild(`creating a foreign keys: ${newKeys.map(key => key.name).join(\", \")} on table \"${table.name}\"`);\n await this.queryRunner.createForeignKeys(table, dbForeignKeys);\n }\n }\n\n /**\n * Drops all foreign keys where given column of the given table is being used.\n */\n protected async dropColumnReferencedForeignKeys(tablePath: string, columnName: string): Promise<void> {\n const table = this.queryRunner.loadedTables.find(table => this.getTablePath(table) === tablePath);\n if (!table)\n return;\n\n const tablesWithFK: Table[] = [];\n const columnForeignKey = table.foreignKeys.find(foreignKey => foreignKey.columnNames.indexOf(columnName) !== -1);\n if (columnForeignKey) {\n const clonedTable = table.clone();\n clonedTable.foreignKeys = [columnForeignKey];\n tablesWithFK.push(clonedTable);\n table.removeForeignKey(columnForeignKey);\n }\n\n for (const loadedTable of this.queryRunner.loadedTables) {\n const dependForeignKeys = loadedTable.foreignKeys.filter(foreignKey => {\n return this.getTablePath(foreignKey) === tablePath && foreignKey.referencedColumnNames.indexOf(columnName) !== -1;\n });\n\n if (dependForeignKeys.length > 0) {\n const clonedTable = loadedTable.clone();\n clonedTable.foreignKeys = dependForeignKeys;\n tablesWithFK.push(clonedTable);\n dependForeignKeys.forEach(dependForeignKey => loadedTable.removeForeignKey(dependForeignKey));\n }\n }\n\n if (tablesWithFK.length > 0) {\n for (const tableWithFK of tablesWithFK) {\n this.connection.logger.logSchemaBuild(`dropping related foreign keys of ${tableWithFK.name}: ${tableWithFK.foreignKeys.map(foreignKey => foreignKey.name).join(\", \")}`);\n await this.queryRunner.dropForeignKeys(tableWithFK, tableWithFK.foreignKeys);\n }\n }\n }\n\n /**\n * Drops all composite indices, related to given column.\n */\n protected async dropColumnCompositeIndices(tablePath: string, columnName: string): Promise<void> {\n const table = this.queryRunner.loadedTables.find(table => this.getTablePath(table) === tablePath);\n if (!table)\n return;\n\n const relatedIndices = table.indices.filter(index => index.columnNames.length > 1 && index.columnNames.indexOf(columnName) !== -1);\n if (relatedIndices.length === 0)\n return;\n\n this.connection.logger.logSchemaBuild(`dropping related indices of \"${tablePath}\".\"${columnName}\": ${relatedIndices.map(index => index.name).join(\", \")}`);\n await this.queryRunner.dropIndices(table, relatedIndices);\n }\n\n /**\n * Drops all composite uniques, related to given column.\n */\n protected async dropColumnCompositeUniques(tablePath: string, columnName: string): Promise<void> {\n const table = this.queryRunner.loadedTables.find(table => this.getTablePath(table) === tablePath);\n if (!table)\n return;\n\n const relatedUniques = table.uniques.filter(unique => unique.columnNames.length > 1 && unique.columnNames.indexOf(columnName) !== -1);\n if (relatedUniques.length === 0)\n return;\n\n this.connection.logger.logSchemaBuild(`dropping related unique constraints of \"${tablePath}\".\"${columnName}\": ${relatedUniques.map(unique => unique.name).join(\", \")}`);\n await this.queryRunner.dropUniqueConstraints(table, relatedUniques);\n }\n\n /**\n * Creates new columns from the given column metadatas.\n */\n protected metadataColumnsToTableColumnOptions(columns: ColumnMetadata[]): TableColumnOptions[] {\n return columns.map(columnMetadata => TableUtils.createTableColumnOptions(columnMetadata, this.connection.driver));\n }\n\n /**\n * Creates typeorm service table for storing user defined Views.\n */\n protected async createTypeormMetadataTable(queryRunner: QueryRunner) {\n const schema = this.currentSchema;\n const database = this.currentDatabase;\n const typeormMetadataTable = this.connection.driver.buildTableName(\"typeorm_metadata\", schema, database);\n\n await queryRunner.createTable(new Table(\n {\n database: database,\n schema: schema,\n name: typeormMetadataTable,\n columns: [\n {\n name: \"type\",\n type: this.connection.driver.normalizeType({type: this.connection.driver.mappedDataTypes.metadataType}),\n isNullable: false\n },\n {\n name: \"database\",\n type: this.connection.driver.normalizeType({type: this.connection.driver.mappedDataTypes.metadataDatabase}),\n isNullable: true\n },\n {\n name: \"schema\",\n type: this.connection.driver.normalizeType({type: this.connection.driver.mappedDataTypes.metadataSchema}),\n isNullable: true\n },\n {\n name: \"table\",\n type: this.connection.driver.normalizeType({type: this.connection.driver.mappedDataTypes.metadataTable}),\n isNullable: true\n },\n {\n name: \"name\",\n type: this.connection.driver.normalizeType({type: this.connection.driver.mappedDataTypes.metadataName}),\n isNullable: true\n },\n {\n name: \"value\",\n type: this.connection.driver.normalizeType({type: this.connection.driver.mappedDataTypes.metadataValue}),\n isNullable: true\n },\n ]\n },\n ), true);\n }\n}\n"],"sourceRoot":".."}
1
+ {"version":3,"sources":["../browser/src/schema-builder/RdbmsSchemaBuilder.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,eAAe,EAAC,MAAM,uCAAuC,CAAC;AACtE,OAAO,EAAC,KAAK,EAAC,MAAM,eAAe,CAAC;AACpC,OAAO,EAAC,WAAW,EAAC,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAC,eAAe,EAAC,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAC,UAAU,EAAC,MAAM,oBAAoB,CAAC;AAO9C,OAAO,EAAC,UAAU,EAAC,MAAM,mBAAmB,CAAC;AAE7C,OAAO,EAAC,cAAc,EAAC,MAAM,mCAAmC,CAAC;AACjE,OAAO,EAAC,WAAW,EAAC,MAAM,6BAA6B,CAAC;AACxD,OAAO,EAAC,WAAW,EAAC,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAC,UAAU,EAAC,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAC,cAAc,EAAC,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAC,IAAI,EAAC,MAAM,aAAa,CAAC;AACjC,OAAO,EAAC,S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EAAE,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,aAAa,CAAC,EAAC,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,eAAe,CAAC,cAAc,EAAC,CAAC;wCACzG,UAAU,EAAE,IAAI;qCACnB;oCACD;wCACI,IAAI,EAAE,OAAO;wCACb,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,aAAa,CAAC,EAAC,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,eAAe,CAAC,aAAa,EAAC,CAAC;wCACxG,UAAU,EAAE,IAAI;qCACnB;oCACD;wCACI,IAAI,EAAE,MAAM;wCACZ,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,aAAa,CAAC,EAAC,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,eAAe,CAAC,YAAY,EAAC,CAAC;wCACvG,UAAU,EAAE,IAAI;qCACnB;oCACD;wCACI,IAAI,EAAE,OAAO;wCACb,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,aAAa,CAAC,EAAC,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,eAAe,CAAC,aAAa,EAAC,CAAC;wCACxG,UAAU,EAAE,IAAI;qCACnB;iCACJ;6BACJ,CACJ,EAAE,IAAI,CAAC,EAAA;;wBAtCR,SAsCQ,CAAC;;;;;KACZ;IACL,yBAAC;AAAD,CAz0BA,AAy0BC,IAAA","file":"RdbmsSchemaBuilder.js","sourcesContent":["import {CockroachDriver} from \"../driver/cockroachdb/CockroachDriver\";\nimport {Table} from \"./table/Table\";\nimport {TableColumn} from \"./table/TableColumn\";\nimport {TableForeignKey} from \"./table/TableForeignKey\";\nimport {TableIndex} from \"./table/TableIndex\";\nimport {QueryRunner} from \"../query-runner/QueryRunner\";\nimport {ColumnMetadata} from \"../metadata/ColumnMetadata\";\nimport {EntityMetadata} from \"../metadata/EntityMetadata\";\nimport {Connection} from \"../connection/Connection\";\nimport {SchemaBuilder} from \"./SchemaBuilder\";\nimport {SqlInMemory} from \"../driver/SqlInMemory\";\nimport {TableUtils} from \"./util/TableUtils\";\nimport {TableColumnOptions} from \"./options/TableColumnOptions\";\nimport {PostgresDriver} from \"../driver/postgres/PostgresDriver\";\nimport {MysqlDriver} from \"../driver/mysql/MysqlDriver\";\nimport {TableUnique} from \"./table/TableUnique\";\nimport {TableCheck} from \"./table/TableCheck\";\nimport {TableExclusion} from \"./table/TableExclusion\";\nimport {View} from \"./view/View\";\nimport {ViewUtils} from \"./util/ViewUtils\";\nimport {AuroraDataApiDriver} from \"../driver/aurora-data-api/AuroraDataApiDriver\";\n\n/**\n * Creates complete tables schemas in the database based on the entity metadatas.\n *\n * Steps how schema is being built:\n * 1. load list of all tables with complete column and keys information from the db\n * 2. drop all (old) foreign keys that exist in the table, but does not exist in the metadata\n * 3. create new tables that does not exist in the db, but exist in the metadata\n * 4. drop all columns exist (left old) in the db table, but does not exist in the metadata\n * 5. add columns from metadata which does not exist in the table\n * 6. update all exist columns which metadata has changed\n * 7. update primary keys - update old and create new primary key from changed columns\n * 8. create foreign keys which does not exist in the table yet\n * 9. create indices which are missing in db yet, and drops indices which exist in the db, but does not exist in the metadata anymore\n */\nexport class RdbmsSchemaBuilder implements SchemaBuilder {\n /**\n * Used to execute schema creation queries in a single connection.\n */\n protected queryRunner: QueryRunner;\n\n private currentDatabase?: string;\n\n private currentSchema?: string;\n\n // -------------------------------------------------------------------------\n // Constructor\n // -------------------------------------------------------------------------\n\n constructor(protected connection: Connection) {\n }\n\n // -------------------------------------------------------------------------\n // Public Methods\n // -------------------------------------------------------------------------\n\n /**\n * Creates complete schemas for the given entity metadatas.\n */\n async build(): Promise<void> {\n this.queryRunner = this.connection.createQueryRunner();\n\n // this.connection.driver.database || this.currentDatabase;\n this.currentDatabase = this.connection.driver.database;\n this.currentSchema = this.connection.driver.schema;\n\n // CockroachDB implements asynchronous schema sync operations which can not been executed in transaction.\n // E.g. if you try to DROP column and ADD it again in the same transaction, crdb throws error.\n const isUsingTransactions = (\n !(this.connection.driver instanceof CockroachDriver) &&\n this.connection.options.migrationsTransactionMode !== \"none\"\n );\n\n if (isUsingTransactions) {\n await this.queryRunner.startTransaction();\n }\n\n try {\n await this.createMetadataTableIfNecessary(this.queryRunner);\n // Flush the queryrunner table & view cache\n const tablePaths = this.entityToSyncMetadatas.map(metadata => this.getTablePath(metadata));\n\n await this.queryRunner.getTables(tablePaths);\n await this.queryRunner.getViews([]);\n\n await this.executeSchemaSyncOperationsInProperOrder();\n\n // if cache is enabled then perform cache-synchronization as well\n if (this.connection.queryResultCache)\n await this.connection.queryResultCache.synchronize(this.queryRunner);\n\n if (isUsingTransactions) {\n await this.queryRunner.commitTransaction();\n }\n\n } catch (error) {\n\n try { // we throw original error even if rollback thrown an error\n if (isUsingTransactions) {\n await this.queryRunner.rollbackTransaction();\n }\n } catch (rollbackError) { }\n throw error;\n\n } finally {\n await this.queryRunner.release();\n }\n }\n\n /**\n * If the schema contains views, create the typeorm_metadata table if it doesn't exist yet\n */\n async createMetadataTableIfNecessary(queryRunner: QueryRunner): Promise<void> {\n if (this.viewEntityToSyncMetadatas.length > 0 || (this.connection.driver instanceof PostgresDriver && this.connection.driver.isGeneratedColumnsSupported)) {\n await this.createTypeormMetadataTable(queryRunner);\n }\n }\n\n /**\n * Returns sql queries to be executed by schema builder.\n */\n async log(): Promise<SqlInMemory> {\n this.queryRunner = this.connection.createQueryRunner();\n try {\n // Flush the queryrunner table & view cache\n const tablePaths = this.entityToSyncMetadatas.map(metadata => this.getTablePath(metadata));\n await this.queryRunner.getTables(tablePaths);\n await this.queryRunner.getViews([]);\n\n this.queryRunner.enableSqlMemory();\n await this.executeSchemaSyncOperationsInProperOrder();\n\n // if cache is enabled then perform cache-synchronization as well\n if (this.connection.queryResultCache) // todo: check this functionality\n await this.connection.queryResultCache.synchronize(this.queryRunner);\n\n return this.queryRunner.getMemorySql();\n\n } finally {\n // its important to disable this mode despite the fact we are release query builder\n // because there exist drivers which reuse same query runner. Also its important to disable\n // sql memory after call of getMemorySql() method because last one flushes sql memory.\n this.queryRunner.disableSqlMemory();\n await this.queryRunner.release();\n }\n }\n\n // -------------------------------------------------------------------------\n // Protected Methods\n // -------------------------------------------------------------------------\n\n /**\n * Returns only entities that should be synced in the database.\n */\n protected get entityToSyncMetadatas(): EntityMetadata[] {\n return this.connection.entityMetadatas.filter(metadata => metadata.synchronize && metadata.tableType !== \"entity-child\" && metadata.tableType !== \"view\");\n }\n\n /**\n * Returns only entities that should be synced in the database.\n */\n protected get viewEntityToSyncMetadatas(): EntityMetadata[] {\n return this.connection.entityMetadatas\n .filter(metadata => metadata.tableType === \"view\" && metadata.synchronize)\n // sort views in creation order by dependencies\n .sort(ViewUtils.viewMetadataCmp);\n }\n\n /**\n * Executes schema sync operations in a proper order.\n * Order of operations matter here.\n */\n protected async executeSchemaSyncOperationsInProperOrder(): Promise<void> {\n await this.dropOldViews();\n await this.dropOldForeignKeys();\n await this.dropOldIndices();\n await this.dropOldChecks();\n await this.dropOldExclusions();\n await this.dropCompositeUniqueConstraints();\n // await this.renameTables();\n await this.renameColumns();\n await this.createNewTables();\n await this.dropRemovedColumns();\n await this.addNewColumns();\n await this.updatePrimaryKeys();\n await this.updateExistColumns();\n await this.createNewIndices();\n await this.createNewChecks();\n await this.createNewExclusions();\n await this.createCompositeUniqueConstraints();\n await this.createForeignKeys();\n await this.createViews();\n }\n\n private getTablePath(target: EntityMetadata | Table | View | TableForeignKey | string): string {\n const parsed = this.connection.driver.parseTableName(target);\n\n return this.connection.driver.buildTableName(\n parsed.tableName,\n parsed.schema || this.currentSchema,\n parsed.database || this.currentDatabase\n );\n }\n\n /**\n * Drops all (old) foreign keys that exist in the tables, but do not exist in the entity metadata.\n */\n protected async dropOldForeignKeys(): Promise<void> {\n for (const metadata of this.entityToSyncMetadatas) {\n const table = this.queryRunner.loadedTables.find(table => this.getTablePath(table) === this.getTablePath(metadata));\n if (!table)\n continue;\n\n // find foreign keys that exist in the schemas but does not exist in the entity metadata\n const tableForeignKeysToDrop = table.foreignKeys.filter(tableForeignKey => {\n const metadataFK = metadata.foreignKeys.find(metadataForeignKey => (\n (tableForeignKey.name === metadataForeignKey.name) &&\n (this.getTablePath(tableForeignKey) === this.getTablePath(metadataForeignKey.referencedEntityMetadata))\n ));\n return !metadataFK\n || (metadataFK.onDelete && metadataFK.onDelete !== tableForeignKey.onDelete)\n || (metadataFK.onUpdate && metadataFK.onUpdate !== tableForeignKey.onUpdate);\n });\n if (tableForeignKeysToDrop.length === 0)\n continue;\n\n this.connection.logger.logSchemaBuild(`dropping old foreign keys of ${table.name}: ${tableForeignKeysToDrop.map(dbForeignKey => dbForeignKey.name).join(\", \")}`);\n\n // drop foreign keys from the database\n await this.queryRunner.dropForeignKeys(table, tableForeignKeysToDrop);\n }\n }\n\n /**\n * Rename tables\n */\n protected async renameTables(): Promise<void> {\n // for (const metadata of this.entityToSyncMetadatas) {\n // const table = this.queryRunner.loadedTables.find(table => this.getTablePath(table) === this.getTablePath(metadata));\n // }\n }\n\n /**\n * Renames columns.\n * Works if only one column per table was changed.\n * Changes only column name. If something besides name was changed, these changes will be ignored.\n */\n protected async renameColumns(): Promise<void> {\n for (const metadata of this.entityToSyncMetadatas) {\n const table = this.queryRunner.loadedTables.find(table => this.getTablePath(table) === this.getTablePath(metadata));\n if (!table)\n continue;\n\n if (metadata.columns.length !== table.columns.length)\n continue;\n\n const renamedMetadataColumns = metadata.columns.filter(column => {\n return !table.columns.find(tableColumn => {\n return tableColumn.name === column.databaseName\n && tableColumn.type === this.connection.driver.normalizeType(column)\n && tableColumn.isNullable === column.isNullable\n && tableColumn.isUnique === this.connection.driver.normalizeIsUnique(column);\n });\n });\n\n if (renamedMetadataColumns.length === 0 || renamedMetadataColumns.length > 1)\n continue;\n\n const renamedTableColumns = table.columns.filter(tableColumn => {\n return !metadata.columns.find(column => {\n return column.databaseName === tableColumn.name\n && this.connection.driver.normalizeType(column) === tableColumn.type\n && column.isNullable === tableColumn.isNullable\n && this.connection.driver.normalizeIsUnique(column) === tableColumn.isUnique;\n });\n });\n\n if (renamedTableColumns.length === 0 || renamedTableColumns.length > 1)\n continue;\n\n const renamedColumn = renamedTableColumns[0].clone();\n renamedColumn.name = renamedMetadataColumns[0].databaseName;\n\n this.connection.logger.logSchemaBuild(`renaming column \"${renamedTableColumns[0].name}\" in to \"${renamedColumn.name}\"`);\n await this.queryRunner.renameColumn(table, renamedTableColumns[0], renamedColumn);\n }\n }\n\n protected async dropOldIndices(): Promise<void> {\n for (const metadata of this.entityToSyncMetadatas) {\n const table = this.queryRunner.loadedTables.find(table => this.getTablePath(table) === this.getTablePath(metadata));\n if (!table)\n continue;\n\n const dropQueries = table.indices\n .filter(tableIndex => {\n const indexMetadata = metadata.indices.find(index => index.name === tableIndex.name);\n if (indexMetadata) {\n if (indexMetadata.synchronize === false)\n return false;\n\n if (indexMetadata.isUnique !== tableIndex.isUnique)\n return true;\n\n if (indexMetadata.isSpatial !== tableIndex.isSpatial)\n return true;\n\n if (this.connection.driver.isFullTextColumnTypeSupported() && indexMetadata.isFulltext !== tableIndex.isFulltext)\n return true;\n\n if (indexMetadata.columns.length !== tableIndex.columnNames.length)\n return true;\n\n return !indexMetadata.columns.every(column => tableIndex.columnNames.indexOf(column.databaseName) !== -1);\n }\n\n return true;\n })\n .map(async tableIndex => {\n this.connection.logger.logSchemaBuild(`dropping an index: \"${tableIndex.name}\" from table ${table.name}`);\n await this.queryRunner.dropIndex(table, tableIndex);\n });\n\n await Promise.all(dropQueries);\n }\n }\n\n protected async dropOldChecks(): Promise<void> {\n // Mysql does not support check constraints\n if (this.connection.driver instanceof MysqlDriver || this.connection.driver instanceof AuroraDataApiDriver)\n return;\n\n for (const metadata of this.entityToSyncMetadatas) {\n const table = this.queryRunner.loadedTables.find(table => this.getTablePath(table) === this.getTablePath(metadata));\n if (!table)\n continue;\n\n const oldChecks = table.checks.filter(tableCheck => {\n return !metadata.checks.find(checkMetadata => checkMetadata.name === tableCheck.name);\n });\n\n if (oldChecks.length === 0)\n continue;\n\n this.connection.logger.logSchemaBuild(`dropping old check constraint: ${oldChecks.map(check => `\"${check.name}\"`).join(\", \")} from table \"${table.name}\"`);\n await this.queryRunner.dropCheckConstraints(table, oldChecks);\n }\n }\n\n protected async dropCompositeUniqueConstraints(): Promise<void> {\n for (const metadata of this.entityToSyncMetadatas) {\n const table = this.queryRunner.loadedTables.find(table => this.getTablePath(table) === this.getTablePath(metadata));\n if (!table)\n continue;\n\n const compositeUniques = table.uniques.filter(tableUnique => {\n return tableUnique.columnNames.length > 1 && !metadata.uniques.find(uniqueMetadata => uniqueMetadata.name === tableUnique.name);\n });\n\n if (compositeUniques.length === 0)\n continue;\n\n this.connection.logger.logSchemaBuild(`dropping old unique constraint: ${compositeUniques.map(unique => `\"${unique.name}\"`).join(\", \")} from table \"${table.name}\"`);\n await this.queryRunner.dropUniqueConstraints(table, compositeUniques);\n }\n }\n\n protected async dropOldExclusions(): Promise<void> {\n // Only PostgreSQL supports exclusion constraints\n if (!(this.connection.driver instanceof PostgresDriver))\n return;\n\n for (const metadata of this.entityToSyncMetadatas) {\n const table = this.queryRunner.loadedTables.find(table => this.getTablePath(table) === this.getTablePath(metadata));\n if (!table)\n continue;\n\n const oldExclusions = table.exclusions.filter(tableExclusion => {\n return !metadata.exclusions.find(exclusionMetadata => exclusionMetadata.name === tableExclusion.name);\n });\n\n if (oldExclusions.length === 0)\n continue;\n\n this.connection.logger.logSchemaBuild(`dropping old exclusion constraint: ${oldExclusions.map(exclusion => `\"${exclusion.name}\"`).join(\", \")} from table \"${table.name}\"`);\n await this.queryRunner.dropExclusionConstraints(table, oldExclusions);\n }\n }\n\n /**\n * Creates tables that do not exist in the database yet.\n * New tables are created without foreign and primary keys.\n * Primary key only can be created in conclusion with auto generated column.\n */\n protected async createNewTables(): Promise<void> {\n for (const metadata of this.entityToSyncMetadatas) {\n // check if table does not exist yet\n const existTable = this.queryRunner.loadedTables.find(table => this.getTablePath(table) === this.getTablePath(metadata));\n if (existTable)\n continue;\n\n this.connection.logger.logSchemaBuild(`creating a new table: ${this.getTablePath(metadata)}`);\n\n // create a new table and sync it in the database\n const table = Table.create(metadata, this.connection.driver);\n await this.queryRunner.createTable(table, false, false);\n this.queryRunner.loadedTables.push(table);\n }\n }\n\n protected async createViews(): Promise<void> {\n for (const metadata of this.viewEntityToSyncMetadatas) {\n // check if view does not exist yet\n const existView = this.queryRunner.loadedViews.find(view => {\n const viewExpression = typeof view.expression === \"string\" ? view.expression.trim() : view.expression(this.connection).getQuery();\n const metadataExpression = typeof metadata.expression === \"string\" ? metadata.expression.trim() : metadata.expression!(this.connection).getQuery();\n return this.getTablePath(view) === this.getTablePath(metadata) && viewExpression === metadataExpression;\n });\n if (existView)\n continue;\n\n this.connection.logger.logSchemaBuild(`creating a new view: ${this.getTablePath(metadata)}`);\n\n // create a new view and sync it in the database\n const view = View.create(metadata, this.connection.driver);\n await this.queryRunner.createView(view);\n this.queryRunner.loadedViews.push(view);\n }\n }\n\n protected async dropOldViews(): Promise<void> {\n const droppedViews: Array<View> = [];\n const viewEntityToSyncMetadatas = this.viewEntityToSyncMetadatas;\n // BuIld lookup cache for finding views metadata\n const viewToMetadata = new Map<View, EntityMetadata>();\n for (const view of this.queryRunner.loadedViews) {\n const viewMetadata = viewEntityToSyncMetadatas.find(metadata => {\n return this.getTablePath(view) === this.getTablePath(metadata);\n });\n if(viewMetadata){\n viewToMetadata.set(view, viewMetadata);\n }\n }\n // Gather all changed view, that need a drop\n for (const view of this.queryRunner.loadedViews) {\n const viewMetadata = viewToMetadata.get(view);\n if(!viewMetadata){\n continue;\n }\n const viewExpression = typeof view.expression === \"string\" ? view.expression.trim() : view.expression(this.connection).getQuery();\n const metadataExpression = typeof viewMetadata.expression === \"string\" ? viewMetadata.expression.trim() : viewMetadata.expression!(this.connection).getQuery();\n\n if (viewExpression === metadataExpression)\n continue;\n\n this.connection.logger.logSchemaBuild(`dropping an old view: ${view.name}`);\n\n // Collect view to be dropped\n droppedViews.push(view);\n }\n\n // Helper function that for a given view, will recursively return list of the view and all views that depend on it\n const viewDependencyChain = (view: View): View[] => {\n // Get the view metadata\n const viewMetadata = viewToMetadata.get(view);\n let viewWithDependencies = [view];\n // If no metadata is known for the view, simply return the view itself\n if(!viewMetadata){\n return viewWithDependencies;\n }\n // Iterate over all known views\n for(const [currentView, currentMetadata] of viewToMetadata.entries()){\n // Ignore self reference\n if(currentView === view) {\n continue;\n }\n // If the currently iterated view depends on the passed in view\n if(currentMetadata.dependsOn && (\n currentMetadata.dependsOn.has(viewMetadata.target) ||\n currentMetadata.dependsOn.has(viewMetadata.name)\n )){\n // Recursively add currently iterate view and its dependents\n viewWithDependencies = viewWithDependencies.concat(viewDependencyChain(currentView));\n }\n }\n // Return all collected views\n return viewWithDependencies;\n };\n\n // Collect final list of views to be dropped in a Set so there are no duplicates\n const droppedViewsWithDependencies: Set<View> = new Set(\n // Collect all dropped views, and their dependencies\n droppedViews.map(view => viewDependencyChain(view))\n // Flattened to single Array ( can be replaced with flatMap, once supported)\n .reduce((all, segment) => {\n return all.concat(segment);\n }, [])\n // Sort the views to be dropped in creation order\n .sort((a, b)=> {\n return ViewUtils.viewMetadataCmp(viewToMetadata.get(a), viewToMetadata.get(b));\n })\n // reverse order to get drop order\n .reverse()\n );\n\n // Finally emit all drop views\n for(const view of droppedViewsWithDependencies){\n await this.queryRunner.dropView(view);\n }\n this.queryRunner.loadedViews = this.queryRunner.loadedViews.filter(view => !droppedViewsWithDependencies.has(view));\n }\n\n /**\n * Drops all columns that exist in the table, but does not exist in the metadata (left old).\n * We drop their keys too, since it should be safe.\n */\n protected async dropRemovedColumns(): Promise<void> {\n for (const metadata of this.entityToSyncMetadatas) {\n const table = this.queryRunner.loadedTables.find(table => this.getTablePath(table) === this.getTablePath(metadata));\n if (!table)\n continue;\n\n // find columns that exist in the database but does not exist in the metadata\n const droppedTableColumns = table.columns.filter(tableColumn => {\n return !metadata.columns.find(columnMetadata => columnMetadata.databaseName === tableColumn.name);\n });\n if (droppedTableColumns.length === 0)\n continue;\n\n this.connection.logger.logSchemaBuild(`columns dropped in ${table.name}: ` + droppedTableColumns.map(column => column.name).join(\", \"));\n\n // drop columns from the database\n await this.queryRunner.dropColumns(table, droppedTableColumns);\n }\n }\n\n /**\n * Adds columns from metadata which does not exist in the table.\n * Columns are created without keys.\n */\n protected async addNewColumns(): Promise<void> {\n for (const metadata of this.entityToSyncMetadatas) {\n const table = this.queryRunner.loadedTables.find(table => this.getTablePath(table) === this.getTablePath(metadata));\n if (!table)\n continue;\n\n // find which columns are new\n const newColumnMetadatas = metadata.columns.filter(columnMetadata => {\n return !table.columns.find(tableColumn => tableColumn.name === columnMetadata.databaseName);\n });\n if (newColumnMetadatas.length === 0)\n continue;\n\n // create columns in the database\n const newTableColumnOptions = this.metadataColumnsToTableColumnOptions(newColumnMetadatas);\n const newTableColumns = newTableColumnOptions.map(option => new TableColumn(option));\n\n if (newTableColumns.length === 0)\n continue;\n\n this.connection.logger.logSchemaBuild(`new columns added: ` + newColumnMetadatas.map(column => column.databaseName).join(\", \"));\n await this.queryRunner.addColumns(table, newTableColumns);\n }\n }\n\n /**\n * Updates composite primary keys.\n */\n protected async updatePrimaryKeys(): Promise<void> {\n for (const metadata of this.entityToSyncMetadatas) {\n const table = this.queryRunner.loadedTables.find(table => this.getTablePath(table) === this.getTablePath(metadata));\n if (!table)\n continue;\n\n const primaryMetadataColumns = metadata.columns.filter(column => column.isPrimary);\n const primaryTableColumns = table.columns.filter(column => column.isPrimary);\n if (primaryTableColumns.length !== primaryMetadataColumns.length && primaryMetadataColumns.length > 1) {\n const changedPrimaryColumns = primaryMetadataColumns.map(primaryMetadataColumn => {\n return new TableColumn(TableUtils.createTableColumnOptions(primaryMetadataColumn, this.connection.driver));\n });\n await this.queryRunner.updatePrimaryKeys(table, changedPrimaryColumns);\n }\n }\n }\n\n /**\n * Update all exist columns which metadata has changed.\n * Still don't create keys. Also we don't touch foreign keys of the changed columns.\n */\n protected async updateExistColumns(): Promise<void> {\n for (const metadata of this.entityToSyncMetadatas) {\n const table = this.queryRunner.loadedTables.find(table => this.getTablePath(table) === this.getTablePath(metadata));\n if (!table)\n continue;\n\n const changedColumns = this.connection.driver.findChangedColumns(table.columns, metadata.columns);\n if (changedColumns.length === 0)\n continue;\n\n // drop all foreign keys that point to this column\n for (const changedColumn of changedColumns) {\n await this.dropColumnReferencedForeignKeys(this.getTablePath(metadata), changedColumn.databaseName);\n }\n\n // drop all composite indices related to this column\n for (const changedColumn of changedColumns) {\n await this.dropColumnCompositeIndices(this.getTablePath(metadata), changedColumn.databaseName);\n }\n\n // drop all composite uniques related to this column\n // Mysql does not support unique constraints.\n if (!(this.connection.driver instanceof MysqlDriver || this.connection.driver instanceof AuroraDataApiDriver)) {\n for (const changedColumn of changedColumns) {\n await this.dropColumnCompositeUniques(this.getTablePath(metadata), changedColumn.databaseName);\n }\n }\n\n // generate a map of new/old columns\n const newAndOldTableColumns = changedColumns.map(changedColumn => {\n const oldTableColumn = table.columns.find(column => column.name === changedColumn.databaseName)!;\n const newTableColumnOptions = TableUtils.createTableColumnOptions(changedColumn, this.connection.driver);\n const newTableColumn = new TableColumn(newTableColumnOptions);\n\n return {\n oldColumn: oldTableColumn,\n newColumn: newTableColumn\n };\n });\n\n if (newAndOldTableColumns.length === 0)\n continue;\n\n this.connection.logger.logSchemaBuild(`columns changed in \"${table.name}\". updating: ` + changedColumns.map(column => column.databaseName).join(\", \"));\n await this.queryRunner.changeColumns(table, newAndOldTableColumns);\n }\n }\n\n /**\n * Creates composite indices which are missing in db yet.\n */\n protected async createNewIndices(): Promise<void> {\n for (const metadata of this.entityToSyncMetadatas) {\n const table = this.queryRunner.loadedTables.find(table => this.getTablePath(table) === this.getTablePath(metadata));\n if (!table)\n continue;\n\n const newIndices = metadata.indices\n .filter(indexMetadata => !table.indices.find(tableIndex => tableIndex.name === indexMetadata.name) && indexMetadata.synchronize === true)\n .map(indexMetadata => TableIndex.create(indexMetadata));\n\n if (newIndices.length === 0)\n continue;\n\n this.connection.logger.logSchemaBuild(`adding new indices ${newIndices.map(index => `\"${index.name}\"`).join(\", \")} in table \"${table.name}\"`);\n await this.queryRunner.createIndices(table, newIndices);\n }\n }\n\n protected async createNewChecks(): Promise<void> {\n // Mysql does not support check constraints\n if (this.connection.driver instanceof MysqlDriver || this.connection.driver instanceof AuroraDataApiDriver)\n return;\n\n for (const metadata of this.entityToSyncMetadatas) {\n const table = this.queryRunner.loadedTables.find(table => this.getTablePath(table) === this.getTablePath(metadata));\n if (!table)\n continue;\n\n const newChecks = metadata.checks\n .filter(checkMetadata => !table.checks.find(tableCheck => tableCheck.name === checkMetadata.name))\n .map(checkMetadata => TableCheck.create(checkMetadata));\n\n if (newChecks.length === 0)\n continue;\n\n this.connection.logger.logSchemaBuild(`adding new check constraints: ${newChecks.map(index => `\"${index.name}\"`).join(\", \")} in table \"${table.name}\"`);\n await this.queryRunner.createCheckConstraints(table, newChecks);\n }\n }\n\n /**\n * Creates composite uniques which are missing in db yet.\n */\n protected async createCompositeUniqueConstraints(): Promise<void> {\n for (const metadata of this.entityToSyncMetadatas) {\n const table = this.queryRunner.loadedTables.find(table => this.getTablePath(table) === this.getTablePath(metadata));\n if (!table)\n continue;\n\n const compositeUniques = metadata.uniques\n .filter(uniqueMetadata => uniqueMetadata.columns.length > 1 && !table.uniques.find(tableUnique => tableUnique.name === uniqueMetadata.name))\n .map(uniqueMetadata => TableUnique.create(uniqueMetadata));\n\n if (compositeUniques.length === 0)\n continue;\n\n this.connection.logger.logSchemaBuild(`adding new unique constraints: ${compositeUniques.map(unique => `\"${unique.name}\"`).join(\", \")} in table \"${table.name}\"`);\n await this.queryRunner.createUniqueConstraints(table, compositeUniques);\n }\n }\n\n /**\n * Creates exclusions which are missing in db yet.\n */\n protected async createNewExclusions(): Promise<void> {\n // Only PostgreSQL supports exclusion constraints\n if (!(this.connection.driver instanceof PostgresDriver))\n return;\n\n for (const metadata of this.entityToSyncMetadatas) {\n const table = this.queryRunner.loadedTables.find(table => this.getTablePath(table) === this.getTablePath(metadata));\n if (!table)\n continue;\n\n const newExclusions = metadata.exclusions\n .filter(exclusionMetadata => !table.exclusions.find(tableExclusion => tableExclusion.name === exclusionMetadata.name))\n .map(exclusionMetadata => TableExclusion.create(exclusionMetadata));\n\n if (newExclusions.length === 0)\n continue;\n\n this.connection.logger.logSchemaBuild(`adding new exclusion constraints: ${newExclusions.map(exclusion => `\"${exclusion.name}\"`).join(\", \")} in table \"${table.name}\"`);\n await this.queryRunner.createExclusionConstraints(table, newExclusions);\n }\n }\n\n /**\n * Creates foreign keys which does not exist in the table yet.\n */\n protected async createForeignKeys(): Promise<void> {\n for (const metadata of this.entityToSyncMetadatas) {\n const table = this.queryRunner.loadedTables.find(table => this.getTablePath(table) === this.getTablePath(metadata));\n if (!table)\n continue;\n\n const newKeys = metadata.foreignKeys\n .filter(foreignKey => {\n return !table.foreignKeys.find(dbForeignKey => (\n (dbForeignKey.name === foreignKey.name) &&\n (this.getTablePath(dbForeignKey) === this.getTablePath(foreignKey.referencedEntityMetadata))\n ));\n });\n if (newKeys.length === 0)\n continue;\n\n const dbForeignKeys = newKeys.map(foreignKeyMetadata => TableForeignKey.create(foreignKeyMetadata, this.connection.driver));\n this.connection.logger.logSchemaBuild(`creating a foreign keys: ${newKeys.map(key => key.name).join(\", \")} on table \"${table.name}\"`);\n await this.queryRunner.createForeignKeys(table, dbForeignKeys);\n }\n }\n\n /**\n * Drops all foreign keys where given column of the given table is being used.\n */\n protected async dropColumnReferencedForeignKeys(tablePath: string, columnName: string): Promise<void> {\n const table = this.queryRunner.loadedTables.find(table => this.getTablePath(table) === tablePath);\n if (!table)\n return;\n\n const tablesWithFK: Table[] = [];\n const columnForeignKey = table.foreignKeys.find(foreignKey => foreignKey.columnNames.indexOf(columnName) !== -1);\n if (columnForeignKey) {\n const clonedTable = table.clone();\n clonedTable.foreignKeys = [columnForeignKey];\n tablesWithFK.push(clonedTable);\n table.removeForeignKey(columnForeignKey);\n }\n\n for (const loadedTable of this.queryRunner.loadedTables) {\n const dependForeignKeys = loadedTable.foreignKeys.filter(foreignKey => {\n return this.getTablePath(foreignKey) === tablePath && foreignKey.referencedColumnNames.indexOf(columnName) !== -1;\n });\n\n if (dependForeignKeys.length > 0) {\n const clonedTable = loadedTable.clone();\n clonedTable.foreignKeys = dependForeignKeys;\n tablesWithFK.push(clonedTable);\n dependForeignKeys.forEach(dependForeignKey => loadedTable.removeForeignKey(dependForeignKey));\n }\n }\n\n if (tablesWithFK.length > 0) {\n for (const tableWithFK of tablesWithFK) {\n this.connection.logger.logSchemaBuild(`dropping related foreign keys of ${tableWithFK.name}: ${tableWithFK.foreignKeys.map(foreignKey => foreignKey.name).join(\", \")}`);\n await this.queryRunner.dropForeignKeys(tableWithFK, tableWithFK.foreignKeys);\n }\n }\n }\n\n /**\n * Drops all composite indices, related to given column.\n */\n protected async dropColumnCompositeIndices(tablePath: string, columnName: string): Promise<void> {\n const table = this.queryRunner.loadedTables.find(table => this.getTablePath(table) === tablePath);\n if (!table)\n return;\n\n const relatedIndices = table.indices.filter(index => index.columnNames.length > 1 && index.columnNames.indexOf(columnName) !== -1);\n if (relatedIndices.length === 0)\n return;\n\n this.connection.logger.logSchemaBuild(`dropping related indices of \"${tablePath}\".\"${columnName}\": ${relatedIndices.map(index => index.name).join(\", \")}`);\n await this.queryRunner.dropIndices(table, relatedIndices);\n }\n\n /**\n * Drops all composite uniques, related to given column.\n */\n protected async dropColumnCompositeUniques(tablePath: string, columnName: string): Promise<void> {\n const table = this.queryRunner.loadedTables.find(table => this.getTablePath(table) === tablePath);\n if (!table)\n return;\n\n const relatedUniques = table.uniques.filter(unique => unique.columnNames.length > 1 && unique.columnNames.indexOf(columnName) !== -1);\n if (relatedUniques.length === 0)\n return;\n\n this.connection.logger.logSchemaBuild(`dropping related unique constraints of \"${tablePath}\".\"${columnName}\": ${relatedUniques.map(unique => unique.name).join(\", \")}`);\n await this.queryRunner.dropUniqueConstraints(table, relatedUniques);\n }\n\n /**\n * Creates new columns from the given column metadatas.\n */\n protected metadataColumnsToTableColumnOptions(columns: ColumnMetadata[]): TableColumnOptions[] {\n return columns.map(columnMetadata => TableUtils.createTableColumnOptions(columnMetadata, this.connection.driver));\n }\n\n /**\n * Creates typeorm service table for storing user defined Views.\n */\n protected async createTypeormMetadataTable(queryRunner: QueryRunner) {\n const schema = this.currentSchema;\n const database = this.currentDatabase;\n const typeormMetadataTable = this.connection.driver.buildTableName(this.connection.metadataTableName, schema, database);\n\n await queryRunner.createTable(new Table(\n {\n database: database,\n schema: schema,\n name: typeormMetadataTable,\n columns: [\n {\n name: \"type\",\n type: this.connection.driver.normalizeType({type: this.connection.driver.mappedDataTypes.metadataType}),\n isNullable: false\n },\n {\n name: \"database\",\n type: this.connection.driver.normalizeType({type: this.connection.driver.mappedDataTypes.metadataDatabase}),\n isNullable: true\n },\n {\n name: \"schema\",\n type: this.connection.driver.normalizeType({type: this.connection.driver.mappedDataTypes.metadataSchema}),\n isNullable: true\n },\n {\n name: \"table\",\n type: this.connection.driver.normalizeType({type: this.connection.driver.mappedDataTypes.metadataTable}),\n isNullable: true\n },\n {\n name: \"name\",\n type: this.connection.driver.normalizeType({type: this.connection.driver.mappedDataTypes.metadataName}),\n isNullable: true\n },\n {\n name: \"value\",\n type: this.connection.driver.normalizeType({type: this.connection.driver.mappedDataTypes.metadataValue}),\n isNullable: true\n },\n ]\n },\n ), true);\n }\n}\n"],"sourceRoot":".."}
@@ -15,4 +15,8 @@ export declare class CommandUtils {
15
15
  */
16
16
  static readFile(filePath: string): Promise<string>;
17
17
  static fileExists(filePath: string): Promise<boolean>;
18
+ /**
19
+ * Gets migration timestamp and validates argument (if sent)
20
+ */
21
+ static getTimestamp(timestampOptionArgument: any): number;
18
22
  }
@@ -5,6 +5,7 @@ var tslib_1 = require("tslib");
5
5
  var fs = (0, tslib_1.__importStar)(require("fs"));
6
6
  var path = (0, tslib_1.__importStar)(require("path"));
7
7
  var mkdirp_1 = (0, tslib_1.__importDefault)(require("mkdirp"));
8
+ var error_1 = require("../error");
8
9
  /**
9
10
  * Command line utils functions.
10
11
  */
@@ -56,6 +57,15 @@ var CommandUtils = /** @class */ (function () {
56
57
  });
57
58
  });
58
59
  };
60
+ /**
61
+ * Gets migration timestamp and validates argument (if sent)
62
+ */
63
+ CommandUtils.getTimestamp = function (timestampOptionArgument) {
64
+ if (timestampOptionArgument && (isNaN(timestampOptionArgument) || timestampOptionArgument < 0)) {
65
+ throw new error_1.TypeORMError("timestamp option should be a non-negative number. received: " + timestampOptionArgument);
66
+ }
67
+ return timestampOptionArgument ? new Date(Number(timestampOptionArgument)).getTime() : Date.now();
68
+ };
59
69
  return CommandUtils;
60
70
  }());
61
71
  exports.CommandUtils = CommandUtils;