typeorm 0.2.39-dev.503d1dc → 0.2.39-dev.bc55836

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 (154) hide show
  1. package/README.md +37 -36
  2. package/browser/connection/ConnectionOptionsReader.js +2 -1
  3. package/browser/connection/ConnectionOptionsReader.js.map +1 -1
  4. package/browser/decorator/entity-view/ViewEntity.js +1 -0
  5. package/browser/decorator/entity-view/ViewEntity.js.map +1 -1
  6. package/browser/decorator/options/ViewEntityOptions.d.ts +5 -0
  7. package/browser/decorator/options/ViewEntityOptions.js.map +1 -1
  8. package/browser/driver/aurora-data-api/AuroraDataApiConnectionOptions.d.ts +5 -0
  9. package/browser/driver/aurora-data-api/AuroraDataApiConnectionOptions.js.map +1 -1
  10. package/browser/driver/aurora-data-api/AuroraDataApiDriver.js +6 -5
  11. package/browser/driver/aurora-data-api/AuroraDataApiDriver.js.map +1 -1
  12. package/browser/driver/aurora-data-api-pg/AuroraDataApiPostgresConnectionOptions.d.ts +5 -0
  13. package/browser/driver/aurora-data-api-pg/AuroraDataApiPostgresConnectionOptions.js.map +1 -1
  14. package/browser/driver/aurora-data-api-pg/AuroraDataApiPostgresDriver.js +2 -1
  15. package/browser/driver/aurora-data-api-pg/AuroraDataApiPostgresDriver.js.map +1 -1
  16. package/browser/driver/better-sqlite3/BetterSqlite3ConnectionOptions.d.ts +5 -0
  17. package/browser/driver/better-sqlite3/BetterSqlite3ConnectionOptions.js.map +1 -1
  18. package/browser/driver/better-sqlite3/BetterSqlite3Driver.js +4 -3
  19. package/browser/driver/better-sqlite3/BetterSqlite3Driver.js.map +1 -1
  20. package/browser/driver/cockroachdb/CockroachConnectionOptions.d.ts +10 -0
  21. package/browser/driver/cockroachdb/CockroachConnectionOptions.js.map +1 -1
  22. package/browser/driver/cockroachdb/CockroachDriver.js +4 -3
  23. package/browser/driver/cockroachdb/CockroachDriver.js.map +1 -1
  24. package/browser/driver/cordova/CordovaConnectionOptions.d.ts +5 -0
  25. package/browser/driver/cordova/CordovaConnectionOptions.js.map +1 -1
  26. package/browser/driver/cordova/CordovaDriver.js +2 -1
  27. package/browser/driver/cordova/CordovaDriver.js.map +1 -1
  28. package/browser/driver/mongodb/MongoConnectionOptions.d.ts +5 -0
  29. package/browser/driver/mongodb/MongoConnectionOptions.js.map +1 -1
  30. package/browser/driver/mongodb/MongoDriver.js +2 -1
  31. package/browser/driver/mongodb/MongoDriver.js.map +1 -1
  32. package/browser/driver/mysql/MysqlConnectionOptions.d.ts +6 -0
  33. package/browser/driver/mysql/MysqlConnectionOptions.js.map +1 -1
  34. package/browser/driver/mysql/MysqlDriver.js +4 -2
  35. package/browser/driver/mysql/MysqlDriver.js.map +1 -1
  36. package/browser/driver/oracle/OracleConnectionOptions.d.ts +5 -0
  37. package/browser/driver/oracle/OracleConnectionOptions.js.map +1 -1
  38. package/browser/driver/oracle/OracleDriver.js +5 -4
  39. package/browser/driver/oracle/OracleDriver.js.map +1 -1
  40. package/browser/driver/postgres/PostgresConnectionOptions.d.ts +10 -0
  41. package/browser/driver/postgres/PostgresConnectionOptions.js.map +1 -1
  42. package/browser/driver/postgres/PostgresDriver.js +5 -4
  43. package/browser/driver/postgres/PostgresDriver.js.map +1 -1
  44. package/browser/driver/react-native/ReactNativeConnectionOptions.d.ts +5 -0
  45. package/browser/driver/react-native/ReactNativeConnectionOptions.js.map +1 -1
  46. package/browser/driver/react-native/ReactNativeDriver.js +2 -1
  47. package/browser/driver/react-native/ReactNativeDriver.js.map +1 -1
  48. package/browser/driver/sap/SapConnectionOptions.d.ts +16 -6
  49. package/browser/driver/sap/SapConnectionOptions.js.map +1 -1
  50. package/browser/driver/sap/SapDriver.js +6 -3
  51. package/browser/driver/sap/SapDriver.js.map +1 -1
  52. package/browser/driver/sqlite/SqliteConnectionOptions.d.ts +5 -0
  53. package/browser/driver/sqlite/SqliteConnectionOptions.js.map +1 -1
  54. package/browser/driver/sqlite/SqliteDriver.js +4 -3
  55. package/browser/driver/sqlite/SqliteDriver.js.map +1 -1
  56. package/browser/driver/sqljs/SqljsConnectionOptions.d.ts +5 -0
  57. package/browser/driver/sqljs/SqljsConnectionOptions.js.map +1 -1
  58. package/browser/driver/sqljs/SqljsDriver.js +4 -2
  59. package/browser/driver/sqljs/SqljsDriver.js.map +1 -1
  60. package/browser/driver/sqlserver/SqlServerConnectionOptions.d.ts +5 -0
  61. package/browser/driver/sqlserver/SqlServerConnectionOptions.js.map +1 -1
  62. package/browser/driver/sqlserver/SqlServerDriver.js +7 -6
  63. package/browser/driver/sqlserver/SqlServerDriver.js.map +1 -1
  64. package/browser/metadata/EntityMetadata.d.ts +5 -0
  65. package/browser/metadata/EntityMetadata.js +1 -0
  66. package/browser/metadata/EntityMetadata.js.map +1 -1
  67. package/browser/metadata-args/TableMetadataArgs.d.ts +4 -0
  68. package/browser/metadata-args/TableMetadataArgs.js.map +1 -1
  69. package/browser/query-builder/SelectQueryBuilder.js +5 -1
  70. package/browser/query-builder/SelectQueryBuilder.js.map +1 -1
  71. package/browser/query-builder/transformer/RawSqlResultsToEntityTransformer.js +2 -8
  72. package/browser/query-builder/transformer/RawSqlResultsToEntityTransformer.js.map +1 -1
  73. package/browser/schema-builder/RdbmsSchemaBuilder.js +223 -148
  74. package/browser/schema-builder/RdbmsSchemaBuilder.js.map +1 -1
  75. package/browser/schema-builder/util/ViewUtils.d.ts +7 -0
  76. package/browser/schema-builder/util/ViewUtils.js +25 -0
  77. package/browser/schema-builder/util/ViewUtils.js.map +1 -0
  78. package/connection/ConnectionOptionsReader.js +2 -1
  79. package/connection/ConnectionOptionsReader.js.map +1 -1
  80. package/decorator/entity-view/ViewEntity.js +1 -0
  81. package/decorator/entity-view/ViewEntity.js.map +1 -1
  82. package/decorator/options/ViewEntityOptions.d.ts +5 -0
  83. package/decorator/options/ViewEntityOptions.js.map +1 -1
  84. package/driver/aurora-data-api/AuroraDataApiConnectionOptions.d.ts +5 -0
  85. package/driver/aurora-data-api/AuroraDataApiConnectionOptions.js.map +1 -1
  86. package/driver/aurora-data-api/AuroraDataApiDriver.js +6 -5
  87. package/driver/aurora-data-api/AuroraDataApiDriver.js.map +1 -1
  88. package/driver/aurora-data-api-pg/AuroraDataApiPostgresConnectionOptions.d.ts +5 -0
  89. package/driver/aurora-data-api-pg/AuroraDataApiPostgresConnectionOptions.js.map +1 -1
  90. package/driver/aurora-data-api-pg/AuroraDataApiPostgresDriver.js +2 -1
  91. package/driver/aurora-data-api-pg/AuroraDataApiPostgresDriver.js.map +1 -1
  92. package/driver/better-sqlite3/BetterSqlite3ConnectionOptions.d.ts +5 -0
  93. package/driver/better-sqlite3/BetterSqlite3ConnectionOptions.js.map +1 -1
  94. package/driver/better-sqlite3/BetterSqlite3Driver.js +2 -1
  95. package/driver/better-sqlite3/BetterSqlite3Driver.js.map +1 -1
  96. package/driver/cockroachdb/CockroachConnectionOptions.d.ts +10 -0
  97. package/driver/cockroachdb/CockroachConnectionOptions.js.map +1 -1
  98. package/driver/cockroachdb/CockroachDriver.js +4 -3
  99. package/driver/cockroachdb/CockroachDriver.js.map +1 -1
  100. package/driver/cordova/CordovaConnectionOptions.d.ts +5 -0
  101. package/driver/cordova/CordovaConnectionOptions.js.map +1 -1
  102. package/driver/cordova/CordovaDriver.js +2 -1
  103. package/driver/cordova/CordovaDriver.js.map +1 -1
  104. package/driver/mongodb/MongoConnectionOptions.d.ts +5 -0
  105. package/driver/mongodb/MongoConnectionOptions.js.map +1 -1
  106. package/driver/mongodb/MongoDriver.js +2 -1
  107. package/driver/mongodb/MongoDriver.js.map +1 -1
  108. package/driver/mysql/MysqlConnectionOptions.d.ts +6 -0
  109. package/driver/mysql/MysqlConnectionOptions.js.map +1 -1
  110. package/driver/mysql/MysqlDriver.js +4 -2
  111. package/driver/mysql/MysqlDriver.js.map +1 -1
  112. package/driver/oracle/OracleConnectionOptions.d.ts +5 -0
  113. package/driver/oracle/OracleConnectionOptions.js.map +1 -1
  114. package/driver/oracle/OracleDriver.js +5 -4
  115. package/driver/oracle/OracleDriver.js.map +1 -1
  116. package/driver/postgres/PostgresConnectionOptions.d.ts +10 -0
  117. package/driver/postgres/PostgresConnectionOptions.js.map +1 -1
  118. package/driver/postgres/PostgresDriver.js +5 -4
  119. package/driver/postgres/PostgresDriver.js.map +1 -1
  120. package/driver/react-native/ReactNativeConnectionOptions.d.ts +5 -0
  121. package/driver/react-native/ReactNativeConnectionOptions.js.map +1 -1
  122. package/driver/react-native/ReactNativeDriver.js +2 -1
  123. package/driver/react-native/ReactNativeDriver.js.map +1 -1
  124. package/driver/sap/SapConnectionOptions.d.ts +16 -6
  125. package/driver/sap/SapConnectionOptions.js.map +1 -1
  126. package/driver/sap/SapDriver.js +6 -3
  127. package/driver/sap/SapDriver.js.map +1 -1
  128. package/driver/sqlite/SqliteConnectionOptions.d.ts +5 -0
  129. package/driver/sqlite/SqliteConnectionOptions.js.map +1 -1
  130. package/driver/sqlite/SqliteDriver.js +2 -1
  131. package/driver/sqlite/SqliteDriver.js.map +1 -1
  132. package/driver/sqljs/SqljsConnectionOptions.d.ts +5 -0
  133. package/driver/sqljs/SqljsConnectionOptions.js.map +1 -1
  134. package/driver/sqljs/SqljsDriver.js +4 -2
  135. package/driver/sqljs/SqljsDriver.js.map +1 -1
  136. package/driver/sqlserver/SqlServerConnectionOptions.d.ts +5 -0
  137. package/driver/sqlserver/SqlServerConnectionOptions.js.map +1 -1
  138. package/driver/sqlserver/SqlServerDriver.js +7 -6
  139. package/driver/sqlserver/SqlServerDriver.js.map +1 -1
  140. package/metadata/EntityMetadata.d.ts +5 -0
  141. package/metadata/EntityMetadata.js +1 -0
  142. package/metadata/EntityMetadata.js.map +1 -1
  143. package/metadata-args/TableMetadataArgs.d.ts +4 -0
  144. package/metadata-args/TableMetadataArgs.js.map +1 -1
  145. package/package.json +1 -1
  146. package/query-builder/SelectQueryBuilder.js +5 -1
  147. package/query-builder/SelectQueryBuilder.js.map +1 -1
  148. package/query-builder/transformer/RawSqlResultsToEntityTransformer.js +2 -8
  149. package/query-builder/transformer/RawSqlResultsToEntityTransformer.js.map +1 -1
  150. package/schema-builder/RdbmsSchemaBuilder.js +222 -147
  151. package/schema-builder/RdbmsSchemaBuilder.js.map +1 -1
  152. package/schema-builder/util/ViewUtils.d.ts +7 -0
  153. package/schema-builder/util/ViewUtils.js +28 -0
  154. package/schema-builder/util/ViewUtils.js.map +1 -0
@@ -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,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,IAA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wCACI,IAAI,EAAE,QAAQ;wCACd,IAAI,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;IAEL,yBAAC;AAAD,CA1wBA,AA0wBC,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 {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 if (this.viewEntityToSyncMetadatas.length > 0) {\n await this.createTypeormMetadataTable();\n }\n\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 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 * Returns sql queries to be executed by schema builder.\n */\n async log(): Promise<SqlInMemory> {\n this.queryRunner = this.connection.createQueryRunner();\n try {\n\n // TODO: typeorm_metadata table needs only for Views for now.\n // Remove condition or add new conditions if necessary (for CHECK constraints for example).\n if (this.viewEntityToSyncMetadatas.length > 0) {\n await this.createTypeormMetadataTable();\n }\n\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.filter(metadata => metadata.tableType === \"view\" && metadata.synchronize);\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: Set<View> = new Set();\n for (const view of this.queryRunner.loadedViews) {\n const existViewMetadata = this.viewEntityToSyncMetadatas.find(metadata => {\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\n if (existViewMetadata)\n continue;\n\n this.connection.logger.logSchemaBuild(`dropping an old view: ${view.name}`);\n\n // drop an old view\n await this.queryRunner.dropView(view);\n droppedViews.add(view);\n }\n this.queryRunner.loadedViews = this.queryRunner.loadedViews.filter(view => !droppedViews.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() {\n const schema = this.currentSchema;\n const database = this.currentDatabase;\n const typeormMetadataTable = this.connection.driver.buildTableName(\"typeorm_metadata\", schema, database);\n\n await this.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}\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,yBAA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cesContent":["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 if (this.viewEntityToSyncMetadatas.length > 0) {\n await this.createTypeormMetadataTable();\n }\n\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 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 * Returns sql queries to be executed by schema builder.\n */\n async log(): Promise<SqlInMemory> {\n this.queryRunner = this.connection.createQueryRunner();\n try {\n\n // TODO: typeorm_metadata table needs only for Views for now.\n // Remove condition or add new conditions if necessary (for CHECK constraints for example).\n if (this.viewEntityToSyncMetadatas.length > 0) {\n await this.createTypeormMetadataTable();\n }\n\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() {\n const schema = this.currentSchema;\n const database = this.currentDatabase;\n const typeormMetadataTable = this.connection.driver.buildTableName(\"typeorm_metadata\", schema, database);\n\n await this.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}\n"],"sourceRoot":".."}
@@ -0,0 +1,7 @@
1
+ import { EntityMetadata } from "../../metadata/EntityMetadata";
2
+ export declare class ViewUtils {
3
+ /**
4
+ * Comparator for .sort() that will order views bases on dependencies in creation order
5
+ */
6
+ static viewMetadataCmp(metadataA: EntityMetadata | undefined, metadataB: EntityMetadata | undefined): number;
7
+ }
@@ -0,0 +1,25 @@
1
+ var ViewUtils = /** @class */ (function () {
2
+ function ViewUtils() {
3
+ }
4
+ /**
5
+ * Comparator for .sort() that will order views bases on dependencies in creation order
6
+ */
7
+ ViewUtils.viewMetadataCmp = function (metadataA, metadataB) {
8
+ if (!metadataA || !metadataB) {
9
+ return 0;
10
+ }
11
+ if (metadataA.dependsOn && (metadataA.dependsOn.has(metadataB.target) ||
12
+ metadataA.dependsOn.has(metadataB.name))) {
13
+ return 1;
14
+ }
15
+ if (metadataB.dependsOn && (metadataB.dependsOn.has(metadataA.target) ||
16
+ metadataB.dependsOn.has(metadataA.name))) {
17
+ return -1;
18
+ }
19
+ return 0;
20
+ };
21
+ return ViewUtils;
22
+ }());
23
+ export { ViewUtils };
24
+
25
+ //# sourceMappingURL=ViewUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../browser/src/schema-builder/util/ViewUtils.ts"],"names":[],"mappings":"AAEA;IAAA;IAwBA,CAAC;IAtBG;;OAEG;IACI,yBAAe,GAAtB,UAAuB,SAAqC,EAAE,SAAoC;QAChG,IAAG,CAAC,SAAS,IAAI,CAAC,SAAS,EAAC;YAC1B,OAAO,CAAC,CAAC;SACV;QACD,IAAG,SAAS,CAAC,SAAS,IAAI,CACxB,SAAS,CAAC,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC,MAAM,CAAC;YACzC,SAAS,CAAC,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,CACxC,EAAE;YACC,OAAO,CAAC,CAAC;SACZ;QACD,IAAG,SAAS,CAAC,SAAS,IAAI,CACtB,SAAS,CAAC,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC,MAAM,CAAC;YACzC,SAAS,CAAC,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,CAC1C,EAAC;YACE,OAAO,CAAC,CAAC,CAAC;SACb;QACD,OAAO,CAAC,CAAC;IACb,CAAC;IAEH,gBAAC;AAAD,CAxBA,AAwBC,IAAA","file":"ViewUtils.js","sourcesContent":["import { EntityMetadata } from \"../../metadata/EntityMetadata\";\n\nexport class ViewUtils {\n\n /**\n * Comparator for .sort() that will order views bases on dependencies in creation order\n */\n static viewMetadataCmp(metadataA: EntityMetadata | undefined, metadataB: EntityMetadata| undefined): number {\n if(!metadataA || !metadataB){\n return 0;\n }\n if(metadataA.dependsOn && (\n metadataA.dependsOn.has(metadataB.target) ||\n metadataA.dependsOn.has(metadataB.name)\n )) {\n return 1;\n }\n if(metadataB.dependsOn && (\n metadataB.dependsOn.has(metadataA.target) ||\n metadataB.dependsOn.has(metadataA.name)\n )){\n return -1;\n }\n return 0;\n }\n\n}\n"],"sourceRoot":"../.."}
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ConnectionOptionsReader = void 0;
4
4
  var tslib_1 = require("tslib");
5
5
  var app_root_path_1 = (0, tslib_1.__importDefault)(require("app-root-path"));
6
+ var path_1 = (0, tslib_1.__importDefault)(require("path"));
6
7
  var PlatformTools_1 = require("../platform/PlatformTools");
7
8
  var ConnectionOptionsEnvReader_1 = require("./options-reader/ConnectionOptionsEnvReader");
8
9
  var ConnectionOptionsYmlReader_1 = require("./options-reader/ConnectionOptionsYmlReader");
@@ -209,7 +210,7 @@ var ConnectionOptionsReader = /** @class */ (function () {
209
210
  * Gets directory where configuration file should be located and configuration file name.
210
211
  */
211
212
  get: function () {
212
- return this.baseDirectory + "/" + this.baseConfigName;
213
+ return path_1.default.resolve(this.baseDirectory, this.baseConfigName);
213
214
  },
214
215
  enumerable: false,
215
216
  configurable: true
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/connection/ConnectionOptionsReader.ts"],"names":[],"mappings":";;;;AAAA,6EAAwC;AAExC,2DAAwD;AACxD,0FAAuF;AACvF,0FAAuF;AACvF,0F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,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,UAAU;gBACvC,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC;YAEnC,OAAO,WAAW,CAAC;QACvB,CAAC;;;OAAA;IAEL,8BAAC;AAAD,CA9MA,AA8MC,IAAA;AA9MY,0DAAuB","file":"ConnectionOptionsReader.js","sourcesContent":["import appRootPath from \"app-root-path\";\nimport {ConnectionOptions} from \"./ConnectionOptions\";\nimport {PlatformTools} from \"../platform/PlatformTools\";\nimport {ConnectionOptionsEnvReader} from \"./options-reader/ConnectionOptionsEnvReader\";\nimport {ConnectionOptionsYmlReader} from \"./options-reader/ConnectionOptionsYmlReader\";\nimport {ConnectionOptionsXmlReader} from \"./options-reader/ConnectionOptionsXmlReader\";\nimport { TypeORMError } from \"../error\";\n\n/**\n * Reads connection options from the ormconfig.\n * Can read from multiple file extensions including env, json, js, xml and yml.\n */\nexport class ConnectionOptionsReader {\n\n // -------------------------------------------------------------------------\n // Constructor\n // -------------------------------------------------------------------------\n\n constructor(protected options?: {\n /**\n * Directory where ormconfig should be read from.\n * By default its your application root (where your app package.json is located).\n */\n root?: string,\n\n /**\n * Filename of the ormconfig configuration. By default its equal to \"ormconfig\".\n */\n configName?: string\n }) {\n }\n\n // -------------------------------------------------------------------------\n // Public Methods\n // -------------------------------------------------------------------------\n\n /**\n * Returns all connection options read from the ormconfig.\n */\n async all(): Promise<ConnectionOptions[]> {\n const options = await this.load();\n if (!options)\n throw new TypeORMError(`No connection options were found in any orm configuration files.`);\n\n return options;\n }\n\n /**\n * Gets a connection with a given name read from ormconfig.\n * If connection with such name would not be found then it throw error.\n */\n async get(name: string): Promise<ConnectionOptions> {\n const allOptions = await this.all();\n const targetOptions = allOptions.find(options => options.name === name || (name === \"default\" && !options.name));\n if (!targetOptions)\n throw new TypeORMError(`Cannot find connection ${name} because its not defined in any orm configuration files.`);\n\n return targetOptions;\n }\n\n /**\n * Checks if there is a TypeORM configuration file.\n */\n async has(name: string): Promise<boolean> {\n const allOptions = await this.load();\n if (!allOptions)\n return false;\n\n const targetOptions = allOptions.find(options => options.name === name || (name === \"default\" && !options.name));\n return !!targetOptions;\n }\n\n // -------------------------------------------------------------------------\n // Protected Methods\n // -------------------------------------------------------------------------\n\n /**\n * Loads all connection options from a configuration file.\n *\n * todo: get in count NODE_ENV somehow\n */\n protected async load(): Promise<ConnectionOptions[]|undefined> {\n let connectionOptions: ConnectionOptions|ConnectionOptions[]|undefined = undefined;\n\n const fileFormats = [\"env\", \"js\", \"cjs\", \"ts\", \"json\", \"yml\", \"yaml\", \"xml\"];\n\n // Detect if baseFilePath contains file extension\n const possibleExtension = this.baseFilePath.substr(this.baseFilePath.lastIndexOf(\".\"));\n const fileExtension = fileFormats.find(extension => `.${extension}` === possibleExtension);\n\n // try to find any of following configuration formats\n const foundFileFormat = fileExtension || fileFormats.find(format => {\n return PlatformTools.fileExist(this.baseFilePath + \".\" + format);\n });\n\n // Determine config file name\n const configFile = fileExtension ? this.baseFilePath : this.baseFilePath + \".\" + foundFileFormat;\n\n // if .env file found then load all its variables into process.env using dotenv package\n if (foundFileFormat === \"env\") {\n PlatformTools.dotenv(configFile);\n } else if (PlatformTools.fileExist(this.baseDirectory + \"/.env\")) {\n PlatformTools.dotenv(this.baseDirectory + \"/.env\");\n }\n\n // try to find connection options from any of available sources of configuration\n if (PlatformTools.getEnvVariable(\"TYPEORM_CONNECTION\") || PlatformTools.getEnvVariable(\"TYPEORM_URL\")) {\n connectionOptions = await new ConnectionOptionsEnvReader().read();\n\n } else if (foundFileFormat === \"js\" || foundFileFormat === \"cjs\" || foundFileFormat === \"ts\") {\n const configModule = await require(configFile);\n\n if (configModule && \"__esModule\" in configModule && \"default\" in configModule) {\n connectionOptions = configModule.default;\n } else {\n connectionOptions = configModule;\n }\n\n } else if (foundFileFormat === \"json\") {\n connectionOptions = require(configFile);\n\n } else if (foundFileFormat === \"yml\") {\n connectionOptions = await new ConnectionOptionsYmlReader().read(configFile);\n\n } else if (foundFileFormat === \"yaml\") {\n connectionOptions = await new ConnectionOptionsYmlReader().read(configFile);\n\n } else if (foundFileFormat === \"xml\") {\n connectionOptions = await new ConnectionOptionsXmlReader().read(configFile);\n }\n\n // normalize and return connection options\n if (connectionOptions) {\n return this.normalizeConnectionOptions(connectionOptions);\n }\n\n return undefined;\n }\n\n /**\n * Normalize connection options.\n */\n protected normalizeConnectionOptions(connectionOptions: ConnectionOptions|ConnectionOptions[]): ConnectionOptions[] {\n if (!(Array.isArray(connectionOptions)))\n connectionOptions = [connectionOptions];\n\n connectionOptions.forEach(options => {\n if (options.entities) {\n const entities = (options.entities as any[]).map(entity => {\n if (typeof entity === \"string\" && entity.substr(0, 1) !== \"/\")\n return this.baseDirectory + \"/\" + entity;\n\n return entity;\n });\n Object.assign(connectionOptions, { entities: entities });\n }\n if (options.subscribers) {\n const subscribers = (options.subscribers as any[]).map(subscriber => {\n if (typeof subscriber === \"string\" && subscriber.substr(0, 1) !== \"/\")\n return this.baseDirectory + \"/\" + subscriber;\n\n return subscriber;\n });\n Object.assign(connectionOptions, { subscribers: subscribers });\n }\n if (options.migrations) {\n const migrations = (options.migrations as any[]).map(migration => {\n if (typeof migration === \"string\" && migration.substr(0, 1) !== \"/\")\n return this.baseDirectory + \"/\" + migration;\n\n return migration;\n });\n Object.assign(connectionOptions, { migrations: migrations });\n }\n\n // make database path file in sqlite relative to package.json\n if (options.type === \"sqlite\" || options.type === \"better-sqlite3\") {\n if (typeof options.database === \"string\" &&\n options.database.substr(0, 1) !== \"/\" && // unix absolute\n options.database.substr(1, 2) !== \":\\\\\" && // windows absolute\n options.database !== \":memory:\") {\n Object.assign(options, {\n database: this.baseDirectory + \"/\" + options.database\n });\n }\n }\n });\n\n return connectionOptions;\n }\n\n /**\n * Gets directory where configuration file should be located and configuration file name.\n */\n protected get baseFilePath(): string {\n return this.baseDirectory + \"/\" + this.baseConfigName;\n }\n\n /**\n * Gets directory where configuration file should be located.\n */\n protected get baseDirectory(): string {\n if (this.options && this.options.root)\n return this.options.root;\n\n return appRootPath.path;\n }\n\n /**\n * Gets configuration file name.\n */\n protected get baseConfigName(): string {\n if (this.options && this.options.configName)\n return this.options.configName;\n\n return \"ormconfig\";\n }\n\n}\n"],"sourceRoot":".."}
1
+ {"version":3,"sources":["../../src/connection/ConnectionOptionsReader.ts"],"names":[],"mappings":";;;;AAAA,6EAAwC;AACxC,2DAAwB;AAExB,2DAAwD;AACxD,0FAAuF;AACvF,0FAAuF;AACvF,0FAAuF;AACvF,kCAAwC;AAExC;;;GAGG;AACH;IAEI,4EAA4E;IAC5E,cAAc;IACd,4EAA4E;IAE5E,iCAAsB,OAWrB;QAXqB,YAAO,GAAP,OAAO,CAW5B;IACD,CAAC;IAED,4EAA4E;IAC5E,iBAAiB;IACjB,4EAA4E;IAE5E;;OAEG;IACG,qCAAG,GAAT;;;;;4BACoB,qBAAM,IAAI,CAAC,IAAI,EAAE,EAAA;;wBAA3B,OAAO,GAAG,SAAiB;wBACjC,IAAI,CAAC,OAAO;4BACR,MAAM,IAAI,oBAAY,CAAC,kEAAkE,CAAC,CAAC;wBAE/F,sBAAO,OAAO,EAAC;;;;KAClB;IAED;;;OAGG;IACG,qCAAG,GAAT,UAAU,IAAY;;;;;4BACC,qBAAM,IAAI,CAAC,GAAG,EAAE,EAAA;;wBAA7B,UAAU,GAAG,SAAgB;wBAC7B,aAAa,GAAG,UAAU,CAAC,IAAI,CAAC,UAAA,OAAO,IAAI,OAAA,OAAO,CAAC,IAAI,KAAK,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAA9D,CAA8D,CAAC,CAAC;wBACjH,IAAI,CAAC,aAAa;4BACd,MAAM,IAAI,oBAAY,CAAC,4BAA0B,IAAI,6DAA0D,CAAC,CAAC;wBAErH,sBAAO,aAAa,EAAC;;;;KACxB;IAED;;OAEG;IACG,qCAAG,GAAT,UAAU,IAAY;;;;;4BACC,qBAAM,IAAI,CAAC,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a,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QACjE,CAAC;;;OAAA;IAKD,sBAAc,kDAAa;QAH3B;;WAEG;aACH;YACI,IAAI,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI;gBACjC,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;YAE7B,OAAO,uBAAW,CAAC,IAAI,CAAC;QAC5B,CAAC;;;OAAA;IAKD,sBAAc,mDAAc;QAH5B;;WAEG;aACH;YACI,IAAI,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,UAAU;gBACvC,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC;YAEnC,OAAO,WAAW,CAAC;QACvB,CAAC;;;OAAA;IAEL,8BAAC;AAAD,CA9MA,AA8MC,IAAA;AA9MY,0DAAuB","file":"ConnectionOptionsReader.js","sourcesContent":["import appRootPath from \"app-root-path\";\nimport path from \"path\";\nimport {ConnectionOptions} from \"./ConnectionOptions\";\nimport {PlatformTools} from \"../platform/PlatformTools\";\nimport {ConnectionOptionsEnvReader} from \"./options-reader/ConnectionOptionsEnvReader\";\nimport {ConnectionOptionsYmlReader} from \"./options-reader/ConnectionOptionsYmlReader\";\nimport {ConnectionOptionsXmlReader} from \"./options-reader/ConnectionOptionsXmlReader\";\nimport { TypeORMError } from \"../error\";\n\n/**\n * Reads connection options from the ormconfig.\n * Can read from multiple file extensions including env, json, js, xml and yml.\n */\nexport class ConnectionOptionsReader {\n\n // -------------------------------------------------------------------------\n // Constructor\n // -------------------------------------------------------------------------\n\n constructor(protected options?: {\n /**\n * Directory where ormconfig should be read from.\n * By default its your application root (where your app package.json is located).\n */\n root?: string,\n\n /**\n * Filename of the ormconfig configuration. By default its equal to \"ormconfig\".\n */\n configName?: string\n }) {\n }\n\n // -------------------------------------------------------------------------\n // Public Methods\n // -------------------------------------------------------------------------\n\n /**\n * Returns all connection options read from the ormconfig.\n */\n async all(): Promise<ConnectionOptions[]> {\n const options = await this.load();\n if (!options)\n throw new TypeORMError(`No connection options were found in any orm configuration files.`);\n\n return options;\n }\n\n /**\n * Gets a connection with a given name read from ormconfig.\n * If connection with such name would not be found then it throw error.\n */\n async get(name: string): Promise<ConnectionOptions> {\n const allOptions = await this.all();\n const targetOptions = allOptions.find(options => options.name === name || (name === \"default\" && !options.name));\n if (!targetOptions)\n throw new TypeORMError(`Cannot find connection ${name} because its not defined in any orm configuration files.`);\n\n return targetOptions;\n }\n\n /**\n * Checks if there is a TypeORM configuration file.\n */\n async has(name: string): Promise<boolean> {\n const allOptions = await this.load();\n if (!allOptions)\n return false;\n\n const targetOptions = allOptions.find(options => options.name === name || (name === \"default\" && !options.name));\n return !!targetOptions;\n }\n\n // -------------------------------------------------------------------------\n // Protected Methods\n // -------------------------------------------------------------------------\n\n /**\n * Loads all connection options from a configuration file.\n *\n * todo: get in count NODE_ENV somehow\n */\n protected async load(): Promise<ConnectionOptions[]|undefined> {\n let connectionOptions: ConnectionOptions|ConnectionOptions[]|undefined = undefined;\n\n const fileFormats = [\"env\", \"js\", \"cjs\", \"ts\", \"json\", \"yml\", \"yaml\", \"xml\"];\n\n // Detect if baseFilePath contains file extension\n const possibleExtension = this.baseFilePath.substr(this.baseFilePath.lastIndexOf(\".\"));\n const fileExtension = fileFormats.find(extension => `.${extension}` === possibleExtension);\n\n // try to find any of following configuration formats\n const foundFileFormat = fileExtension || fileFormats.find(format => {\n return PlatformTools.fileExist(this.baseFilePath + \".\" + format);\n });\n\n // Determine config file name\n const configFile = fileExtension ? this.baseFilePath : this.baseFilePath + \".\" + foundFileFormat;\n\n // if .env file found then load all its variables into process.env using dotenv package\n if (foundFileFormat === \"env\") {\n PlatformTools.dotenv(configFile);\n } else if (PlatformTools.fileExist(this.baseDirectory + \"/.env\")) {\n PlatformTools.dotenv(this.baseDirectory + \"/.env\");\n }\n\n // try to find connection options from any of available sources of configuration\n if (PlatformTools.getEnvVariable(\"TYPEORM_CONNECTION\") || PlatformTools.getEnvVariable(\"TYPEORM_URL\")) {\n connectionOptions = await new ConnectionOptionsEnvReader().read();\n\n } else if (foundFileFormat === \"js\" || foundFileFormat === \"cjs\" || foundFileFormat === \"ts\") {\n const configModule = await require(configFile);\n\n if (configModule && \"__esModule\" in configModule && \"default\" in configModule) {\n connectionOptions = configModule.default;\n } else {\n connectionOptions = configModule;\n }\n\n } else if (foundFileFormat === \"json\") {\n connectionOptions = require(configFile);\n\n } else if (foundFileFormat === \"yml\") {\n connectionOptions = await new ConnectionOptionsYmlReader().read(configFile);\n\n } else if (foundFileFormat === \"yaml\") {\n connectionOptions = await new ConnectionOptionsYmlReader().read(configFile);\n\n } else if (foundFileFormat === \"xml\") {\n connectionOptions = await new ConnectionOptionsXmlReader().read(configFile);\n }\n\n // normalize and return connection options\n if (connectionOptions) {\n return this.normalizeConnectionOptions(connectionOptions);\n }\n\n return undefined;\n }\n\n /**\n * Normalize connection options.\n */\n protected normalizeConnectionOptions(connectionOptions: ConnectionOptions|ConnectionOptions[]): ConnectionOptions[] {\n if (!(Array.isArray(connectionOptions)))\n connectionOptions = [connectionOptions];\n\n connectionOptions.forEach(options => {\n if (options.entities) {\n const entities = (options.entities as any[]).map(entity => {\n if (typeof entity === \"string\" && entity.substr(0, 1) !== \"/\")\n return this.baseDirectory + \"/\" + entity;\n\n return entity;\n });\n Object.assign(connectionOptions, { entities: entities });\n }\n if (options.subscribers) {\n const subscribers = (options.subscribers as any[]).map(subscriber => {\n if (typeof subscriber === \"string\" && subscriber.substr(0, 1) !== \"/\")\n return this.baseDirectory + \"/\" + subscriber;\n\n return subscriber;\n });\n Object.assign(connectionOptions, { subscribers: subscribers });\n }\n if (options.migrations) {\n const migrations = (options.migrations as any[]).map(migration => {\n if (typeof migration === \"string\" && migration.substr(0, 1) !== \"/\")\n return this.baseDirectory + \"/\" + migration;\n\n return migration;\n });\n Object.assign(connectionOptions, { migrations: migrations });\n }\n\n // make database path file in sqlite relative to package.json\n if (options.type === \"sqlite\" || options.type === \"better-sqlite3\") {\n if (typeof options.database === \"string\" &&\n options.database.substr(0, 1) !== \"/\" && // unix absolute\n options.database.substr(1, 2) !== \":\\\\\" && // windows absolute\n options.database !== \":memory:\") {\n Object.assign(options, {\n database: this.baseDirectory + \"/\" + options.database\n });\n }\n }\n });\n\n return connectionOptions;\n }\n\n /**\n * Gets directory where configuration file should be located and configuration file name.\n */\n protected get baseFilePath(): string {\n return path.resolve(this.baseDirectory, this.baseConfigName);\n }\n\n /**\n * Gets directory where configuration file should be located.\n */\n protected get baseDirectory(): string {\n if (this.options && this.options.root)\n return this.options.root;\n\n return appRootPath.path;\n }\n\n /**\n * Gets configuration file name.\n */\n protected get baseConfigName(): string {\n if (this.options && this.options.configName)\n return this.options.configName;\n\n return \"ormconfig\";\n }\n\n}\n"],"sourceRoot":".."}
@@ -14,6 +14,7 @@ function ViewEntity(nameOrOptions, maybeOptions) {
14
14
  target: target,
15
15
  name: name,
16
16
  expression: options.expression,
17
+ dependsOn: options.dependsOn ? new Set(options.dependsOn) : undefined,
17
18
  type: "view",
18
19
  database: options.database ? options.database : undefined,
19
20
  schema: options.schema ? options.schema : undefined,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/decorator/entity-view/ViewEntity.ts"],"names":[],"mappings":";;;AAAA,yCAAqD;AAgBrD;;;GAGG;AACH,SAAgB,UAAU,CAAC,aAAwC,EAAE,YAAgC;IACjG,IAAM,OAAO,GAAG,CAAC,OAAO,aAAa,KAAK,QAAQ,CAAC,CAAC,CAAC,aAAkC,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC;IAC9G,IAAM,IAAI,GAAG,OAAO,aAAa,KAAK,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC;IAE9E,OAAO,UAAU,MAAgB;QAC7B,IAAA,gCAAsB,GAAE,CAAC,MAAM,CAAC,IAAI,CAAC;YACjC,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI;YACV,UAAU,EAAE,OAAO,CAAC,UAAU;YAC9B,IAAI,EAAE,MAAM;YACZ,QAAQ,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS;YACzD,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS;YACnD,WAAW,EAAE,OAAO,CAAC,WAAW,KAAK,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI;YACzD,YAAY,EAAE,CAAC,CAAC,OAAO,CAAC,YAAY;SAClB,CAAC,CAAC;IAC5B,CAAC,CAAC;AACN,CAAC;AAhBD,gCAgBC","file":"ViewEntity.js","sourcesContent":["import {getMetadataArgsStorage} from \"../../globals\";\nimport {TableMetadataArgs} from \"../../metadata-args/TableMetadataArgs\";\nimport {ViewEntityOptions} from \"../options/ViewEntityOptions\";\n\n/**\n * This decorator is used to mark classes that will be an entity view.\n * Database schema will be created for all classes decorated with it, and Repository can be retrieved and used for it.\n */\nexport function ViewEntity(options?: ViewEntityOptions): ClassDecorator;\n\n/**\n * This decorator is used to mark classes that will be an entity view.\n * Database schema will be created for all classes decorated with it, and Repository can be retrieved and used for it.\n */\nexport function ViewEntity(name?: string, options?: ViewEntityOptions): ClassDecorator;\n\n/**\n * This decorator is used to mark classes that will be an entity view.\n * Database schema will be created for all classes decorated with it, and Repository can be retrieved and used for it.\n */\nexport function ViewEntity(nameOrOptions?: string|ViewEntityOptions, maybeOptions?: ViewEntityOptions): ClassDecorator {\n const options = (typeof nameOrOptions === \"object\" ? nameOrOptions as ViewEntityOptions : maybeOptions) || {};\n const name = typeof nameOrOptions === \"string\" ? nameOrOptions : options.name;\n\n return function (target: Function) {\n getMetadataArgsStorage().tables.push({\n target: target,\n name: name,\n expression: options.expression,\n type: \"view\",\n database: options.database ? options.database : undefined,\n schema: options.schema ? options.schema : undefined,\n synchronize: options.synchronize === false ? false : true,\n materialized: !!options.materialized\n } as TableMetadataArgs);\n };\n}\n"],"sourceRoot":"../.."}
1
+ {"version":3,"sources":["../../src/decorator/entity-view/ViewEntity.ts"],"names":[],"mappings":";;;AAAA,yCAAqD;AAgBrD;;;GAGG;AACH,SAAgB,UAAU,CAAC,aAAwC,EAAE,YAAgC;IACjG,IAAM,OAAO,GAAG,CAAC,OAAO,aAAa,KAAK,QAAQ,CAAC,CAAC,CAAC,aAAkC,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC;IAC9G,IAAM,IAAI,GAAG,OAAO,aAAa,KAAK,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC;IAE9E,OAAO,UAAU,MAAgB;QAC7B,IAAA,gCAAsB,GAAE,CAAC,MAAM,CAAC,IAAI,CAAC;YACjC,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI;YACV,UAAU,EAAE,OAAO,CAAC,UAAU;YAC9B,SAAS,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS;YACrE,IAAI,EAAE,MAAM;YACZ,QAAQ,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS;YACzD,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS;YACnD,WAAW,EAAE,OAAO,CAAC,WAAW,KAAK,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI;YACzD,YAAY,EAAE,CAAC,CAAC,OAAO,CAAC,YAAY;SAClB,CAAC,CAAC;IAC5B,CAAC,CAAC;AACN,CAAC;AAjBD,gCAiBC","file":"ViewEntity.js","sourcesContent":["import {getMetadataArgsStorage} from \"../../globals\";\nimport {TableMetadataArgs} from \"../../metadata-args/TableMetadataArgs\";\nimport {ViewEntityOptions} from \"../options/ViewEntityOptions\";\n\n/**\n * This decorator is used to mark classes that will be an entity view.\n * Database schema will be created for all classes decorated with it, and Repository can be retrieved and used for it.\n */\nexport function ViewEntity(options?: ViewEntityOptions): ClassDecorator;\n\n/**\n * This decorator is used to mark classes that will be an entity view.\n * Database schema will be created for all classes decorated with it, and Repository can be retrieved and used for it.\n */\nexport function ViewEntity(name?: string, options?: ViewEntityOptions): ClassDecorator;\n\n/**\n * This decorator is used to mark classes that will be an entity view.\n * Database schema will be created for all classes decorated with it, and Repository can be retrieved and used for it.\n */\nexport function ViewEntity(nameOrOptions?: string|ViewEntityOptions, maybeOptions?: ViewEntityOptions): ClassDecorator {\n const options = (typeof nameOrOptions === \"object\" ? nameOrOptions as ViewEntityOptions : maybeOptions) || {};\n const name = typeof nameOrOptions === \"string\" ? nameOrOptions : options.name;\n\n return function (target: Function) {\n getMetadataArgsStorage().tables.push({\n target: target,\n name: name,\n expression: options.expression,\n dependsOn: options.dependsOn ? new Set(options.dependsOn) : undefined,\n type: \"view\",\n database: options.database ? options.database : undefined,\n schema: options.schema ? options.schema : undefined,\n synchronize: options.synchronize === false ? false : true,\n materialized: !!options.materialized\n } as TableMetadataArgs);\n };\n}\n"],"sourceRoot":"../.."}
@@ -31,4 +31,9 @@ export interface ViewEntityOptions {
31
31
  * It's supported by Postgres and Oracle.
32
32
  */
33
33
  materialized?: boolean;
34
+ /**
35
+ * View dependencies. In case the view depends on another view it can be listed here
36
+ * to ensure correct order of view migrations.
37
+ */
38
+ dependsOn?: (Function | string)[];
34
39
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/decorator/options/ViewEntityOptions.ts"],"names":[],"mappings":"","file":"ViewEntityOptions.js","sourcesContent":["/**\n * Describes all entity view's options.\n */\nimport {Connection, SelectQueryBuilder} from \"../..\";\n\nexport interface ViewEntityOptions {\n\n /**\n * View name.\n * If not specified then naming strategy will generate view name from class name.\n */\n name?: string;\n\n /**\n * View expression.\n */\n expression?: string|((connection: Connection) => SelectQueryBuilder<any>);\n\n /**\n * Database name. Used in Mysql and Sql Server.\n */\n database?: string;\n\n /**\n * Schema name. Used in Postgres and Sql Server.\n */\n schema?: string;\n\n /**\n * Indicates if schema synchronization is enabled or disabled for this entity.\n * If it will be set to false then schema sync will and migrations ignore this entity.\n * By default schema synchronization is enabled for all entities.\n */\n synchronize?: boolean;\n\n /**\n * Indicates if view should be materialized view.\n * It's supported by Postgres and Oracle.\n */\n materialized?: boolean;\n}\n"],"sourceRoot":"../.."}
1
+ {"version":3,"sources":["../../src/decorator/options/ViewEntityOptions.ts"],"names":[],"mappings":"","file":"ViewEntityOptions.js","sourcesContent":["/**\n * Describes all entity view's options.\n */\nimport {Connection, SelectQueryBuilder} from \"../..\";\n\nexport interface ViewEntityOptions {\n\n /**\n * View name.\n * If not specified then naming strategy will generate view name from class name.\n */\n name?: string;\n\n /**\n * View expression.\n */\n expression?: string|((connection: Connection) => SelectQueryBuilder<any>);\n\n /**\n * Database name. Used in Mysql and Sql Server.\n */\n database?: string;\n\n /**\n * Schema name. Used in Postgres and Sql Server.\n */\n schema?: string;\n\n /**\n * Indicates if schema synchronization is enabled or disabled for this entity.\n * If it will be set to false then schema sync will and migrations ignore this entity.\n * By default schema synchronization is enabled for all entities.\n */\n synchronize?: boolean;\n\n /**\n * Indicates if view should be materialized view.\n * It's supported by Postgres and Oracle.\n */\n materialized?: boolean;\n\n /**\n * View dependencies. In case the view depends on another view it can be listed here\n * to ensure correct order of view migrations.\n */\n dependsOn?: (Function|string)[];\n}\n"],"sourceRoot":"../.."}
@@ -14,6 +14,11 @@ export interface AuroraDataApiConnectionOptions extends BaseConnectionOptions, A
14
14
  readonly secretArn: string;
15
15
  readonly resourceArn: string;
16
16
  readonly database: string;
17
+ /**
18
+ * The driver object
19
+ * This defaults to require("typeorm-aurora-data-api-driver")
20
+ */
21
+ readonly driver?: any;
17
22
  readonly serviceConfigOptions?: {
18
23
  [key: string]: any;
19
24
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/driver/aurora-data-api/AuroraDataApiConnectionOptions.ts"],"names":[],"mappings":"","file":"AuroraDataApiConnectionOptions.js","sourcesContent":["import {BaseConnectionOptions} from \"../../connection/BaseConnectionOptions\";\nimport {AuroraDataApiConnectionCredentialsOptions} from \"./AuroraDataApiConnectionCredentialsOptions\";\n\n/**\n * MySQL specific connection options.\n *\n * @see https://github.com/mysqljs/mysql#connection-options\n */\nexport interface AuroraDataApiConnectionOptions extends BaseConnectionOptions, AuroraDataApiConnectionCredentialsOptions {\n\n /**\n * Database type.\n */\n readonly type: \"aurora-data-api\";\n\n readonly region: string;\n\n readonly secretArn: string;\n\n readonly resourceArn: string;\n\n readonly database: string;\n\n readonly serviceConfigOptions?: { [key: string]: any }; // pass optional AWS.ConfigurationOptions here\n\n readonly formatOptions?: { [key: string]: any, castParameters: boolean };\n\n /**\n * Use spatial functions like GeomFromText and AsText which are removed in MySQL 8.\n * (Default: true)\n */\n readonly legacySpatialSupport?: boolean;\n}\n"],"sourceRoot":"../.."}
1
+ {"version":3,"sources":["../../src/driver/aurora-data-api/AuroraDataApiConnectionOptions.ts"],"names":[],"mappings":"","file":"AuroraDataApiConnectionOptions.js","sourcesContent":["import {BaseConnectionOptions} from \"../../connection/BaseConnectionOptions\";\nimport {AuroraDataApiConnectionCredentialsOptions} from \"./AuroraDataApiConnectionCredentialsOptions\";\n\n/**\n * MySQL specific connection options.\n *\n * @see https://github.com/mysqljs/mysql#connection-options\n */\nexport interface AuroraDataApiConnectionOptions extends BaseConnectionOptions, AuroraDataApiConnectionCredentialsOptions {\n\n /**\n * Database type.\n */\n readonly type: \"aurora-data-api\";\n\n readonly region: string;\n\n readonly secretArn: string;\n\n readonly resourceArn: string;\n\n readonly database: string;\n\n /**\n * The driver object\n * This defaults to require(\"typeorm-aurora-data-api-driver\")\n */\n readonly driver?: any;\n\n readonly serviceConfigOptions?: { [key: string]: any }; // pass optional AWS.ConfigurationOptions here\n\n readonly formatOptions?: { [key: string]: any, castParameters: boolean };\n\n /**\n * Use spatial functions like GeomFromText and AsText which are removed in MySQL 8.\n * (Default: true)\n */\n readonly legacySpatialSupport?: boolean;\n}\n"],"sourceRoot":"../.."}
@@ -359,7 +359,7 @@ var AuroraDataApiDriver = /** @class */ (function () {
359
359
  if (database) {
360
360
  tablePath.unshift(database);
361
361
  }
362
- return tablePath.join('.');
362
+ return tablePath.join(".");
363
363
  };
364
364
  /**
365
365
  * Parse a target table name or other types and return a normalized table definition.
@@ -748,7 +748,8 @@ var AuroraDataApiDriver = /** @class */ (function () {
748
748
  * Loads all driver dependencies.
749
749
  */
750
750
  AuroraDataApiDriver.prototype.loadDependencies = function () {
751
- this.DataApiDriver = PlatformTools_1.PlatformTools.load("typeorm-aurora-data-api-driver");
751
+ var DataApiDriver = this.options.driver || PlatformTools_1.PlatformTools.load("typeorm-aurora-data-api-driver");
752
+ this.DataApiDriver = DataApiDriver;
752
753
  // Driver uses rollup for publishing, which has issues when using typeorm in combination with webpack
753
754
  // See https://github.com/webpack/webpack/issues/4742#issuecomment-295556787
754
755
  this.DataApiDriver = this.DataApiDriver.default || this.DataApiDriver;
@@ -789,9 +790,9 @@ var AuroraDataApiDriver = /** @class */ (function () {
789
790
  */
790
791
  AuroraDataApiDriver.prototype.prepareDbConnection = function (connection) {
791
792
  var logger = this.connection.logger;
792
- /*
793
- Attaching an error handler to connection errors is essential, as, otherwise, errors raised will go unhandled and
794
- cause the hosting app to crash.
793
+ /**
794
+ * Attaching an error handler to connection errors is essential, as, otherwise, errors raised will go unhandled and
795
+ * cause the hosting app to crash.
795
796
  */
796
797
  if (connection.listeners("error").length === 0) {
797
798
  connection.on("error", function (error) { return logger.log("warn", "MySQL connection raised an error. " + error); });