typeorm 0.2.42-dev.d10484e → 0.2.42-dev.f8154eb
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/connection/BaseConnectionOptions.d.ts +5 -0
- package/browser/connection/BaseConnectionOptions.js.map +1 -1
- package/browser/connection/Connection.d.ts +4 -0
- package/browser/connection/Connection.js +1 -0
- package/browser/connection/Connection.js.map +1 -1
- package/browser/connection/options-reader/ConnectionOptionsEnvReader.js +1 -0
- package/browser/connection/options-reader/ConnectionOptionsEnvReader.js.map +1 -1
- package/browser/driver/postgres/PostgresQueryRunner.js +1 -1
- package/browser/driver/postgres/PostgresQueryRunner.js.map +1 -1
- package/browser/find-options/FindOneOptions.d.ts +6 -0
- package/browser/find-options/FindOneOptions.js.map +1 -1
- package/browser/find-options/FindOptionsUtils.js +4 -0
- package/browser/find-options/FindOptionsUtils.js.map +1 -1
- package/browser/query-builder/DeleteQueryBuilder.d.ts +3 -1
- package/browser/query-builder/DeleteQueryBuilder.js +3 -1
- package/browser/query-builder/DeleteQueryBuilder.js.map +1 -1
- package/browser/query-builder/RelationLoader.js +11 -6
- package/browser/query-builder/RelationLoader.js.map +1 -1
- package/browser/query-builder/UpdateQueryBuilder.d.ts +3 -1
- package/browser/query-builder/UpdateQueryBuilder.js +3 -1
- package/browser/query-builder/UpdateQueryBuilder.js.map +1 -1
- package/browser/query-builder/WhereExpressionBuilder.d.ts +3 -1
- package/browser/query-builder/WhereExpressionBuilder.js.map +1 -1
- package/browser/query-runner/BaseQueryRunner.d.ts +2 -2
- package/browser/query-runner/BaseQueryRunner.js +3 -3
- package/browser/query-runner/BaseQueryRunner.js.map +1 -1
- package/browser/repository/TreeRepository.js +1 -1
- package/browser/repository/TreeRepository.js.map +1 -1
- package/browser/schema-builder/RdbmsSchemaBuilder.js +1 -1
- package/browser/schema-builder/RdbmsSchemaBuilder.js.map +1 -1
- package/connection/BaseConnectionOptions.d.ts +5 -0
- package/connection/BaseConnectionOptions.js.map +1 -1
- package/connection/Connection.d.ts +4 -0
- package/connection/Connection.js +1 -0
- package/connection/Connection.js.map +1 -1
- package/connection/options-reader/ConnectionOptionsEnvReader.js +1 -0
- package/connection/options-reader/ConnectionOptionsEnvReader.js.map +1 -1
- package/driver/postgres/PostgresQueryRunner.js +1 -1
- package/driver/postgres/PostgresQueryRunner.js.map +1 -1
- package/find-options/FindOneOptions.d.ts +6 -0
- package/find-options/FindOneOptions.js.map +1 -1
- package/find-options/FindOptionsUtils.js +4 -0
- package/find-options/FindOptionsUtils.js.map +1 -1
- package/package.json +1 -1
- package/query-builder/DeleteQueryBuilder.d.ts +3 -1
- package/query-builder/DeleteQueryBuilder.js +3 -1
- package/query-builder/DeleteQueryBuilder.js.map +1 -1
- package/query-builder/RelationLoader.js +11 -6
- package/query-builder/RelationLoader.js.map +1 -1
- package/query-builder/UpdateQueryBuilder.d.ts +3 -1
- package/query-builder/UpdateQueryBuilder.js +3 -1
- package/query-builder/UpdateQueryBuilder.js.map +1 -1
- package/query-builder/WhereExpressionBuilder.d.ts +3 -1
- package/query-builder/WhereExpressionBuilder.js.map +1 -1
- package/query-runner/BaseQueryRunner.d.ts +2 -2
- package/query-runner/BaseQueryRunner.js +3 -3
- package/query-runner/BaseQueryRunner.js.map +1 -1
- package/repository/TreeRepository.js +1 -1
- package/repository/TreeRepository.js.map +1 -1
- package/schema-builder/RdbmsSchemaBuilder.js +1 -1
- package/schema-builder/RdbmsSchemaBuilder.js.map +1 -1
|
@@ -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,OAA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AI,CAAC,EAAA;;wBAtCR,SAsCQ,CAAC;;;;;KACZ;IACL,yBAAC;AAAD,CAz0BA,AAy0BC,IAAA","file":"RdbmsSchemaBuilder.js","sourcesContent":["import {CockroachDriver} from \"../driver/cockroachdb/CockroachDriver\";\nimport {Table} from \"./table/Table\";\nimport {TableColumn} from \"./table/TableColumn\";\nimport {TableForeignKey} from \"./table/TableForeignKey\";\nimport {TableIndex} from \"./table/TableIndex\";\nimport {QueryRunner} from \"../query-runner/QueryRunner\";\nimport {ColumnMetadata} from \"../metadata/ColumnMetadata\";\nimport {EntityMetadata} from \"../metadata/EntityMetadata\";\nimport {Connection} from \"../connection/Connection\";\nimport {SchemaBuilder} from \"./SchemaBuilder\";\nimport {SqlInMemory} from \"../driver/SqlInMemory\";\nimport {TableUtils} from \"./util/TableUtils\";\nimport {TableColumnOptions} from \"./options/TableColumnOptions\";\nimport {PostgresDriver} from \"../driver/postgres/PostgresDriver\";\nimport {MysqlDriver} from \"../driver/mysql/MysqlDriver\";\nimport {TableUnique} from \"./table/TableUnique\";\nimport {TableCheck} from \"./table/TableCheck\";\nimport {TableExclusion} from \"./table/TableExclusion\";\nimport {View} from \"./view/View\";\nimport {ViewUtils} from \"./util/ViewUtils\";\nimport {AuroraDataApiDriver} from \"../driver/aurora-data-api/AuroraDataApiDriver\";\n\n/**\n * Creates complete tables schemas in the database based on the entity metadatas.\n *\n * Steps how schema is being built:\n * 1. load list of all tables with complete column and keys information from the db\n * 2. drop all (old) foreign keys that exist in the table, but does not exist in the metadata\n * 3. create new tables that does not exist in the db, but exist in the metadata\n * 4. drop all columns exist (left old) in the db table, but does not exist in the metadata\n * 5. add columns from metadata which does not exist in the table\n * 6. update all exist columns which metadata has changed\n * 7. update primary keys - update old and create new primary key from changed columns\n * 8. create foreign keys which does not exist in the table yet\n * 9. create indices which are missing in db yet, and drops indices which exist in the db, but does not exist in the metadata anymore\n */\nexport class RdbmsSchemaBuilder implements SchemaBuilder {\n /**\n * Used to execute schema creation queries in a single connection.\n */\n protected queryRunner: QueryRunner;\n\n private currentDatabase?: string;\n\n private currentSchema?: string;\n\n // -------------------------------------------------------------------------\n // Constructor\n // -------------------------------------------------------------------------\n\n constructor(protected connection: Connection) {\n }\n\n // -------------------------------------------------------------------------\n // Public Methods\n // -------------------------------------------------------------------------\n\n /**\n * Creates complete schemas for the given entity metadatas.\n */\n async build(): Promise<void> {\n this.queryRunner = this.connection.createQueryRunner();\n\n // this.connection.driver.database || this.currentDatabase;\n this.currentDatabase = this.connection.driver.database;\n this.currentSchema = this.connection.driver.schema;\n\n // CockroachDB implements asynchronous schema sync operations which can not been executed in transaction.\n // E.g. if you try to DROP column and ADD it again in the same transaction, crdb throws error.\n const isUsingTransactions = (\n !(this.connection.driver instanceof CockroachDriver) &&\n this.connection.options.migrationsTransactionMode !== \"none\"\n );\n\n if (isUsingTransactions) {\n await this.queryRunner.startTransaction();\n }\n\n try {\n await this.createMetadataTableIfNecessary(this.queryRunner);\n // Flush the queryrunner table & view cache\n const tablePaths = this.entityToSyncMetadatas.map(metadata => this.getTablePath(metadata));\n\n await this.queryRunner.getTables(tablePaths);\n await this.queryRunner.getViews([]);\n\n await this.executeSchemaSyncOperationsInProperOrder();\n\n // if cache is enabled then perform cache-synchronization as well\n if (this.connection.queryResultCache)\n await this.connection.queryResultCache.synchronize(this.queryRunner);\n\n if (isUsingTransactions) {\n await this.queryRunner.commitTransaction();\n }\n\n } catch (error) {\n\n try { // we throw original error even if rollback thrown an error\n if (isUsingTransactions) {\n await this.queryRunner.rollbackTransaction();\n }\n } catch (rollbackError) { }\n throw error;\n\n } finally {\n await this.queryRunner.release();\n }\n }\n\n /**\n * If the schema contains views, create the typeorm_metadata table if it doesn't exist yet\n */\n async createMetadataTableIfNecessary(queryRunner: QueryRunner): Promise<void> {\n if (this.viewEntityToSyncMetadatas.length > 0 || (this.connection.driver instanceof PostgresDriver && this.connection.driver.isGeneratedColumnsSupported)) {\n await this.createTypeormMetadataTable(queryRunner);\n }\n }\n\n /**\n * Returns sql queries to be executed by schema builder.\n */\n async log(): Promise<SqlInMemory> {\n this.queryRunner = this.connection.createQueryRunner();\n try {\n // Flush the queryrunner table & view cache\n const tablePaths = this.entityToSyncMetadatas.map(metadata => this.getTablePath(metadata));\n await this.queryRunner.getTables(tablePaths);\n await this.queryRunner.getViews([]);\n\n this.queryRunner.enableSqlMemory();\n await this.executeSchemaSyncOperationsInProperOrder();\n\n // if cache is enabled then perform cache-synchronization as well\n if (this.connection.queryResultCache) // todo: check this functionality\n await this.connection.queryResultCache.synchronize(this.queryRunner);\n\n return this.queryRunner.getMemorySql();\n\n } finally {\n // its important to disable this mode despite the fact we are release query builder\n // because there exist drivers which reuse same query runner. Also its important to disable\n // sql memory after call of getMemorySql() method because last one flushes sql memory.\n this.queryRunner.disableSqlMemory();\n await this.queryRunner.release();\n }\n }\n\n // -------------------------------------------------------------------------\n // Protected Methods\n // -------------------------------------------------------------------------\n\n /**\n * Returns only entities that should be synced in the database.\n */\n protected get entityToSyncMetadatas(): EntityMetadata[] {\n return this.connection.entityMetadatas.filter(metadata => metadata.synchronize && metadata.tableType !== \"entity-child\" && metadata.tableType !== \"view\");\n }\n\n /**\n * Returns only entities that should be synced in the database.\n */\n protected get viewEntityToSyncMetadatas(): EntityMetadata[] {\n return this.connection.entityMetadatas\n .filter(metadata => metadata.tableType === \"view\" && metadata.synchronize)\n // sort views in creation order by dependencies\n .sort(ViewUtils.viewMetadataCmp);\n }\n\n /**\n * Executes schema sync operations in a proper order.\n * Order of operations matter here.\n */\n protected async executeSchemaSyncOperationsInProperOrder(): Promise<void> {\n await this.dropOldViews();\n await this.dropOldForeignKeys();\n await this.dropOldIndices();\n await this.dropOldChecks();\n await this.dropOldExclusions();\n await this.dropCompositeUniqueConstraints();\n // await this.renameTables();\n await this.renameColumns();\n await this.createNewTables();\n await this.dropRemovedColumns();\n await this.addNewColumns();\n await this.updatePrimaryKeys();\n await this.updateExistColumns();\n await this.createNewIndices();\n await this.createNewChecks();\n await this.createNewExclusions();\n await this.createCompositeUniqueConstraints();\n await this.createForeignKeys();\n await this.createViews();\n }\n\n private getTablePath(target: EntityMetadata | Table | View | TableForeignKey | string): string {\n const parsed = this.connection.driver.parseTableName(target);\n\n return this.connection.driver.buildTableName(\n parsed.tableName,\n parsed.schema || this.currentSchema,\n parsed.database || this.currentDatabase\n );\n }\n\n /**\n * Drops all (old) foreign keys that exist in the tables, but do not exist in the entity metadata.\n */\n protected async dropOldForeignKeys(): Promise<void> {\n for (const metadata of this.entityToSyncMetadatas) {\n const table = this.queryRunner.loadedTables.find(table => this.getTablePath(table) === this.getTablePath(metadata));\n if (!table)\n continue;\n\n // find foreign keys that exist in the schemas but does not exist in the entity metadata\n const tableForeignKeysToDrop = table.foreignKeys.filter(tableForeignKey => {\n const metadataFK = metadata.foreignKeys.find(metadataForeignKey => (\n (tableForeignKey.name === metadataForeignKey.name) &&\n (this.getTablePath(tableForeignKey) === this.getTablePath(metadataForeignKey.referencedEntityMetadata))\n ));\n return !metadataFK\n || (metadataFK.onDelete && metadataFK.onDelete !== tableForeignKey.onDelete)\n || (metadataFK.onUpdate && metadataFK.onUpdate !== tableForeignKey.onUpdate);\n });\n if (tableForeignKeysToDrop.length === 0)\n continue;\n\n this.connection.logger.logSchemaBuild(`dropping old foreign keys of ${table.name}: ${tableForeignKeysToDrop.map(dbForeignKey => dbForeignKey.name).join(\", \")}`);\n\n // drop foreign keys from the database\n await this.queryRunner.dropForeignKeys(table, tableForeignKeysToDrop);\n }\n }\n\n /**\n * Rename tables\n */\n protected async renameTables(): Promise<void> {\n // for (const metadata of this.entityToSyncMetadatas) {\n // const table = this.queryRunner.loadedTables.find(table => this.getTablePath(table) === this.getTablePath(metadata));\n // }\n }\n\n /**\n * Renames columns.\n * Works if only one column per table was changed.\n * Changes only column name. If something besides name was changed, these changes will be ignored.\n */\n protected async renameColumns(): Promise<void> {\n for (const metadata of this.entityToSyncMetadatas) {\n const table = this.queryRunner.loadedTables.find(table => this.getTablePath(table) === this.getTablePath(metadata));\n if (!table)\n continue;\n\n if (metadata.columns.length !== table.columns.length)\n continue;\n\n const renamedMetadataColumns = metadata.columns.filter(column => {\n return !table.columns.find(tableColumn => {\n return tableColumn.name === column.databaseName\n && tableColumn.type === this.connection.driver.normalizeType(column)\n && tableColumn.isNullable === column.isNullable\n && tableColumn.isUnique === this.connection.driver.normalizeIsUnique(column);\n });\n });\n\n if (renamedMetadataColumns.length === 0 || renamedMetadataColumns.length > 1)\n continue;\n\n const renamedTableColumns = table.columns.filter(tableColumn => {\n return !metadata.columns.find(column => {\n return column.databaseName === tableColumn.name\n && this.connection.driver.normalizeType(column) === tableColumn.type\n && column.isNullable === tableColumn.isNullable\n && this.connection.driver.normalizeIsUnique(column) === tableColumn.isUnique;\n });\n });\n\n if (renamedTableColumns.length === 0 || renamedTableColumns.length > 1)\n continue;\n\n const renamedColumn = renamedTableColumns[0].clone();\n renamedColumn.name = renamedMetadataColumns[0].databaseName;\n\n this.connection.logger.logSchemaBuild(`renaming column \"${renamedTableColumns[0].name}\" in to \"${renamedColumn.name}\"`);\n await this.queryRunner.renameColumn(table, renamedTableColumns[0], renamedColumn);\n }\n }\n\n protected async dropOldIndices(): Promise<void> {\n for (const metadata of this.entityToSyncMetadatas) {\n const table = this.queryRunner.loadedTables.find(table => this.getTablePath(table) === this.getTablePath(metadata));\n if (!table)\n continue;\n\n const dropQueries = table.indices\n .filter(tableIndex => {\n const indexMetadata = metadata.indices.find(index => index.name === tableIndex.name);\n if (indexMetadata) {\n if (indexMetadata.synchronize === false)\n return false;\n\n if (indexMetadata.isUnique !== tableIndex.isUnique)\n return true;\n\n if (indexMetadata.isSpatial !== tableIndex.isSpatial)\n return true;\n\n if (this.connection.driver.isFullTextColumnTypeSupported() && indexMetadata.isFulltext !== tableIndex.isFulltext)\n return true;\n\n if (indexMetadata.columns.length !== tableIndex.columnNames.length)\n return true;\n\n return !indexMetadata.columns.every(column => tableIndex.columnNames.indexOf(column.databaseName) !== -1);\n }\n\n return true;\n })\n .map(async tableIndex => {\n this.connection.logger.logSchemaBuild(`dropping an index: \"${tableIndex.name}\" from table ${table.name}`);\n await this.queryRunner.dropIndex(table, tableIndex);\n });\n\n await Promise.all(dropQueries);\n }\n }\n\n protected async dropOldChecks(): Promise<void> {\n // Mysql does not support check constraints\n if (this.connection.driver instanceof MysqlDriver || this.connection.driver instanceof AuroraDataApiDriver)\n return;\n\n for (const metadata of this.entityToSyncMetadatas) {\n const table = this.queryRunner.loadedTables.find(table => this.getTablePath(table) === this.getTablePath(metadata));\n if (!table)\n continue;\n\n const oldChecks = table.checks.filter(tableCheck => {\n return !metadata.checks.find(checkMetadata => checkMetadata.name === tableCheck.name);\n });\n\n if (oldChecks.length === 0)\n continue;\n\n this.connection.logger.logSchemaBuild(`dropping old check constraint: ${oldChecks.map(check => `\"${check.name}\"`).join(\", \")} from table \"${table.name}\"`);\n await this.queryRunner.dropCheckConstraints(table, oldChecks);\n }\n }\n\n protected async dropCompositeUniqueConstraints(): Promise<void> {\n for (const metadata of this.entityToSyncMetadatas) {\n const table = this.queryRunner.loadedTables.find(table => this.getTablePath(table) === this.getTablePath(metadata));\n if (!table)\n continue;\n\n const compositeUniques = table.uniques.filter(tableUnique => {\n return tableUnique.columnNames.length > 1 && !metadata.uniques.find(uniqueMetadata => uniqueMetadata.name === tableUnique.name);\n });\n\n if (compositeUniques.length === 0)\n continue;\n\n this.connection.logger.logSchemaBuild(`dropping old unique constraint: ${compositeUniques.map(unique => `\"${unique.name}\"`).join(\", \")} from table \"${table.name}\"`);\n await this.queryRunner.dropUniqueConstraints(table, compositeUniques);\n }\n }\n\n protected async dropOldExclusions(): Promise<void> {\n // Only PostgreSQL supports exclusion constraints\n if (!(this.connection.driver instanceof PostgresDriver))\n return;\n\n for (const metadata of this.entityToSyncMetadatas) {\n const table = this.queryRunner.loadedTables.find(table => this.getTablePath(table) === this.getTablePath(metadata));\n if (!table)\n continue;\n\n const oldExclusions = table.exclusions.filter(tableExclusion => {\n return !metadata.exclusions.find(exclusionMetadata => exclusionMetadata.name === tableExclusion.name);\n });\n\n if (oldExclusions.length === 0)\n continue;\n\n this.connection.logger.logSchemaBuild(`dropping old exclusion constraint: ${oldExclusions.map(exclusion => `\"${exclusion.name}\"`).join(\", \")} from table \"${table.name}\"`);\n await this.queryRunner.dropExclusionConstraints(table, oldExclusions);\n }\n }\n\n /**\n * Creates tables that do not exist in the database yet.\n * New tables are created without foreign and primary keys.\n * Primary key only can be created in conclusion with auto generated column.\n */\n protected async createNewTables(): Promise<void> {\n for (const metadata of this.entityToSyncMetadatas) {\n // check if table does not exist yet\n const existTable = this.queryRunner.loadedTables.find(table => this.getTablePath(table) === this.getTablePath(metadata));\n if (existTable)\n continue;\n\n this.connection.logger.logSchemaBuild(`creating a new table: ${this.getTablePath(metadata)}`);\n\n // create a new table and sync it in the database\n const table = Table.create(metadata, this.connection.driver);\n await this.queryRunner.createTable(table, false, false);\n this.queryRunner.loadedTables.push(table);\n }\n }\n\n protected async createViews(): Promise<void> {\n for (const metadata of this.viewEntityToSyncMetadatas) {\n // check if view does not exist yet\n const existView = this.queryRunner.loadedViews.find(view => {\n const viewExpression = typeof view.expression === \"string\" ? view.expression.trim() : view.expression(this.connection).getQuery();\n const metadataExpression = typeof metadata.expression === \"string\" ? metadata.expression.trim() : metadata.expression!(this.connection).getQuery();\n return this.getTablePath(view) === this.getTablePath(metadata) && viewExpression === metadataExpression;\n });\n if (existView)\n continue;\n\n this.connection.logger.logSchemaBuild(`creating a new view: ${this.getTablePath(metadata)}`);\n\n // create a new view and sync it in the database\n const view = View.create(metadata, this.connection.driver);\n await this.queryRunner.createView(view);\n this.queryRunner.loadedViews.push(view);\n }\n }\n\n protected async dropOldViews(): Promise<void> {\n const droppedViews: Array<View> = [];\n const viewEntityToSyncMetadatas = this.viewEntityToSyncMetadatas;\n // BuIld lookup cache for finding views metadata\n const viewToMetadata = new Map<View, EntityMetadata>();\n for (const view of this.queryRunner.loadedViews) {\n const viewMetadata = viewEntityToSyncMetadatas.find(metadata => {\n return this.getTablePath(view) === this.getTablePath(metadata);\n });\n if(viewMetadata){\n viewToMetadata.set(view, viewMetadata);\n }\n }\n // Gather all changed view, that need a drop\n for (const view of this.queryRunner.loadedViews) {\n const viewMetadata = viewToMetadata.get(view);\n if(!viewMetadata){\n continue;\n }\n const viewExpression = typeof view.expression === \"string\" ? view.expression.trim() : view.expression(this.connection).getQuery();\n const metadataExpression = typeof viewMetadata.expression === \"string\" ? viewMetadata.expression.trim() : viewMetadata.expression!(this.connection).getQuery();\n\n if (viewExpression === metadataExpression)\n continue;\n\n this.connection.logger.logSchemaBuild(`dropping an old view: ${view.name}`);\n\n // Collect view to be dropped\n droppedViews.push(view);\n }\n\n // Helper function that for a given view, will recursively return list of the view and all views that depend on it\n const viewDependencyChain = (view: View): View[] => {\n // Get the view metadata\n const viewMetadata = viewToMetadata.get(view);\n let viewWithDependencies = [view];\n // If no metadata is known for the view, simply return the view itself\n if(!viewMetadata){\n return viewWithDependencies;\n }\n // Iterate over all known views\n for(const [currentView, currentMetadata] of viewToMetadata.entries()){\n // Ignore self reference\n if(currentView === view) {\n continue;\n }\n // If the currently iterated view depends on the passed in view\n if(currentMetadata.dependsOn && (\n currentMetadata.dependsOn.has(viewMetadata.target) ||\n currentMetadata.dependsOn.has(viewMetadata.name)\n )){\n // Recursively add currently iterate view and its dependents\n viewWithDependencies = viewWithDependencies.concat(viewDependencyChain(currentView));\n }\n }\n // Return all collected views\n return viewWithDependencies;\n };\n\n // Collect final list of views to be dropped in a Set so there are no duplicates\n const droppedViewsWithDependencies: Set<View> = new Set(\n // Collect all dropped views, and their dependencies\n droppedViews.map(view => viewDependencyChain(view))\n // Flattened to single Array ( can be replaced with flatMap, once supported)\n .reduce((all, segment) => {\n return all.concat(segment);\n }, [])\n // Sort the views to be dropped in creation order\n .sort((a, b)=> {\n return ViewUtils.viewMetadataCmp(viewToMetadata.get(a), viewToMetadata.get(b));\n })\n // reverse order to get drop order\n .reverse()\n );\n\n // Finally emit all drop views\n for(const view of droppedViewsWithDependencies){\n await this.queryRunner.dropView(view);\n }\n this.queryRunner.loadedViews = this.queryRunner.loadedViews.filter(view => !droppedViewsWithDependencies.has(view));\n }\n\n /**\n * Drops all columns that exist in the table, but does not exist in the metadata (left old).\n * We drop their keys too, since it should be safe.\n */\n protected async dropRemovedColumns(): Promise<void> {\n for (const metadata of this.entityToSyncMetadatas) {\n const table = this.queryRunner.loadedTables.find(table => this.getTablePath(table) === this.getTablePath(metadata));\n if (!table)\n continue;\n\n // find columns that exist in the database but does not exist in the metadata\n const droppedTableColumns = table.columns.filter(tableColumn => {\n return !metadata.columns.find(columnMetadata => columnMetadata.databaseName === tableColumn.name);\n });\n if (droppedTableColumns.length === 0)\n continue;\n\n this.connection.logger.logSchemaBuild(`columns dropped in ${table.name}: ` + droppedTableColumns.map(column => column.name).join(\", \"));\n\n // drop columns from the database\n await this.queryRunner.dropColumns(table, droppedTableColumns);\n }\n }\n\n /**\n * Adds columns from metadata which does not exist in the table.\n * Columns are created without keys.\n */\n protected async addNewColumns(): Promise<void> {\n for (const metadata of this.entityToSyncMetadatas) {\n const table = this.queryRunner.loadedTables.find(table => this.getTablePath(table) === this.getTablePath(metadata));\n if (!table)\n continue;\n\n // find which columns are new\n const newColumnMetadatas = metadata.columns.filter(columnMetadata => {\n return !table.columns.find(tableColumn => tableColumn.name === columnMetadata.databaseName);\n });\n if (newColumnMetadatas.length === 0)\n continue;\n\n // create columns in the database\n const newTableColumnOptions = this.metadataColumnsToTableColumnOptions(newColumnMetadatas);\n const newTableColumns = newTableColumnOptions.map(option => new TableColumn(option));\n\n if (newTableColumns.length === 0)\n continue;\n\n this.connection.logger.logSchemaBuild(`new columns added: ` + newColumnMetadatas.map(column => column.databaseName).join(\", \"));\n await this.queryRunner.addColumns(table, newTableColumns);\n }\n }\n\n /**\n * Updates composite primary keys.\n */\n protected async updatePrimaryKeys(): Promise<void> {\n for (const metadata of this.entityToSyncMetadatas) {\n const table = this.queryRunner.loadedTables.find(table => this.getTablePath(table) === this.getTablePath(metadata));\n if (!table)\n continue;\n\n const primaryMetadataColumns = metadata.columns.filter(column => column.isPrimary);\n const primaryTableColumns = table.columns.filter(column => column.isPrimary);\n if (primaryTableColumns.length !== primaryMetadataColumns.length && primaryMetadataColumns.length > 1) {\n const changedPrimaryColumns = primaryMetadataColumns.map(primaryMetadataColumn => {\n return new TableColumn(TableUtils.createTableColumnOptions(primaryMetadataColumn, this.connection.driver));\n });\n await this.queryRunner.updatePrimaryKeys(table, changedPrimaryColumns);\n }\n }\n }\n\n /**\n * Update all exist columns which metadata has changed.\n * Still don't create keys. Also we don't touch foreign keys of the changed columns.\n */\n protected async updateExistColumns(): Promise<void> {\n for (const metadata of this.entityToSyncMetadatas) {\n const table = this.queryRunner.loadedTables.find(table => this.getTablePath(table) === this.getTablePath(metadata));\n if (!table)\n continue;\n\n const changedColumns = this.connection.driver.findChangedColumns(table.columns, metadata.columns);\n if (changedColumns.length === 0)\n continue;\n\n // drop all foreign keys that point to this column\n for (const changedColumn of changedColumns) {\n await this.dropColumnReferencedForeignKeys(this.getTablePath(metadata), changedColumn.databaseName);\n }\n\n // drop all composite indices related to this column\n for (const changedColumn of changedColumns) {\n await this.dropColumnCompositeIndices(this.getTablePath(metadata), changedColumn.databaseName);\n }\n\n // drop all composite uniques related to this column\n // Mysql does not support unique constraints.\n if (!(this.connection.driver instanceof MysqlDriver || this.connection.driver instanceof AuroraDataApiDriver)) {\n for (const changedColumn of changedColumns) {\n await this.dropColumnCompositeUniques(this.getTablePath(metadata), changedColumn.databaseName);\n }\n }\n\n // generate a map of new/old columns\n const newAndOldTableColumns = changedColumns.map(changedColumn => {\n const oldTableColumn = table.columns.find(column => column.name === changedColumn.databaseName)!;\n const newTableColumnOptions = TableUtils.createTableColumnOptions(changedColumn, this.connection.driver);\n const newTableColumn = new TableColumn(newTableColumnOptions);\n\n return {\n oldColumn: oldTableColumn,\n newColumn: newTableColumn\n };\n });\n\n if (newAndOldTableColumns.length === 0)\n continue;\n\n this.connection.logger.logSchemaBuild(`columns changed in \"${table.name}\". updating: ` + changedColumns.map(column => column.databaseName).join(\", \"));\n await this.queryRunner.changeColumns(table, newAndOldTableColumns);\n }\n }\n\n /**\n * Creates composite indices which are missing in db yet.\n */\n protected async createNewIndices(): Promise<void> {\n for (const metadata of this.entityToSyncMetadatas) {\n const table = this.queryRunner.loadedTables.find(table => this.getTablePath(table) === this.getTablePath(metadata));\n if (!table)\n continue;\n\n const newIndices = metadata.indices\n .filter(indexMetadata => !table.indices.find(tableIndex => tableIndex.name === indexMetadata.name) && indexMetadata.synchronize === true)\n .map(indexMetadata => TableIndex.create(indexMetadata));\n\n if (newIndices.length === 0)\n continue;\n\n this.connection.logger.logSchemaBuild(`adding new indices ${newIndices.map(index => `\"${index.name}\"`).join(\", \")} in table \"${table.name}\"`);\n await this.queryRunner.createIndices(table, newIndices);\n }\n }\n\n protected async createNewChecks(): Promise<void> {\n // Mysql does not support check constraints\n if (this.connection.driver instanceof MysqlDriver || this.connection.driver instanceof AuroraDataApiDriver)\n return;\n\n for (const metadata of this.entityToSyncMetadatas) {\n const table = this.queryRunner.loadedTables.find(table => this.getTablePath(table) === this.getTablePath(metadata));\n if (!table)\n continue;\n\n const newChecks = metadata.checks\n .filter(checkMetadata => !table.checks.find(tableCheck => tableCheck.name === checkMetadata.name))\n .map(checkMetadata => TableCheck.create(checkMetadata));\n\n if (newChecks.length === 0)\n continue;\n\n this.connection.logger.logSchemaBuild(`adding new check constraints: ${newChecks.map(index => `\"${index.name}\"`).join(\", \")} in table \"${table.name}\"`);\n await this.queryRunner.createCheckConstraints(table, newChecks);\n }\n }\n\n /**\n * Creates composite uniques which are missing in db yet.\n */\n protected async createCompositeUniqueConstraints(): Promise<void> {\n for (const metadata of this.entityToSyncMetadatas) {\n const table = this.queryRunner.loadedTables.find(table => this.getTablePath(table) === this.getTablePath(metadata));\n if (!table)\n continue;\n\n const compositeUniques = metadata.uniques\n .filter(uniqueMetadata => uniqueMetadata.columns.length > 1 && !table.uniques.find(tableUnique => tableUnique.name === uniqueMetadata.name))\n .map(uniqueMetadata => TableUnique.create(uniqueMetadata));\n\n if (compositeUniques.length === 0)\n continue;\n\n this.connection.logger.logSchemaBuild(`adding new unique constraints: ${compositeUniques.map(unique => `\"${unique.name}\"`).join(\", \")} in table \"${table.name}\"`);\n await this.queryRunner.createUniqueConstraints(table, compositeUniques);\n }\n }\n\n /**\n * Creates exclusions which are missing in db yet.\n */\n protected async createNewExclusions(): Promise<void> {\n // Only PostgreSQL supports exclusion constraints\n if (!(this.connection.driver instanceof PostgresDriver))\n return;\n\n for (const metadata of this.entityToSyncMetadatas) {\n const table = this.queryRunner.loadedTables.find(table => this.getTablePath(table) === this.getTablePath(metadata));\n if (!table)\n continue;\n\n const newExclusions = metadata.exclusions\n .filter(exclusionMetadata => !table.exclusions.find(tableExclusion => tableExclusion.name === exclusionMetadata.name))\n .map(exclusionMetadata => TableExclusion.create(exclusionMetadata));\n\n if (newExclusions.length === 0)\n continue;\n\n this.connection.logger.logSchemaBuild(`adding new exclusion constraints: ${newExclusions.map(exclusion => `\"${exclusion.name}\"`).join(\", \")} in table \"${table.name}\"`);\n await this.queryRunner.createExclusionConstraints(table, newExclusions);\n }\n }\n\n /**\n * Creates foreign keys which does not exist in the table yet.\n */\n protected async createForeignKeys(): Promise<void> {\n for (const metadata of this.entityToSyncMetadatas) {\n const table = this.queryRunner.loadedTables.find(table => this.getTablePath(table) === this.getTablePath(metadata));\n if (!table)\n continue;\n\n const newKeys = metadata.foreignKeys\n .filter(foreignKey => {\n return !table.foreignKeys.find(dbForeignKey => (\n (dbForeignKey.name === foreignKey.name) &&\n (this.getTablePath(dbForeignKey) === this.getTablePath(foreignKey.referencedEntityMetadata))\n ));\n });\n if (newKeys.length === 0)\n continue;\n\n const dbForeignKeys = newKeys.map(foreignKeyMetadata => TableForeignKey.create(foreignKeyMetadata, this.connection.driver));\n this.connection.logger.logSchemaBuild(`creating a foreign keys: ${newKeys.map(key => key.name).join(\", \")} on table \"${table.name}\"`);\n await this.queryRunner.createForeignKeys(table, dbForeignKeys);\n }\n }\n\n /**\n * Drops all foreign keys where given column of the given table is being used.\n */\n protected async dropColumnReferencedForeignKeys(tablePath: string, columnName: string): Promise<void> {\n const table = this.queryRunner.loadedTables.find(table => this.getTablePath(table) === tablePath);\n if (!table)\n return;\n\n const tablesWithFK: Table[] = [];\n const columnForeignKey = table.foreignKeys.find(foreignKey => foreignKey.columnNames.indexOf(columnName) !== -1);\n if (columnForeignKey) {\n const clonedTable = table.clone();\n clonedTable.foreignKeys = [columnForeignKey];\n tablesWithFK.push(clonedTable);\n table.removeForeignKey(columnForeignKey);\n }\n\n for (const loadedTable of this.queryRunner.loadedTables) {\n const dependForeignKeys = loadedTable.foreignKeys.filter(foreignKey => {\n return this.getTablePath(foreignKey) === tablePath && foreignKey.referencedColumnNames.indexOf(columnName) !== -1;\n });\n\n if (dependForeignKeys.length > 0) {\n const clonedTable = loadedTable.clone();\n clonedTable.foreignKeys = dependForeignKeys;\n tablesWithFK.push(clonedTable);\n dependForeignKeys.forEach(dependForeignKey => loadedTable.removeForeignKey(dependForeignKey));\n }\n }\n\n if (tablesWithFK.length > 0) {\n for (const tableWithFK of tablesWithFK) {\n this.connection.logger.logSchemaBuild(`dropping related foreign keys of ${tableWithFK.name}: ${tableWithFK.foreignKeys.map(foreignKey => foreignKey.name).join(\", \")}`);\n await this.queryRunner.dropForeignKeys(tableWithFK, tableWithFK.foreignKeys);\n }\n }\n }\n\n /**\n * Drops all composite indices, related to given column.\n */\n protected async dropColumnCompositeIndices(tablePath: string, columnName: string): Promise<void> {\n const table = this.queryRunner.loadedTables.find(table => this.getTablePath(table) === tablePath);\n if (!table)\n return;\n\n const relatedIndices = table.indices.filter(index => index.columnNames.length > 1 && index.columnNames.indexOf(columnName) !== -1);\n if (relatedIndices.length === 0)\n return;\n\n this.connection.logger.logSchemaBuild(`dropping related indices of \"${tablePath}\".\"${columnName}\": ${relatedIndices.map(index => index.name).join(\", \")}`);\n await this.queryRunner.dropIndices(table, relatedIndices);\n }\n\n /**\n * Drops all composite uniques, related to given column.\n */\n protected async dropColumnCompositeUniques(tablePath: string, columnName: string): Promise<void> {\n const table = this.queryRunner.loadedTables.find(table => this.getTablePath(table) === tablePath);\n if (!table)\n return;\n\n const relatedUniques = table.uniques.filter(unique => unique.columnNames.length > 1 && unique.columnNames.indexOf(columnName) !== -1);\n if (relatedUniques.length === 0)\n return;\n\n this.connection.logger.logSchemaBuild(`dropping related unique constraints of \"${tablePath}\".\"${columnName}\": ${relatedUniques.map(unique => unique.name).join(\", \")}`);\n await this.queryRunner.dropUniqueConstraints(table, relatedUniques);\n }\n\n /**\n * Creates new columns from the given column metadatas.\n */\n protected metadataColumnsToTableColumnOptions(columns: ColumnMetadata[]): TableColumnOptions[] {\n return columns.map(columnMetadata => TableUtils.createTableColumnOptions(columnMetadata, this.connection.driver));\n }\n\n /**\n * Creates typeorm service table for storing user defined Views.\n */\n protected async createTypeormMetadataTable(queryRunner: QueryRunner) {\n const schema = this.currentSchema;\n const database = this.currentDatabase;\n const typeormMetadataTable = this.connection.driver.buildTableName(\"typeorm_metadata\", schema, database);\n\n await queryRunner.createTable(new Table(\n {\n database: database,\n schema: schema,\n name: typeormMetadataTable,\n columns: [\n {\n name: \"type\",\n type: this.connection.driver.normalizeType({type: this.connection.driver.mappedDataTypes.metadataType}),\n isNullable: false\n },\n {\n name: \"database\",\n type: this.connection.driver.normalizeType({type: this.connection.driver.mappedDataTypes.metadataDatabase}),\n isNullable: true\n },\n {\n name: \"schema\",\n type: this.connection.driver.normalizeType({type: this.connection.driver.mappedDataTypes.metadataSchema}),\n isNullable: true\n },\n {\n name: \"table\",\n type: this.connection.driver.normalizeType({type: this.connection.driver.mappedDataTypes.metadataTable}),\n isNullable: true\n },\n {\n name: \"name\",\n type: this.connection.driver.normalizeType({type: this.connection.driver.mappedDataTypes.metadataName}),\n isNullable: true\n },\n {\n name: \"value\",\n type: this.connection.driver.normalizeType({type: this.connection.driver.mappedDataTypes.metadataValue}),\n isNullable: true\n },\n ]\n },\n ), true);\n }\n}\n"],"sourceRoot":".."}
|
|
1
|
+
{"version":3,"sources":["../browser/src/schema-builder/RdbmsSchemaBuilder.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,eAAe,EAAC,MAAM,uCAAuC,CAAC;AACtE,OAAO,EAAC,KAAK,EAAC,MAAM,eAAe,CAAC;AACpC,OAAO,EAAC,WAAW,EAAC,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAC,eAAe,EAAC,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAC,UAAU,EAAC,MAAM,oBAAoB,CAAC;AAO9C,OAAO,EAAC,UAAU,EAAC,MAAM,mBAAmB,CAAC;AAE7C,OAAO,EAAC,cAAc,EAAC,MAAM,mCAAmC,CAAC;AACjE,OAAO,EAAC,WAAW,EAAC,MAAM,6BAA6B,CAAC;AACxD,OAAO,EAAC,WAAW,EAAC,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAC,UAAU,EAAC,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAC,cAAc,EAAC,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAC,IAAI,EAAC,MAAM,aAAa,CAAC;AACjC,OAAO,EAAC,SAAS,EAAC,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAC,mBAAmB,EAAC,MAAM,+CAA+C,CAAC;AAElF;;;;;;;;;;;;;GAaG;AACH;IAUI,4EAA4E;IAC5E,cAAc;IACd,4EAA4E;IAE5E,4BAAsB,UAAsB;QAAtB,eAAU,GAAV,UAAU,CAAY;IAC5C,CAAC;IAED,4EAA4E;IAC5E,iBAAiB;IACjB,4EAA4E;IAE5E;;OAEG;IACG,kCAAK,GAAX;;;;;;;wBACI,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,UAAU,CAAC,iBAAiB,EAAE,CAAC;wBAEvD,2DAA2D;wBAC3D,IAAI,CAAC,eAAe,GAAG,IAAI,CA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AAC,UAAU,CAAC,MAAM,CAAC,aAAa,CAAC,EAAC,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,eAAe,CAAC,YAAY,EAAC,CAAC;wCACvG,UAAU,EAAE,IAAI;qCACnB;oCACD;wCACI,IAAI,EAAE,OAAO;wCACb,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,aAAa,CAAC,EAAC,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,eAAe,CAAC,aAAa,EAAC,CAAC;wCACxG,UAAU,EAAE,IAAI;qCACnB;iCACJ;6BACJ,CACJ,EAAE,IAAI,CAAC,EAAA;;wBAtCR,SAsCQ,CAAC;;;;;KACZ;IACL,yBAAC;AAAD,CAz0BA,AAy0BC,IAAA","file":"RdbmsSchemaBuilder.js","sourcesContent":["import {CockroachDriver} from \"../driver/cockroachdb/CockroachDriver\";\nimport {Table} from \"./table/Table\";\nimport {TableColumn} from \"./table/TableColumn\";\nimport {TableForeignKey} from \"./table/TableForeignKey\";\nimport {TableIndex} from \"./table/TableIndex\";\nimport {QueryRunner} from \"../query-runner/QueryRunner\";\nimport {ColumnMetadata} from \"../metadata/ColumnMetadata\";\nimport {EntityMetadata} from \"../metadata/EntityMetadata\";\nimport {Connection} from \"../connection/Connection\";\nimport {SchemaBuilder} from \"./SchemaBuilder\";\nimport {SqlInMemory} from \"../driver/SqlInMemory\";\nimport {TableUtils} from \"./util/TableUtils\";\nimport {TableColumnOptions} from \"./options/TableColumnOptions\";\nimport {PostgresDriver} from \"../driver/postgres/PostgresDriver\";\nimport {MysqlDriver} from \"../driver/mysql/MysqlDriver\";\nimport {TableUnique} from \"./table/TableUnique\";\nimport {TableCheck} from \"./table/TableCheck\";\nimport {TableExclusion} from \"./table/TableExclusion\";\nimport {View} from \"./view/View\";\nimport {ViewUtils} from \"./util/ViewUtils\";\nimport {AuroraDataApiDriver} from \"../driver/aurora-data-api/AuroraDataApiDriver\";\n\n/**\n * Creates complete tables schemas in the database based on the entity metadatas.\n *\n * Steps how schema is being built:\n * 1. load list of all tables with complete column and keys information from the db\n * 2. drop all (old) foreign keys that exist in the table, but does not exist in the metadata\n * 3. create new tables that does not exist in the db, but exist in the metadata\n * 4. drop all columns exist (left old) in the db table, but does not exist in the metadata\n * 5. add columns from metadata which does not exist in the table\n * 6. update all exist columns which metadata has changed\n * 7. update primary keys - update old and create new primary key from changed columns\n * 8. create foreign keys which does not exist in the table yet\n * 9. create indices which are missing in db yet, and drops indices which exist in the db, but does not exist in the metadata anymore\n */\nexport class RdbmsSchemaBuilder implements SchemaBuilder {\n /**\n * Used to execute schema creation queries in a single connection.\n */\n protected queryRunner: QueryRunner;\n\n private currentDatabase?: string;\n\n private currentSchema?: string;\n\n // -------------------------------------------------------------------------\n // Constructor\n // -------------------------------------------------------------------------\n\n constructor(protected connection: Connection) {\n }\n\n // -------------------------------------------------------------------------\n // Public Methods\n // -------------------------------------------------------------------------\n\n /**\n * Creates complete schemas for the given entity metadatas.\n */\n async build(): Promise<void> {\n this.queryRunner = this.connection.createQueryRunner();\n\n // this.connection.driver.database || this.currentDatabase;\n this.currentDatabase = this.connection.driver.database;\n this.currentSchema = this.connection.driver.schema;\n\n // CockroachDB implements asynchronous schema sync operations which can not been executed in transaction.\n // E.g. if you try to DROP column and ADD it again in the same transaction, crdb throws error.\n const isUsingTransactions = (\n !(this.connection.driver instanceof CockroachDriver) &&\n this.connection.options.migrationsTransactionMode !== \"none\"\n );\n\n if (isUsingTransactions) {\n await this.queryRunner.startTransaction();\n }\n\n try {\n await this.createMetadataTableIfNecessary(this.queryRunner);\n // Flush the queryrunner table & view cache\n const tablePaths = this.entityToSyncMetadatas.map(metadata => this.getTablePath(metadata));\n\n await this.queryRunner.getTables(tablePaths);\n await this.queryRunner.getViews([]);\n\n await this.executeSchemaSyncOperationsInProperOrder();\n\n // if cache is enabled then perform cache-synchronization as well\n if (this.connection.queryResultCache)\n await this.connection.queryResultCache.synchronize(this.queryRunner);\n\n if (isUsingTransactions) {\n await this.queryRunner.commitTransaction();\n }\n\n } catch (error) {\n\n try { // we throw original error even if rollback thrown an error\n if (isUsingTransactions) {\n await this.queryRunner.rollbackTransaction();\n }\n } catch (rollbackError) { }\n throw error;\n\n } finally {\n await this.queryRunner.release();\n }\n }\n\n /**\n * If the schema contains views, create the typeorm_metadata table if it doesn't exist yet\n */\n async createMetadataTableIfNecessary(queryRunner: QueryRunner): Promise<void> {\n if (this.viewEntityToSyncMetadatas.length > 0 || (this.connection.driver instanceof PostgresDriver && this.connection.driver.isGeneratedColumnsSupported)) {\n await this.createTypeormMetadataTable(queryRunner);\n }\n }\n\n /**\n * Returns sql queries to be executed by schema builder.\n */\n async log(): Promise<SqlInMemory> {\n this.queryRunner = this.connection.createQueryRunner();\n try {\n // Flush the queryrunner table & view cache\n const tablePaths = this.entityToSyncMetadatas.map(metadata => this.getTablePath(metadata));\n await this.queryRunner.getTables(tablePaths);\n await this.queryRunner.getViews([]);\n\n this.queryRunner.enableSqlMemory();\n await this.executeSchemaSyncOperationsInProperOrder();\n\n // if cache is enabled then perform cache-synchronization as well\n if (this.connection.queryResultCache) // todo: check this functionality\n await this.connection.queryResultCache.synchronize(this.queryRunner);\n\n return this.queryRunner.getMemorySql();\n\n } finally {\n // its important to disable this mode despite the fact we are release query builder\n // because there exist drivers which reuse same query runner. Also its important to disable\n // sql memory after call of getMemorySql() method because last one flushes sql memory.\n this.queryRunner.disableSqlMemory();\n await this.queryRunner.release();\n }\n }\n\n // -------------------------------------------------------------------------\n // Protected Methods\n // -------------------------------------------------------------------------\n\n /**\n * Returns only entities that should be synced in the database.\n */\n protected get entityToSyncMetadatas(): EntityMetadata[] {\n return this.connection.entityMetadatas.filter(metadata => metadata.synchronize && metadata.tableType !== \"entity-child\" && metadata.tableType !== \"view\");\n }\n\n /**\n * Returns only entities that should be synced in the database.\n */\n protected get viewEntityToSyncMetadatas(): EntityMetadata[] {\n return this.connection.entityMetadatas\n .filter(metadata => metadata.tableType === \"view\" && metadata.synchronize)\n // sort views in creation order by dependencies\n .sort(ViewUtils.viewMetadataCmp);\n }\n\n /**\n * Executes schema sync operations in a proper order.\n * Order of operations matter here.\n */\n protected async executeSchemaSyncOperationsInProperOrder(): Promise<void> {\n await this.dropOldViews();\n await this.dropOldForeignKeys();\n await this.dropOldIndices();\n await this.dropOldChecks();\n await this.dropOldExclusions();\n await this.dropCompositeUniqueConstraints();\n // await this.renameTables();\n await this.renameColumns();\n await this.createNewTables();\n await this.dropRemovedColumns();\n await this.addNewColumns();\n await this.updatePrimaryKeys();\n await this.updateExistColumns();\n await this.createNewIndices();\n await this.createNewChecks();\n await this.createNewExclusions();\n await this.createCompositeUniqueConstraints();\n await this.createForeignKeys();\n await this.createViews();\n }\n\n private getTablePath(target: EntityMetadata | Table | View | TableForeignKey | string): string {\n const parsed = this.connection.driver.parseTableName(target);\n\n return this.connection.driver.buildTableName(\n parsed.tableName,\n parsed.schema || this.currentSchema,\n parsed.database || this.currentDatabase\n );\n }\n\n /**\n * Drops all (old) foreign keys that exist in the tables, but do not exist in the entity metadata.\n */\n protected async dropOldForeignKeys(): Promise<void> {\n for (const metadata of this.entityToSyncMetadatas) {\n const table = this.queryRunner.loadedTables.find(table => this.getTablePath(table) === this.getTablePath(metadata));\n if (!table)\n continue;\n\n // find foreign keys that exist in the schemas but does not exist in the entity metadata\n const tableForeignKeysToDrop = table.foreignKeys.filter(tableForeignKey => {\n const metadataFK = metadata.foreignKeys.find(metadataForeignKey => (\n (tableForeignKey.name === metadataForeignKey.name) &&\n (this.getTablePath(tableForeignKey) === this.getTablePath(metadataForeignKey.referencedEntityMetadata))\n ));\n return !metadataFK\n || (metadataFK.onDelete && metadataFK.onDelete !== tableForeignKey.onDelete)\n || (metadataFK.onUpdate && metadataFK.onUpdate !== tableForeignKey.onUpdate);\n });\n if (tableForeignKeysToDrop.length === 0)\n continue;\n\n this.connection.logger.logSchemaBuild(`dropping old foreign keys of ${table.name}: ${tableForeignKeysToDrop.map(dbForeignKey => dbForeignKey.name).join(\", \")}`);\n\n // drop foreign keys from the database\n await this.queryRunner.dropForeignKeys(table, tableForeignKeysToDrop);\n }\n }\n\n /**\n * Rename tables\n */\n protected async renameTables(): Promise<void> {\n // for (const metadata of this.entityToSyncMetadatas) {\n // const table = this.queryRunner.loadedTables.find(table => this.getTablePath(table) === this.getTablePath(metadata));\n // }\n }\n\n /**\n * Renames columns.\n * Works if only one column per table was changed.\n * Changes only column name. If something besides name was changed, these changes will be ignored.\n */\n protected async renameColumns(): Promise<void> {\n for (const metadata of this.entityToSyncMetadatas) {\n const table = this.queryRunner.loadedTables.find(table => this.getTablePath(table) === this.getTablePath(metadata));\n if (!table)\n continue;\n\n if (metadata.columns.length !== table.columns.length)\n continue;\n\n const renamedMetadataColumns = metadata.columns.filter(column => {\n return !table.columns.find(tableColumn => {\n return tableColumn.name === column.databaseName\n && tableColumn.type === this.connection.driver.normalizeType(column)\n && tableColumn.isNullable === column.isNullable\n && tableColumn.isUnique === this.connection.driver.normalizeIsUnique(column);\n });\n });\n\n if (renamedMetadataColumns.length === 0 || renamedMetadataColumns.length > 1)\n continue;\n\n const renamedTableColumns = table.columns.filter(tableColumn => {\n return !metadata.columns.find(column => {\n return column.databaseName === tableColumn.name\n && this.connection.driver.normalizeType(column) === tableColumn.type\n && column.isNullable === tableColumn.isNullable\n && this.connection.driver.normalizeIsUnique(column) === tableColumn.isUnique;\n });\n });\n\n if (renamedTableColumns.length === 0 || renamedTableColumns.length > 1)\n continue;\n\n const renamedColumn = renamedTableColumns[0].clone();\n renamedColumn.name = renamedMetadataColumns[0].databaseName;\n\n this.connection.logger.logSchemaBuild(`renaming column \"${renamedTableColumns[0].name}\" in to \"${renamedColumn.name}\"`);\n await this.queryRunner.renameColumn(table, renamedTableColumns[0], renamedColumn);\n }\n }\n\n protected async dropOldIndices(): Promise<void> {\n for (const metadata of this.entityToSyncMetadatas) {\n const table = this.queryRunner.loadedTables.find(table => this.getTablePath(table) === this.getTablePath(metadata));\n if (!table)\n continue;\n\n const dropQueries = table.indices\n .filter(tableIndex => {\n const indexMetadata = metadata.indices.find(index => index.name === tableIndex.name);\n if (indexMetadata) {\n if (indexMetadata.synchronize === false)\n return false;\n\n if (indexMetadata.isUnique !== tableIndex.isUnique)\n return true;\n\n if (indexMetadata.isSpatial !== tableIndex.isSpatial)\n return true;\n\n if (this.connection.driver.isFullTextColumnTypeSupported() && indexMetadata.isFulltext !== tableIndex.isFulltext)\n return true;\n\n if (indexMetadata.columns.length !== tableIndex.columnNames.length)\n return true;\n\n return !indexMetadata.columns.every(column => tableIndex.columnNames.indexOf(column.databaseName) !== -1);\n }\n\n return true;\n })\n .map(async tableIndex => {\n this.connection.logger.logSchemaBuild(`dropping an index: \"${tableIndex.name}\" from table ${table.name}`);\n await this.queryRunner.dropIndex(table, tableIndex);\n });\n\n await Promise.all(dropQueries);\n }\n }\n\n protected async dropOldChecks(): Promise<void> {\n // Mysql does not support check constraints\n if (this.connection.driver instanceof MysqlDriver || this.connection.driver instanceof AuroraDataApiDriver)\n return;\n\n for (const metadata of this.entityToSyncMetadatas) {\n const table = this.queryRunner.loadedTables.find(table => this.getTablePath(table) === this.getTablePath(metadata));\n if (!table)\n continue;\n\n const oldChecks = table.checks.filter(tableCheck => {\n return !metadata.checks.find(checkMetadata => checkMetadata.name === tableCheck.name);\n });\n\n if (oldChecks.length === 0)\n continue;\n\n this.connection.logger.logSchemaBuild(`dropping old check constraint: ${oldChecks.map(check => `\"${check.name}\"`).join(\", \")} from table \"${table.name}\"`);\n await this.queryRunner.dropCheckConstraints(table, oldChecks);\n }\n }\n\n protected async dropCompositeUniqueConstraints(): Promise<void> {\n for (const metadata of this.entityToSyncMetadatas) {\n const table = this.queryRunner.loadedTables.find(table => this.getTablePath(table) === this.getTablePath(metadata));\n if (!table)\n continue;\n\n const compositeUniques = table.uniques.filter(tableUnique => {\n return tableUnique.columnNames.length > 1 && !metadata.uniques.find(uniqueMetadata => uniqueMetadata.name === tableUnique.name);\n });\n\n if (compositeUniques.length === 0)\n continue;\n\n this.connection.logger.logSchemaBuild(`dropping old unique constraint: ${compositeUniques.map(unique => `\"${unique.name}\"`).join(\", \")} from table \"${table.name}\"`);\n await this.queryRunner.dropUniqueConstraints(table, compositeUniques);\n }\n }\n\n protected async dropOldExclusions(): Promise<void> {\n // Only PostgreSQL supports exclusion constraints\n if (!(this.connection.driver instanceof PostgresDriver))\n return;\n\n for (const metadata of this.entityToSyncMetadatas) {\n const table = this.queryRunner.loadedTables.find(table => this.getTablePath(table) === this.getTablePath(metadata));\n if (!table)\n continue;\n\n const oldExclusions = table.exclusions.filter(tableExclusion => {\n return !metadata.exclusions.find(exclusionMetadata => exclusionMetadata.name === tableExclusion.name);\n });\n\n if (oldExclusions.length === 0)\n continue;\n\n this.connection.logger.logSchemaBuild(`dropping old exclusion constraint: ${oldExclusions.map(exclusion => `\"${exclusion.name}\"`).join(\", \")} from table \"${table.name}\"`);\n await this.queryRunner.dropExclusionConstraints(table, oldExclusions);\n }\n }\n\n /**\n * Creates tables that do not exist in the database yet.\n * New tables are created without foreign and primary keys.\n * Primary key only can be created in conclusion with auto generated column.\n */\n protected async createNewTables(): Promise<void> {\n for (const metadata of this.entityToSyncMetadatas) {\n // check if table does not exist yet\n const existTable = this.queryRunner.loadedTables.find(table => this.getTablePath(table) === this.getTablePath(metadata));\n if (existTable)\n continue;\n\n this.connection.logger.logSchemaBuild(`creating a new table: ${this.getTablePath(metadata)}`);\n\n // create a new table and sync it in the database\n const table = Table.create(metadata, this.connection.driver);\n await this.queryRunner.createTable(table, false, false);\n this.queryRunner.loadedTables.push(table);\n }\n }\n\n protected async createViews(): Promise<void> {\n for (const metadata of this.viewEntityToSyncMetadatas) {\n // check if view does not exist yet\n const existView = this.queryRunner.loadedViews.find(view => {\n const viewExpression = typeof view.expression === \"string\" ? view.expression.trim() : view.expression(this.connection).getQuery();\n const metadataExpression = typeof metadata.expression === \"string\" ? metadata.expression.trim() : metadata.expression!(this.connection).getQuery();\n return this.getTablePath(view) === this.getTablePath(metadata) && viewExpression === metadataExpression;\n });\n if (existView)\n continue;\n\n this.connection.logger.logSchemaBuild(`creating a new view: ${this.getTablePath(metadata)}`);\n\n // create a new view and sync it in the database\n const view = View.create(metadata, this.connection.driver);\n await this.queryRunner.createView(view);\n this.queryRunner.loadedViews.push(view);\n }\n }\n\n protected async dropOldViews(): Promise<void> {\n const droppedViews: Array<View> = [];\n const viewEntityToSyncMetadatas = this.viewEntityToSyncMetadatas;\n // BuIld lookup cache for finding views metadata\n const viewToMetadata = new Map<View, EntityMetadata>();\n for (const view of this.queryRunner.loadedViews) {\n const viewMetadata = viewEntityToSyncMetadatas.find(metadata => {\n return this.getTablePath(view) === this.getTablePath(metadata);\n });\n if(viewMetadata){\n viewToMetadata.set(view, viewMetadata);\n }\n }\n // Gather all changed view, that need a drop\n for (const view of this.queryRunner.loadedViews) {\n const viewMetadata = viewToMetadata.get(view);\n if(!viewMetadata){\n continue;\n }\n const viewExpression = typeof view.expression === \"string\" ? view.expression.trim() : view.expression(this.connection).getQuery();\n const metadataExpression = typeof viewMetadata.expression === \"string\" ? viewMetadata.expression.trim() : viewMetadata.expression!(this.connection).getQuery();\n\n if (viewExpression === metadataExpression)\n continue;\n\n this.connection.logger.logSchemaBuild(`dropping an old view: ${view.name}`);\n\n // Collect view to be dropped\n droppedViews.push(view);\n }\n\n // Helper function that for a given view, will recursively return list of the view and all views that depend on it\n const viewDependencyChain = (view: View): View[] => {\n // Get the view metadata\n const viewMetadata = viewToMetadata.get(view);\n let viewWithDependencies = [view];\n // If no metadata is known for the view, simply return the view itself\n if(!viewMetadata){\n return viewWithDependencies;\n }\n // Iterate over all known views\n for(const [currentView, currentMetadata] of viewToMetadata.entries()){\n // Ignore self reference\n if(currentView === view) {\n continue;\n }\n // If the currently iterated view depends on the passed in view\n if(currentMetadata.dependsOn && (\n currentMetadata.dependsOn.has(viewMetadata.target) ||\n currentMetadata.dependsOn.has(viewMetadata.name)\n )){\n // Recursively add currently iterate view and its dependents\n viewWithDependencies = viewWithDependencies.concat(viewDependencyChain(currentView));\n }\n }\n // Return all collected views\n return viewWithDependencies;\n };\n\n // Collect final list of views to be dropped in a Set so there are no duplicates\n const droppedViewsWithDependencies: Set<View> = new Set(\n // Collect all dropped views, and their dependencies\n droppedViews.map(view => viewDependencyChain(view))\n // Flattened to single Array ( can be replaced with flatMap, once supported)\n .reduce((all, segment) => {\n return all.concat(segment);\n }, [])\n // Sort the views to be dropped in creation order\n .sort((a, b)=> {\n return ViewUtils.viewMetadataCmp(viewToMetadata.get(a), viewToMetadata.get(b));\n })\n // reverse order to get drop order\n .reverse()\n );\n\n // Finally emit all drop views\n for(const view of droppedViewsWithDependencies){\n await this.queryRunner.dropView(view);\n }\n this.queryRunner.loadedViews = this.queryRunner.loadedViews.filter(view => !droppedViewsWithDependencies.has(view));\n }\n\n /**\n * Drops all columns that exist in the table, but does not exist in the metadata (left old).\n * We drop their keys too, since it should be safe.\n */\n protected async dropRemovedColumns(): Promise<void> {\n for (const metadata of this.entityToSyncMetadatas) {\n const table = this.queryRunner.loadedTables.find(table => this.getTablePath(table) === this.getTablePath(metadata));\n if (!table)\n continue;\n\n // find columns that exist in the database but does not exist in the metadata\n const droppedTableColumns = table.columns.filter(tableColumn => {\n return !metadata.columns.find(columnMetadata => columnMetadata.databaseName === tableColumn.name);\n });\n if (droppedTableColumns.length === 0)\n continue;\n\n this.connection.logger.logSchemaBuild(`columns dropped in ${table.name}: ` + droppedTableColumns.map(column => column.name).join(\", \"));\n\n // drop columns from the database\n await this.queryRunner.dropColumns(table, droppedTableColumns);\n }\n }\n\n /**\n * Adds columns from metadata which does not exist in the table.\n * Columns are created without keys.\n */\n protected async addNewColumns(): Promise<void> {\n for (const metadata of this.entityToSyncMetadatas) {\n const table = this.queryRunner.loadedTables.find(table => this.getTablePath(table) === this.getTablePath(metadata));\n if (!table)\n continue;\n\n // find which columns are new\n const newColumnMetadatas = metadata.columns.filter(columnMetadata => {\n return !table.columns.find(tableColumn => tableColumn.name === columnMetadata.databaseName);\n });\n if (newColumnMetadatas.length === 0)\n continue;\n\n // create columns in the database\n const newTableColumnOptions = this.metadataColumnsToTableColumnOptions(newColumnMetadatas);\n const newTableColumns = newTableColumnOptions.map(option => new TableColumn(option));\n\n if (newTableColumns.length === 0)\n continue;\n\n this.connection.logger.logSchemaBuild(`new columns added: ` + newColumnMetadatas.map(column => column.databaseName).join(\", \"));\n await this.queryRunner.addColumns(table, newTableColumns);\n }\n }\n\n /**\n * Updates composite primary keys.\n */\n protected async updatePrimaryKeys(): Promise<void> {\n for (const metadata of this.entityToSyncMetadatas) {\n const table = this.queryRunner.loadedTables.find(table => this.getTablePath(table) === this.getTablePath(metadata));\n if (!table)\n continue;\n\n const primaryMetadataColumns = metadata.columns.filter(column => column.isPrimary);\n const primaryTableColumns = table.columns.filter(column => column.isPrimary);\n if (primaryTableColumns.length !== primaryMetadataColumns.length && primaryMetadataColumns.length > 1) {\n const changedPrimaryColumns = primaryMetadataColumns.map(primaryMetadataColumn => {\n return new TableColumn(TableUtils.createTableColumnOptions(primaryMetadataColumn, this.connection.driver));\n });\n await this.queryRunner.updatePrimaryKeys(table, changedPrimaryColumns);\n }\n }\n }\n\n /**\n * Update all exist columns which metadata has changed.\n * Still don't create keys. Also we don't touch foreign keys of the changed columns.\n */\n protected async updateExistColumns(): Promise<void> {\n for (const metadata of this.entityToSyncMetadatas) {\n const table = this.queryRunner.loadedTables.find(table => this.getTablePath(table) === this.getTablePath(metadata));\n if (!table)\n continue;\n\n const changedColumns = this.connection.driver.findChangedColumns(table.columns, metadata.columns);\n if (changedColumns.length === 0)\n continue;\n\n // drop all foreign keys that point to this column\n for (const changedColumn of changedColumns) {\n await this.dropColumnReferencedForeignKeys(this.getTablePath(metadata), changedColumn.databaseName);\n }\n\n // drop all composite indices related to this column\n for (const changedColumn of changedColumns) {\n await this.dropColumnCompositeIndices(this.getTablePath(metadata), changedColumn.databaseName);\n }\n\n // drop all composite uniques related to this column\n // Mysql does not support unique constraints.\n if (!(this.connection.driver instanceof MysqlDriver || this.connection.driver instanceof AuroraDataApiDriver)) {\n for (const changedColumn of changedColumns) {\n await this.dropColumnCompositeUniques(this.getTablePath(metadata), changedColumn.databaseName);\n }\n }\n\n // generate a map of new/old columns\n const newAndOldTableColumns = changedColumns.map(changedColumn => {\n const oldTableColumn = table.columns.find(column => column.name === changedColumn.databaseName)!;\n const newTableColumnOptions = TableUtils.createTableColumnOptions(changedColumn, this.connection.driver);\n const newTableColumn = new TableColumn(newTableColumnOptions);\n\n return {\n oldColumn: oldTableColumn,\n newColumn: newTableColumn\n };\n });\n\n if (newAndOldTableColumns.length === 0)\n continue;\n\n this.connection.logger.logSchemaBuild(`columns changed in \"${table.name}\". updating: ` + changedColumns.map(column => column.databaseName).join(\", \"));\n await this.queryRunner.changeColumns(table, newAndOldTableColumns);\n }\n }\n\n /**\n * Creates composite indices which are missing in db yet.\n */\n protected async createNewIndices(): Promise<void> {\n for (const metadata of this.entityToSyncMetadatas) {\n const table = this.queryRunner.loadedTables.find(table => this.getTablePath(table) === this.getTablePath(metadata));\n if (!table)\n continue;\n\n const newIndices = metadata.indices\n .filter(indexMetadata => !table.indices.find(tableIndex => tableIndex.name === indexMetadata.name) && indexMetadata.synchronize === true)\n .map(indexMetadata => TableIndex.create(indexMetadata));\n\n if (newIndices.length === 0)\n continue;\n\n this.connection.logger.logSchemaBuild(`adding new indices ${newIndices.map(index => `\"${index.name}\"`).join(\", \")} in table \"${table.name}\"`);\n await this.queryRunner.createIndices(table, newIndices);\n }\n }\n\n protected async createNewChecks(): Promise<void> {\n // Mysql does not support check constraints\n if (this.connection.driver instanceof MysqlDriver || this.connection.driver instanceof AuroraDataApiDriver)\n return;\n\n for (const metadata of this.entityToSyncMetadatas) {\n const table = this.queryRunner.loadedTables.find(table => this.getTablePath(table) === this.getTablePath(metadata));\n if (!table)\n continue;\n\n const newChecks = metadata.checks\n .filter(checkMetadata => !table.checks.find(tableCheck => tableCheck.name === checkMetadata.name))\n .map(checkMetadata => TableCheck.create(checkMetadata));\n\n if (newChecks.length === 0)\n continue;\n\n this.connection.logger.logSchemaBuild(`adding new check constraints: ${newChecks.map(index => `\"${index.name}\"`).join(\", \")} in table \"${table.name}\"`);\n await this.queryRunner.createCheckConstraints(table, newChecks);\n }\n }\n\n /**\n * Creates composite uniques which are missing in db yet.\n */\n protected async createCompositeUniqueConstraints(): Promise<void> {\n for (const metadata of this.entityToSyncMetadatas) {\n const table = this.queryRunner.loadedTables.find(table => this.getTablePath(table) === this.getTablePath(metadata));\n if (!table)\n continue;\n\n const compositeUniques = metadata.uniques\n .filter(uniqueMetadata => uniqueMetadata.columns.length > 1 && !table.uniques.find(tableUnique => tableUnique.name === uniqueMetadata.name))\n .map(uniqueMetadata => TableUnique.create(uniqueMetadata));\n\n if (compositeUniques.length === 0)\n continue;\n\n this.connection.logger.logSchemaBuild(`adding new unique constraints: ${compositeUniques.map(unique => `\"${unique.name}\"`).join(\", \")} in table \"${table.name}\"`);\n await this.queryRunner.createUniqueConstraints(table, compositeUniques);\n }\n }\n\n /**\n * Creates exclusions which are missing in db yet.\n */\n protected async createNewExclusions(): Promise<void> {\n // Only PostgreSQL supports exclusion constraints\n if (!(this.connection.driver instanceof PostgresDriver))\n return;\n\n for (const metadata of this.entityToSyncMetadatas) {\n const table = this.queryRunner.loadedTables.find(table => this.getTablePath(table) === this.getTablePath(metadata));\n if (!table)\n continue;\n\n const newExclusions = metadata.exclusions\n .filter(exclusionMetadata => !table.exclusions.find(tableExclusion => tableExclusion.name === exclusionMetadata.name))\n .map(exclusionMetadata => TableExclusion.create(exclusionMetadata));\n\n if (newExclusions.length === 0)\n continue;\n\n this.connection.logger.logSchemaBuild(`adding new exclusion constraints: ${newExclusions.map(exclusion => `\"${exclusion.name}\"`).join(\", \")} in table \"${table.name}\"`);\n await this.queryRunner.createExclusionConstraints(table, newExclusions);\n }\n }\n\n /**\n * Creates foreign keys which does not exist in the table yet.\n */\n protected async createForeignKeys(): Promise<void> {\n for (const metadata of this.entityToSyncMetadatas) {\n const table = this.queryRunner.loadedTables.find(table => this.getTablePath(table) === this.getTablePath(metadata));\n if (!table)\n continue;\n\n const newKeys = metadata.foreignKeys\n .filter(foreignKey => {\n return !table.foreignKeys.find(dbForeignKey => (\n (dbForeignKey.name === foreignKey.name) &&\n (this.getTablePath(dbForeignKey) === this.getTablePath(foreignKey.referencedEntityMetadata))\n ));\n });\n if (newKeys.length === 0)\n continue;\n\n const dbForeignKeys = newKeys.map(foreignKeyMetadata => TableForeignKey.create(foreignKeyMetadata, this.connection.driver));\n this.connection.logger.logSchemaBuild(`creating a foreign keys: ${newKeys.map(key => key.name).join(\", \")} on table \"${table.name}\"`);\n await this.queryRunner.createForeignKeys(table, dbForeignKeys);\n }\n }\n\n /**\n * Drops all foreign keys where given column of the given table is being used.\n */\n protected async dropColumnReferencedForeignKeys(tablePath: string, columnName: string): Promise<void> {\n const table = this.queryRunner.loadedTables.find(table => this.getTablePath(table) === tablePath);\n if (!table)\n return;\n\n const tablesWithFK: Table[] = [];\n const columnForeignKey = table.foreignKeys.find(foreignKey => foreignKey.columnNames.indexOf(columnName) !== -1);\n if (columnForeignKey) {\n const clonedTable = table.clone();\n clonedTable.foreignKeys = [columnForeignKey];\n tablesWithFK.push(clonedTable);\n table.removeForeignKey(columnForeignKey);\n }\n\n for (const loadedTable of this.queryRunner.loadedTables) {\n const dependForeignKeys = loadedTable.foreignKeys.filter(foreignKey => {\n return this.getTablePath(foreignKey) === tablePath && foreignKey.referencedColumnNames.indexOf(columnName) !== -1;\n });\n\n if (dependForeignKeys.length > 0) {\n const clonedTable = loadedTable.clone();\n clonedTable.foreignKeys = dependForeignKeys;\n tablesWithFK.push(clonedTable);\n dependForeignKeys.forEach(dependForeignKey => loadedTable.removeForeignKey(dependForeignKey));\n }\n }\n\n if (tablesWithFK.length > 0) {\n for (const tableWithFK of tablesWithFK) {\n this.connection.logger.logSchemaBuild(`dropping related foreign keys of ${tableWithFK.name}: ${tableWithFK.foreignKeys.map(foreignKey => foreignKey.name).join(\", \")}`);\n await this.queryRunner.dropForeignKeys(tableWithFK, tableWithFK.foreignKeys);\n }\n }\n }\n\n /**\n * Drops all composite indices, related to given column.\n */\n protected async dropColumnCompositeIndices(tablePath: string, columnName: string): Promise<void> {\n const table = this.queryRunner.loadedTables.find(table => this.getTablePath(table) === tablePath);\n if (!table)\n return;\n\n const relatedIndices = table.indices.filter(index => index.columnNames.length > 1 && index.columnNames.indexOf(columnName) !== -1);\n if (relatedIndices.length === 0)\n return;\n\n this.connection.logger.logSchemaBuild(`dropping related indices of \"${tablePath}\".\"${columnName}\": ${relatedIndices.map(index => index.name).join(\", \")}`);\n await this.queryRunner.dropIndices(table, relatedIndices);\n }\n\n /**\n * Drops all composite uniques, related to given column.\n */\n protected async dropColumnCompositeUniques(tablePath: string, columnName: string): Promise<void> {\n const table = this.queryRunner.loadedTables.find(table => this.getTablePath(table) === tablePath);\n if (!table)\n return;\n\n const relatedUniques = table.uniques.filter(unique => unique.columnNames.length > 1 && unique.columnNames.indexOf(columnName) !== -1);\n if (relatedUniques.length === 0)\n return;\n\n this.connection.logger.logSchemaBuild(`dropping related unique constraints of \"${tablePath}\".\"${columnName}\": ${relatedUniques.map(unique => unique.name).join(\", \")}`);\n await this.queryRunner.dropUniqueConstraints(table, relatedUniques);\n }\n\n /**\n * Creates new columns from the given column metadatas.\n */\n protected metadataColumnsToTableColumnOptions(columns: ColumnMetadata[]): TableColumnOptions[] {\n return columns.map(columnMetadata => TableUtils.createTableColumnOptions(columnMetadata, this.connection.driver));\n }\n\n /**\n * Creates typeorm service table for storing user defined Views.\n */\n protected async createTypeormMetadataTable(queryRunner: QueryRunner) {\n const schema = this.currentSchema;\n const database = this.currentDatabase;\n const typeormMetadataTable = this.connection.driver.buildTableName(this.connection.metadataTableName, schema, database);\n\n await queryRunner.createTable(new Table(\n {\n database: database,\n schema: schema,\n name: typeormMetadataTable,\n columns: [\n {\n name: \"type\",\n type: this.connection.driver.normalizeType({type: this.connection.driver.mappedDataTypes.metadataType}),\n isNullable: false\n },\n {\n name: \"database\",\n type: this.connection.driver.normalizeType({type: this.connection.driver.mappedDataTypes.metadataDatabase}),\n isNullable: true\n },\n {\n name: \"schema\",\n type: this.connection.driver.normalizeType({type: this.connection.driver.mappedDataTypes.metadataSchema}),\n isNullable: true\n },\n {\n name: \"table\",\n type: this.connection.driver.normalizeType({type: this.connection.driver.mappedDataTypes.metadataTable}),\n isNullable: true\n },\n {\n name: \"name\",\n type: this.connection.driver.normalizeType({type: this.connection.driver.mappedDataTypes.metadataName}),\n isNullable: true\n },\n {\n name: \"value\",\n type: this.connection.driver.normalizeType({type: this.connection.driver.mappedDataTypes.metadataValue}),\n isNullable: true\n },\n ]\n },\n ), true);\n }\n}\n"],"sourceRoot":".."}
|
|
@@ -45,6 +45,11 @@ export interface BaseConnectionOptions {
|
|
|
45
45
|
* Transaction mode for migrations to run in
|
|
46
46
|
*/
|
|
47
47
|
readonly migrationsTransactionMode?: "all" | "none" | "each";
|
|
48
|
+
/**
|
|
49
|
+
* Typeorm metadata table name, in case of different name from "typeorm_metadata".
|
|
50
|
+
* Accepts single string name.
|
|
51
|
+
*/
|
|
52
|
+
readonly metadataTableName?: string;
|
|
48
53
|
/**
|
|
49
54
|
* Naming strategy to be used to name tables and columns in the database.
|
|
50
55
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/connection/BaseConnectionOptions.ts"],"names":[],"mappings":"","file":"BaseConnectionOptions.js","sourcesContent":["import {EntitySchema} from \"../entity-schema/EntitySchema\";\nimport {LoggerOptions} from \"../logger/LoggerOptions\";\nimport {NamingStrategyInterface} from \"../naming-strategy/NamingStrategyInterface\";\nimport {DatabaseType} from \"../driver/types/DatabaseType\";\nimport {Logger} from \"../logger/Logger\";\nimport {Connection} from \"./Connection\";\nimport {QueryResultCache} from \"../cache/QueryResultCache\";\n\n/**\n * BaseConnectionOptions is set of connection options shared by all database types.\n */\nexport interface BaseConnectionOptions {\n\n /**\n * Database type. This value is required.\n */\n readonly type: DatabaseType;\n\n /**\n * Connection name. If connection name is not given then it will be called \"default\".\n * Different connections must have different names.\n */\n readonly name?: string;\n\n /**\n * Entities to be loaded for this connection.\n * Accepts both entity classes and directories where from entities need to be loaded.\n * Directories support glob patterns.\n */\n readonly entities?: ((Function|string|EntitySchema<any>))[];\n\n /**\n * Subscribers to be loaded for this connection.\n * Accepts both subscriber classes and directories where from subscribers need to be loaded.\n * Directories support glob patterns.\n */\n readonly subscribers?: (Function|string)[];\n\n /**\n * Migrations to be loaded for this connection.\n * Accepts both migration classes and directories where from migrations need to be loaded.\n * Directories support glob patterns.\n */\n readonly migrations?: (Function|string)[];\n\n /**\n * Migrations table name, in case of different name from \"migrations\".\n * Accepts single string name.\n */\n readonly migrationsTableName?: string;\n\n /**\n * Transaction mode for migrations to run in\n */\n readonly migrationsTransactionMode?: \"all\" | \"none\" | \"each\";\n\n /**\n * Naming strategy to be used to name tables and columns in the database.\n */\n readonly namingStrategy?: NamingStrategyInterface;\n\n /**\n * Logging options.\n */\n readonly logging?: LoggerOptions;\n\n /**\n * Logger instance used to log queries and events in the ORM.\n */\n readonly logger?: \"advanced-console\"|\"simple-console\"|\"file\"|\"debug\"|Logger;\n\n /**\n * Maximum number of milliseconds query should be executed before logger log a warning.\n */\n readonly maxQueryExecutionTime?: number;\n\n /**\n * Indicates if database schema should be auto created on every application launch.\n * Be careful with this option and don't use this in production - otherwise you can lose production data.\n * This option is useful during debug and development.\n * Alternative to it, you can use CLI and run schema:sync command.\n *\n * Note that for MongoDB database it does not create schema, because MongoDB is schemaless.\n * Instead, it syncs just by creating indices.\n */\n readonly synchronize?: boolean;\n\n /**\n * Indicates if migrations should be auto run on every application launch.\n * Alternative to it, you can use CLI and run migrations:run command.\n */\n readonly migrationsRun?: boolean;\n\n /**\n * Drops the schema each time connection is being established.\n * Be careful with this option and don't use this in production - otherwise you'll lose all production data.\n * This option is useful during debug and development.\n */\n readonly dropSchema?: boolean;\n\n /**\n * Prefix to use on all tables (collections) of this connection in the database.\n */\n readonly entityPrefix?: string;\n\n /**\n * When creating new Entity instances, skip all constructors when true.\n */\n readonly entitySkipConstructor?: boolean;\n\n /**\n * Extra connection options to be passed to the underlying driver.\n *\n * todo: deprecate this and move all database-specific types into hts own connection options object.\n */\n readonly extra?: any;\n\n /**\n * Allows to setup cache options.\n */\n readonly cache?: boolean|{\n\n /**\n * Type of caching.\n *\n * - \"database\" means cached values will be stored in the separate table in database. This is default value.\n * - \"redis\" means cached values will be stored inside redis. You must provide redis connection options.\n */\n readonly type?: \"database\" | \"redis\" | \"ioredis\" | \"ioredis/cluster\"; // todo: add mongodb and other cache providers as well in the future\n\n /**\n * Factory function for custom cache providers that implement QueryResultCache.\n */\n readonly provider?: (connection: Connection) => QueryResultCache;\n\n /**\n * Configurable table name for \"database\" type cache.\n * Default value is \"query-result-cache\"\n */\n readonly tableName?: string;\n\n /**\n * Used to provide redis connection options.\n */\n readonly options?: any;\n\n /**\n * If set to true then queries (using find methods and QueryBuilder's methods) will always be cached.\n */\n readonly alwaysEnabled?: boolean;\n\n /**\n * Time in milliseconds in which cache will expire.\n * This can be setup per-query.\n * Default value is 1000 which is equivalent to 1 second.\n */\n readonly duration?: number;\n\n /**\n * Used to specify if cache errors should be ignored, and pass through the call to the Database.\n */\n readonly ignoreErrors?: boolean;\n };\n\n /**\n * CLI settings.\n */\n readonly cli?: {\n\n /**\n * Directory where entities should be created by default.\n */\n readonly entitiesDir?: string;\n\n /**\n * Directory where migrations should be created by default.\n */\n readonly migrationsDir?: string;\n\n /**\n * Directory where subscribers should be created by default.\n */\n readonly subscribersDir?: string;\n\n };\n\n}\n"],"sourceRoot":".."}
|
|
1
|
+
{"version":3,"sources":["../../src/connection/BaseConnectionOptions.ts"],"names":[],"mappings":"","file":"BaseConnectionOptions.js","sourcesContent":["import {EntitySchema} from \"../entity-schema/EntitySchema\";\nimport {LoggerOptions} from \"../logger/LoggerOptions\";\nimport {NamingStrategyInterface} from \"../naming-strategy/NamingStrategyInterface\";\nimport {DatabaseType} from \"../driver/types/DatabaseType\";\nimport {Logger} from \"../logger/Logger\";\nimport {Connection} from \"./Connection\";\nimport {QueryResultCache} from \"../cache/QueryResultCache\";\n\n/**\n * BaseConnectionOptions is set of connection options shared by all database types.\n */\nexport interface BaseConnectionOptions {\n\n /**\n * Database type. This value is required.\n */\n readonly type: DatabaseType;\n\n /**\n * Connection name. If connection name is not given then it will be called \"default\".\n * Different connections must have different names.\n */\n readonly name?: string;\n\n /**\n * Entities to be loaded for this connection.\n * Accepts both entity classes and directories where from entities need to be loaded.\n * Directories support glob patterns.\n */\n readonly entities?: ((Function|string|EntitySchema<any>))[];\n\n /**\n * Subscribers to be loaded for this connection.\n * Accepts both subscriber classes and directories where from subscribers need to be loaded.\n * Directories support glob patterns.\n */\n readonly subscribers?: (Function|string)[];\n\n /**\n * Migrations to be loaded for this connection.\n * Accepts both migration classes and directories where from migrations need to be loaded.\n * Directories support glob patterns.\n */\n readonly migrations?: (Function|string)[];\n\n /**\n * Migrations table name, in case of different name from \"migrations\".\n * Accepts single string name.\n */\n readonly migrationsTableName?: string;\n\n /**\n * Transaction mode for migrations to run in\n */\n readonly migrationsTransactionMode?: \"all\" | \"none\" | \"each\";\n\n /**\n * Typeorm metadata table name, in case of different name from \"typeorm_metadata\".\n * Accepts single string name.\n */\n readonly metadataTableName?: string;\n\n /**\n * Naming strategy to be used to name tables and columns in the database.\n */\n readonly namingStrategy?: NamingStrategyInterface;\n\n /**\n * Logging options.\n */\n readonly logging?: LoggerOptions;\n\n /**\n * Logger instance used to log queries and events in the ORM.\n */\n readonly logger?: \"advanced-console\"|\"simple-console\"|\"file\"|\"debug\"|Logger;\n\n /**\n * Maximum number of milliseconds query should be executed before logger log a warning.\n */\n readonly maxQueryExecutionTime?: number;\n\n /**\n * Indicates if database schema should be auto created on every application launch.\n * Be careful with this option and don't use this in production - otherwise you can lose production data.\n * This option is useful during debug and development.\n * Alternative to it, you can use CLI and run schema:sync command.\n *\n * Note that for MongoDB database it does not create schema, because MongoDB is schemaless.\n * Instead, it syncs just by creating indices.\n */\n readonly synchronize?: boolean;\n\n /**\n * Indicates if migrations should be auto run on every application launch.\n * Alternative to it, you can use CLI and run migrations:run command.\n */\n readonly migrationsRun?: boolean;\n\n /**\n * Drops the schema each time connection is being established.\n * Be careful with this option and don't use this in production - otherwise you'll lose all production data.\n * This option is useful during debug and development.\n */\n readonly dropSchema?: boolean;\n\n /**\n * Prefix to use on all tables (collections) of this connection in the database.\n */\n readonly entityPrefix?: string;\n\n /**\n * When creating new Entity instances, skip all constructors when true.\n */\n readonly entitySkipConstructor?: boolean;\n\n /**\n * Extra connection options to be passed to the underlying driver.\n *\n * todo: deprecate this and move all database-specific types into hts own connection options object.\n */\n readonly extra?: any;\n\n /**\n * Allows to setup cache options.\n */\n readonly cache?: boolean|{\n\n /**\n * Type of caching.\n *\n * - \"database\" means cached values will be stored in the separate table in database. This is default value.\n * - \"redis\" means cached values will be stored inside redis. You must provide redis connection options.\n */\n readonly type?: \"database\" | \"redis\" | \"ioredis\" | \"ioredis/cluster\"; // todo: add mongodb and other cache providers as well in the future\n\n /**\n * Factory function for custom cache providers that implement QueryResultCache.\n */\n readonly provider?: (connection: Connection) => QueryResultCache;\n\n /**\n * Configurable table name for \"database\" type cache.\n * Default value is \"query-result-cache\"\n */\n readonly tableName?: string;\n\n /**\n * Used to provide redis connection options.\n */\n readonly options?: any;\n\n /**\n * If set to true then queries (using find methods and QueryBuilder's methods) will always be cached.\n */\n readonly alwaysEnabled?: boolean;\n\n /**\n * Time in milliseconds in which cache will expire.\n * This can be setup per-query.\n * Default value is 1000 which is equivalent to 1 second.\n */\n readonly duration?: number;\n\n /**\n * Used to specify if cache errors should be ignored, and pass through the call to the Database.\n */\n readonly ignoreErrors?: boolean;\n };\n\n /**\n * CLI settings.\n */\n readonly cli?: {\n\n /**\n * Directory where entities should be created by default.\n */\n readonly entitiesDir?: string;\n\n /**\n * Directory where migrations should be created by default.\n */\n readonly migrationsDir?: string;\n\n /**\n * Directory where subscribers should be created by default.\n */\n readonly subscribersDir?: string;\n\n };\n\n}\n"],"sourceRoot":".."}
|
|
@@ -50,6 +50,10 @@ export declare class Connection {
|
|
|
50
50
|
* Naming strategy used in the connection.
|
|
51
51
|
*/
|
|
52
52
|
readonly namingStrategy: NamingStrategyInterface;
|
|
53
|
+
/**
|
|
54
|
+
* Name for the metadata table
|
|
55
|
+
*/
|
|
56
|
+
readonly metadataTableName: string;
|
|
53
57
|
/**
|
|
54
58
|
* Logger used to log orm events.
|
|
55
59
|
*/
|
package/connection/Connection.js
CHANGED
|
@@ -53,6 +53,7 @@ var Connection = /** @class */ (function () {
|
|
|
53
53
|
this.driver = new DriverFactory_1.DriverFactory().create(this);
|
|
54
54
|
this.manager = this.createEntityManager();
|
|
55
55
|
this.namingStrategy = options.namingStrategy || new DefaultNamingStrategy_1.DefaultNamingStrategy();
|
|
56
|
+
this.metadataTableName = options.metadataTableName || "typeorm_metadata";
|
|
56
57
|
this.queryResultCache = options.cache ? new QueryResultCacheFactory_1.QueryResultCacheFactory(this).create() : undefined;
|
|
57
58
|
this.relationLoader = new RelationLoader_1.RelationLoader(this);
|
|
58
59
|
this.isConnected = false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/connection/Connection.ts"],"names":[],"mappings":";;;;AAMA,kFAA+E;AAC/E,0FAAuF;AACvF,kGAA+F;AAK/F,oFAAiF;AAEjF,oEAAiE;AAGjE,6DAA0D;AAC1D,2EAAwE;AACxE,uFAAoF;AAEpF,4GAAyG;AACzG,+EAA4E;AAC5E,yDAAsD;AACtD,yEAAsE;AAEtE,0EAAuE;AACvE,yDAAsD;AACtD,4EAAyE;AAEzE,2EAAwE;AACxE,kEAA+D;AAC/D,8DAA2D;AAC3D,uEAAoE;AACpE,2DAAwD;AACxD,mDAAgD;AAEhD,qFAAkF;AAElF,sDAAqD;AAErD;;;;GAIG;AACH;IAkEI,4EAA4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C;wBAG/B,qBAAM,yBAAyB,CAAC,oBAAoB,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,IAAI,EAAE,CAAC,EAAA;;wBAAnG,eAAe,GAAG,SAAiF;wBACzG,yBAAW,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,eAAe,EAAE,eAAe,EAAE,CAAC,CAAC;wBAG5C,qBAAM,yBAAyB,CAAC,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,IAAI,EAAE,CAAC,EAAA;;wBAA3F,UAAU,GAAG,SAA8E;wBACjG,yBAAW,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,UAAU,EAAE,UAAU,EAAE,CAAC,CAAC;wBAErD,iGAAiG;wBACjG,uBAAuB,CAAC,YAAY,CAAC,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,UAAA,QAAQ,IAAI,OAAA,QAAQ,CAAC,SAAS,KAAK,MAAM,EAA7B,CAA6B,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;;;;;KAC7H;IACL,iBAAC;AAAD,CAxdA,AAwdC,IAAA;AAxdY,gCAAU","file":"Connection.js","sourcesContent":["import {Driver} from \"../driver/Driver\";\nimport {Repository} from \"../repository/Repository\";\nimport {EntitySubscriberInterface} from \"../subscriber/EntitySubscriberInterface\";\nimport {EntityTarget} from \"../common/EntityTarget\";\nimport {ObjectType} from \"../common/ObjectType\";\nimport {EntityManager} from \"../entity-manager/EntityManager\";\nimport {DefaultNamingStrategy} from \"../naming-strategy/DefaultNamingStrategy\";\nimport {CannotExecuteNotConnectedError} from \"../error/CannotExecuteNotConnectedError\";\nimport {CannotConnectAlreadyConnectedError} from \"../error/CannotConnectAlreadyConnectedError\";\nimport {TreeRepository} from \"../repository/TreeRepository\";\nimport {NamingStrategyInterface} from \"../naming-strategy/NamingStrategyInterface\";\nimport {EntityMetadata} from \"../metadata/EntityMetadata\";\nimport {Logger} from \"../logger/Logger\";\nimport {EntityMetadataNotFoundError} from \"../error/EntityMetadataNotFoundError\";\nimport {MigrationInterface} from \"../migration/MigrationInterface\";\nimport {MigrationExecutor} from \"../migration/MigrationExecutor\";\nimport {Migration} from \"../migration/Migration\";\nimport {MongoRepository} from \"../repository/MongoRepository\";\nimport {MongoDriver} from \"../driver/mongodb/MongoDriver\";\nimport {MongoEntityManager} from \"../entity-manager/MongoEntityManager\";\nimport {EntityMetadataValidator} from \"../metadata-builder/EntityMetadataValidator\";\nimport {ConnectionOptions} from \"./ConnectionOptions\";\nimport {QueryRunnerProviderAlreadyReleasedError} from \"../error/QueryRunnerProviderAlreadyReleasedError\";\nimport {EntityManagerFactory} from \"../entity-manager/EntityManagerFactory\";\nimport {DriverFactory} from \"../driver/DriverFactory\";\nimport {ConnectionMetadataBuilder} from \"./ConnectionMetadataBuilder\";\nimport {QueryRunner} from \"../query-runner/QueryRunner\";\nimport {SelectQueryBuilder} from \"../query-builder/SelectQueryBuilder\";\nimport {LoggerFactory} from \"../logger/LoggerFactory\";\nimport {QueryResultCacheFactory} from \"../cache/QueryResultCacheFactory\";\nimport {QueryResultCache} from \"../cache/QueryResultCache\";\nimport {SqljsEntityManager} from \"../entity-manager/SqljsEntityManager\";\nimport {RelationLoader} from \"../query-builder/RelationLoader\";\nimport {EntitySchema} from \"../entity-schema/EntitySchema\";\nimport {SqlServerDriver} from \"../driver/sqlserver/SqlServerDriver\";\nimport {MysqlDriver} from \"../driver/mysql/MysqlDriver\";\nimport {ObjectUtils} from \"../util/ObjectUtils\";\nimport {IsolationLevel} from \"../driver/types/IsolationLevel\";\nimport {AuroraDataApiDriver} from \"../driver/aurora-data-api/AuroraDataApiDriver\";\nimport {ReplicationMode} from \"../driver/types/ReplicationMode\";\nimport { TypeORMError } from \"../error/TypeORMError\";\n\n/**\n * Connection is a single database ORM connection to a specific database.\n * Its not required to be a database connection, depend on database type it can create connection pool.\n * You can have multiple connections to multiple databases in your application.\n */\nexport class Connection {\n\n // -------------------------------------------------------------------------\n // Public Readonly Properties\n // -------------------------------------------------------------------------\n\n /**\n * Connection name.\n */\n readonly name: string;\n\n /**\n * Connection options.\n */\n readonly options: ConnectionOptions;\n\n /**\n * Indicates if connection is initialized or not.\n */\n readonly isConnected: boolean;\n\n /**\n * Database driver used by this connection.\n */\n readonly driver: Driver;\n\n /**\n * EntityManager of this connection.\n */\n readonly manager: EntityManager;\n\n /**\n * Naming strategy used in the connection.\n */\n readonly namingStrategy: NamingStrategyInterface;\n\n /**\n * Logger used to log orm events.\n */\n readonly logger: Logger;\n\n /**\n * Migration instances that are registered for this connection.\n */\n readonly migrations: MigrationInterface[] = [];\n\n /**\n * Entity subscriber instances that are registered for this connection.\n */\n readonly subscribers: EntitySubscriberInterface<any>[] = [];\n\n /**\n * All entity metadatas that are registered for this connection.\n */\n readonly entityMetadatas: EntityMetadata[] = [];\n\n /**\n * Used to work with query result cache.\n */\n readonly queryResultCache?: QueryResultCache;\n\n /**\n * Used to load relations and work with lazy relations.\n */\n readonly relationLoader: RelationLoader;\n\n // -------------------------------------------------------------------------\n // Constructor\n // -------------------------------------------------------------------------\n\n constructor(options: ConnectionOptions) {\n this.name = options.name || \"default\";\n this.options = options;\n this.logger = new LoggerFactory().create(this.options.logger, this.options.logging);\n this.driver = new DriverFactory().create(this);\n this.manager = this.createEntityManager();\n this.namingStrategy = options.namingStrategy || new DefaultNamingStrategy();\n this.queryResultCache = options.cache ? new QueryResultCacheFactory(this).create() : undefined;\n this.relationLoader = new RelationLoader(this);\n this.isConnected = false;\n }\n\n // -------------------------------------------------------------------------\n // Public Accessors\n // -------------------------------------------------------------------------\n\n /**\n * Gets the mongodb entity manager that allows to perform mongodb-specific repository operations\n * with any entity in this connection.\n *\n * Available only in mongodb connections.\n */\n get mongoManager(): MongoEntityManager {\n if (!(this.manager instanceof MongoEntityManager))\n throw new TypeORMError(`MongoEntityManager is only available for MongoDB databases.`);\n\n return this.manager as MongoEntityManager;\n }\n\n /**\n * Gets a sql.js specific Entity Manager that allows to perform special load and save operations\n *\n * Available only in connection with the sqljs driver.\n */\n get sqljsManager(): SqljsEntityManager {\n if (!(this.manager instanceof SqljsEntityManager))\n throw new TypeORMError(`SqljsEntityManager is only available for Sqljs databases.`);\n\n return this.manager as SqljsEntityManager;\n }\n\n // -------------------------------------------------------------------------\n // Public Methods\n // -------------------------------------------------------------------------\n\n /**\n * Performs connection to the database.\n * This method should be called once on application bootstrap.\n * This method not necessarily creates database connection (depend on database type),\n * but it also can setup a connection pool with database to use.\n */\n async connect(): Promise<this> {\n if (this.isConnected)\n throw new CannotConnectAlreadyConnectedError(this.name);\n\n // connect to the database via its driver\n await this.driver.connect();\n\n // connect to the cache-specific database if cache is enabled\n if (this.queryResultCache)\n await this.queryResultCache.connect();\n\n // set connected status for the current connection\n ObjectUtils.assign(this, { isConnected: true });\n\n try {\n\n // build all metadatas registered in the current connection\n await this.buildMetadatas();\n\n await this.driver.afterConnect();\n\n // if option is set - drop schema once connection is done\n if (this.options.dropSchema)\n await this.dropDatabase();\n\n // if option is set - automatically synchronize a schema\n if (this.options.synchronize)\n await this.synchronize();\n\n // if option is set - automatically synchronize a schema\n if (this.options.migrationsRun)\n await this.runMigrations({ transaction: this.options.migrationsTransactionMode });\n\n } catch (error) {\n\n // if for some reason build metadata fail (for example validation error during entity metadata check)\n // connection needs to be closed\n await this.close();\n throw error;\n }\n\n return this;\n }\n\n /**\n * Closes connection with the database.\n * Once connection is closed, you cannot use repositories or perform any operations except opening connection again.\n */\n async close(): Promise<void> {\n if (!this.isConnected)\n throw new CannotExecuteNotConnectedError(this.name);\n\n await this.driver.disconnect();\n\n // disconnect from the cache-specific database if cache was enabled\n if (this.queryResultCache)\n await this.queryResultCache.disconnect();\n\n ObjectUtils.assign(this, { isConnected: false });\n }\n\n /**\n * Creates database schema for all entities registered in this connection.\n * Can be used only after connection to the database is established.\n *\n * @param dropBeforeSync If set to true then it drops the database with all its tables and data\n */\n async synchronize(dropBeforeSync: boolean = false): Promise<void> {\n\n if (!this.isConnected)\n throw new CannotExecuteNotConnectedError(this.name);\n\n if (dropBeforeSync)\n await this.dropDatabase();\n\n const schemaBuilder = this.driver.createSchemaBuilder();\n await schemaBuilder.build();\n }\n\n /**\n * Drops the database and all its data.\n * Be careful with this method on production since this method will erase all your database tables and their data.\n * Can be used only after connection to the database is established.\n */\n // TODO rename\n async dropDatabase(): Promise<void> {\n const queryRunner = this.createQueryRunner();\n try {\n if (this.driver instanceof SqlServerDriver || this.driver instanceof MysqlDriver || this.driver instanceof AuroraDataApiDriver) {\n const databases: string[] = this.driver.database ? [this.driver.database] : [];\n this.entityMetadatas.forEach(metadata => {\n if (metadata.database && databases.indexOf(metadata.database) === -1)\n databases.push(metadata.database);\n });\n\n for (const database of databases) {\n await queryRunner.clearDatabase(database);\n }\n } else {\n await queryRunner.clearDatabase();\n }\n } finally {\n await queryRunner.release();\n }\n }\n\n /**\n * Runs all pending migrations.\n * Can be used only after connection to the database is established.\n */\n async runMigrations(options?: { transaction?: \"all\" | \"none\" | \"each\" }): Promise<Migration[]> {\n if (!this.isConnected)\n throw new CannotExecuteNotConnectedError(this.name);\n\n const migrationExecutor = new MigrationExecutor(this);\n migrationExecutor.transaction = (options && options.transaction) || \"all\";\n\n const successMigrations = await migrationExecutor.executePendingMigrations();\n return successMigrations;\n }\n\n /**\n * Reverts last executed migration.\n * Can be used only after connection to the database is established.\n */\n async undoLastMigration(options?: { transaction?: \"all\" | \"none\" | \"each\" }): Promise<void> {\n\n if (!this.isConnected)\n throw new CannotExecuteNotConnectedError(this.name);\n\n const migrationExecutor = new MigrationExecutor(this);\n migrationExecutor.transaction = (options && options.transaction) || \"all\";\n\n await migrationExecutor.undoLastMigration();\n }\n\n /**\n * Lists all migrations and whether they have been run.\n * Returns true if there are pending migrations\n */\n async showMigrations(): Promise<boolean> {\n if (!this.isConnected) {\n throw new CannotExecuteNotConnectedError(this.name);\n }\n const migrationExecutor = new MigrationExecutor(this);\n return await migrationExecutor.showMigrations();\n }\n\n /**\n * Checks if entity metadata exist for the given entity class, target name or table name.\n */\n hasMetadata(target: EntityTarget<any>): boolean {\n return !!this.findMetadata(target);\n }\n\n /**\n * Gets entity metadata for the given entity class or schema name.\n */\n getMetadata(target: EntityTarget<any>): EntityMetadata {\n const metadata = this.findMetadata(target);\n if (!metadata)\n throw new EntityMetadataNotFoundError(target);\n\n return metadata;\n }\n\n /**\n * Gets repository for the given entity.\n */\n getRepository<Entity>(target: EntityTarget<Entity>): Repository<Entity> {\n return this.manager.getRepository(target);\n }\n\n /**\n * Gets tree repository for the given entity class or name.\n * Only tree-type entities can have a TreeRepository, like ones decorated with @Tree decorator.\n */\n getTreeRepository<Entity>(target: EntityTarget<Entity>): TreeRepository<Entity> {\n return this.manager.getTreeRepository(target);\n }\n\n /**\n * Gets mongodb-specific repository for the given entity class or name.\n * Works only if connection is mongodb-specific.\n */\n getMongoRepository<Entity>(target: EntityTarget<Entity>): MongoRepository<Entity> {\n if (!(this.driver instanceof MongoDriver))\n throw new TypeORMError(`You can use getMongoRepository only for MongoDB connections.`);\n\n return this.manager.getRepository(target) as any;\n }\n\n /**\n * Gets custom entity repository marked with @EntityRepository decorator.\n */\n getCustomRepository<T>(customRepository: ObjectType<T>): T {\n return this.manager.getCustomRepository(customRepository);\n }\n\n /**\n * Wraps given function execution (and all operations made there) into a transaction.\n * All database operations must be executed using provided entity manager.\n */\n async transaction<T>(runInTransaction: (entityManager: EntityManager) => Promise<T>): Promise<T>;\n async transaction<T>(isolationLevel: IsolationLevel, runInTransaction: (entityManager: EntityManager) => Promise<T>): Promise<T>;\n async transaction<T>(\n isolationOrRunInTransaction: IsolationLevel | ((entityManager: EntityManager) => Promise<T>),\n runInTransactionParam?: (entityManager: EntityManager) => Promise<T>\n ): Promise<any> {\n return this.manager.transaction(\n isolationOrRunInTransaction as any,\n runInTransactionParam as any\n );\n }\n\n /**\n * Executes raw SQL query and returns raw database results.\n */\n async query(query: string, parameters?: any[], queryRunner?: QueryRunner): Promise<any> {\n if (this instanceof MongoEntityManager)\n throw new TypeORMError(`Queries aren't supported by MongoDB.`);\n\n if (queryRunner && queryRunner.isReleased)\n throw new QueryRunnerProviderAlreadyReleasedError();\n\n const usedQueryRunner = queryRunner || this.createQueryRunner();\n\n try {\n return await usedQueryRunner.query(query, parameters); // await is needed here because we are using finally\n\n } finally {\n if (!queryRunner)\n await usedQueryRunner.release();\n }\n }\n\n /**\n * Creates a new query builder that can be used to build a SQL query.\n */\n createQueryBuilder<Entity>(entityClass: EntityTarget<Entity>, alias: string, queryRunner?: QueryRunner): SelectQueryBuilder<Entity>;\n\n /**\n * Creates a new query builder that can be used to build a SQL query.\n */\n createQueryBuilder(queryRunner?: QueryRunner): SelectQueryBuilder<any>;\n\n /**\n * Creates a new query builder that can be used to build a SQL query.\n */\n createQueryBuilder<Entity>(entityOrRunner?: EntityTarget<Entity>|QueryRunner, alias?: string, queryRunner?: QueryRunner): SelectQueryBuilder<Entity> {\n if (this instanceof MongoEntityManager)\n throw new TypeORMError(`Query Builder is not supported by MongoDB.`);\n\n if (alias) {\n const metadata = this.getMetadata(entityOrRunner as EntityTarget<Entity>);\n return new SelectQueryBuilder(this, queryRunner)\n .select(alias)\n .from(metadata.target, alias);\n\n } else {\n return new SelectQueryBuilder(this, entityOrRunner as QueryRunner|undefined);\n }\n }\n\n /**\n * Creates a query runner used for perform queries on a single database connection.\n * Using query runners you can control your queries to execute using single database connection and\n * manually control your database transaction.\n *\n * Mode is used in replication mode and indicates whatever you want to connect\n * to master database or any of slave databases.\n * If you perform writes you must use master database,\n * if you perform reads you can use slave databases.\n */\n createQueryRunner(mode: ReplicationMode = \"master\"): QueryRunner {\n const queryRunner = this.driver.createQueryRunner(mode);\n const manager = this.createEntityManager(queryRunner);\n Object.assign(queryRunner, { manager: manager });\n return queryRunner;\n }\n\n /**\n * Gets entity metadata of the junction table (many-to-many table).\n */\n getManyToManyMetadata(entityTarget: EntityTarget<any>, relationPropertyPath: string) {\n const relationMetadata = this.getMetadata(entityTarget).findRelationWithPropertyPath(relationPropertyPath);\n if (!relationMetadata)\n throw new TypeORMError(`Relation \"${relationPropertyPath}\" was not found in ${entityTarget} entity.`);\n if (!relationMetadata.isManyToMany)\n throw new TypeORMError(`Relation \"${entityTarget}#${relationPropertyPath}\" does not have a many-to-many relationship.` +\n `You can use this method only on many-to-many relations.`);\n\n return relationMetadata.junctionEntityMetadata;\n }\n\n /**\n * Creates an Entity Manager for the current connection with the help of the EntityManagerFactory.\n */\n createEntityManager(queryRunner?: QueryRunner): EntityManager {\n return new EntityManagerFactory().create(this, queryRunner);\n }\n\n // -------------------------------------------------------------------------\n // Protected Methods\n // -------------------------------------------------------------------------\n\n /**\n * Finds exist entity metadata by the given entity class, target name or table name.\n */\n protected findMetadata(target: EntityTarget<any>): EntityMetadata|undefined {\n return this.entityMetadatas.find(metadata => {\n if (metadata.target === target)\n return true;\n if (target instanceof EntitySchema) {\n return metadata.name === target.options.name;\n }\n if (typeof target === \"string\") {\n if (target.indexOf(\".\") !== -1) {\n return metadata.tablePath === target;\n } else {\n return metadata.name === target || metadata.tableName === target;\n }\n }\n\n return false;\n });\n }\n\n /**\n * Builds metadatas for all registered classes inside this connection.\n */\n protected async buildMetadatas(): Promise<void> {\n\n const connectionMetadataBuilder = new ConnectionMetadataBuilder(this);\n const entityMetadataValidator = new EntityMetadataValidator();\n\n // create subscribers instances if they are not disallowed from high-level (for example they can disallowed from migrations run process)\n const subscribers = await connectionMetadataBuilder.buildSubscribers(this.options.subscribers || []);\n ObjectUtils.assign(this, { subscribers: subscribers });\n\n // build entity metadatas\n const entityMetadatas = await connectionMetadataBuilder.buildEntityMetadatas(this.options.entities || []);\n ObjectUtils.assign(this, { entityMetadatas: entityMetadatas });\n\n // create migration instances\n const migrations = await connectionMetadataBuilder.buildMigrations(this.options.migrations || []);\n ObjectUtils.assign(this, { migrations: migrations });\n\n // validate all created entity metadatas to make sure user created entities are valid and correct\n entityMetadataValidator.validateMany(this.entityMetadatas.filter(metadata => metadata.tableType !== \"view\"), this.driver);\n }\n}\n"],"sourceRoot":".."}
|
|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\"../driver/Driver\";\nimport {Repository} from \"../repository/Repository\";\nimport {EntitySubscriberInterface} from \"../subscriber/EntitySubscriberInterface\";\nimport {EntityTarget} from \"../common/EntityTarget\";\nimport {ObjectType} from \"../common/ObjectType\";\nimport {EntityManager} from \"../entity-manager/EntityManager\";\nimport {DefaultNamingStrategy} from \"../naming-strategy/DefaultNamingStrategy\";\nimport {CannotExecuteNotConnectedError} from \"../error/CannotExecuteNotConnectedError\";\nimport {CannotConnectAlreadyConnectedError} from \"../error/CannotConnectAlreadyConnectedError\";\nimport {TreeRepository} from \"../repository/TreeRepository\";\nimport {NamingStrategyInterface} from \"../naming-strategy/NamingStrategyInterface\";\nimport {EntityMetadata} from \"../metadata/EntityMetadata\";\nimport {Logger} from \"../logger/Logger\";\nimport {EntityMetadataNotFoundError} from \"../error/EntityMetadataNotFoundError\";\nimport {MigrationInterface} from \"../migration/MigrationInterface\";\nimport {MigrationExecutor} from \"../migration/MigrationExecutor\";\nimport {Migration} from \"../migration/Migration\";\nimport {MongoRepository} from \"../repository/MongoRepository\";\nimport {MongoDriver} from \"../driver/mongodb/MongoDriver\";\nimport {MongoEntityManager} from \"../entity-manager/MongoEntityManager\";\nimport {EntityMetadataValidator} from \"../metadata-builder/EntityMetadataValidator\";\nimport {ConnectionOptions} from \"./ConnectionOptions\";\nimport {QueryRunnerProviderAlreadyReleasedError} from \"../error/QueryRunnerProviderAlreadyReleasedError\";\nimport {EntityManagerFactory} from \"../entity-manager/EntityManagerFactory\";\nimport {DriverFactory} from \"../driver/DriverFactory\";\nimport {ConnectionMetadataBuilder} from \"./ConnectionMetadataBuilder\";\nimport {QueryRunner} from \"../query-runner/QueryRunner\";\nimport {SelectQueryBuilder} from \"../query-builder/SelectQueryBuilder\";\nimport {LoggerFactory} from \"../logger/LoggerFactory\";\nimport {QueryResultCacheFactory} from \"../cache/QueryResultCacheFactory\";\nimport {QueryResultCache} from \"../cache/QueryResultCache\";\nimport {SqljsEntityManager} from \"../entity-manager/SqljsEntityManager\";\nimport {RelationLoader} from \"../query-builder/RelationLoader\";\nimport {EntitySchema} from \"../entity-schema/EntitySchema\";\nimport {SqlServerDriver} from \"../driver/sqlserver/SqlServerDriver\";\nimport {MysqlDriver} from \"../driver/mysql/MysqlDriver\";\nimport {ObjectUtils} from \"../util/ObjectUtils\";\nimport {IsolationLevel} from \"../driver/types/IsolationLevel\";\nimport {AuroraDataApiDriver} from \"../driver/aurora-data-api/AuroraDataApiDriver\";\nimport {ReplicationMode} from \"../driver/types/ReplicationMode\";\nimport { TypeORMError } from \"../error/TypeORMError\";\n\n/**\n * Connection is a single database ORM connection to a specific database.\n * Its not required to be a database connection, depend on database type it can create connection pool.\n * You can have multiple connections to multiple databases in your application.\n */\nexport class Connection {\n\n // -------------------------------------------------------------------------\n // Public Readonly Properties\n // -------------------------------------------------------------------------\n\n /**\n * Connection name.\n */\n readonly name: string;\n\n /**\n * Connection options.\n */\n readonly options: ConnectionOptions;\n\n /**\n * Indicates if connection is initialized or not.\n */\n readonly isConnected: boolean;\n\n /**\n * Database driver used by this connection.\n */\n readonly driver: Driver;\n\n /**\n * EntityManager of this connection.\n */\n readonly manager: EntityManager;\n\n /**\n * Naming strategy used in the connection.\n */\n readonly namingStrategy: NamingStrategyInterface;\n\n /**\n * Name for the metadata table\n */\n readonly metadataTableName: string;\n\n /**\n * Logger used to log orm events.\n */\n readonly logger: Logger;\n\n /**\n * Migration instances that are registered for this connection.\n */\n readonly migrations: MigrationInterface[] = [];\n\n /**\n * Entity subscriber instances that are registered for this connection.\n */\n readonly subscribers: EntitySubscriberInterface<any>[] = [];\n\n /**\n * All entity metadatas that are registered for this connection.\n */\n readonly entityMetadatas: EntityMetadata[] = [];\n\n /**\n * Used to work with query result cache.\n */\n readonly queryResultCache?: QueryResultCache;\n\n /**\n * Used to load relations and work with lazy relations.\n */\n readonly relationLoader: RelationLoader;\n\n // -------------------------------------------------------------------------\n // Constructor\n // -------------------------------------------------------------------------\n\n constructor(options: ConnectionOptions) {\n this.name = options.name || \"default\";\n this.options = options;\n this.logger = new LoggerFactory().create(this.options.logger, this.options.logging);\n this.driver = new DriverFactory().create(this);\n this.manager = this.createEntityManager();\n this.namingStrategy = options.namingStrategy || new DefaultNamingStrategy();\n this.metadataTableName = options.metadataTableName || \"typeorm_metadata\";\n this.queryResultCache = options.cache ? new QueryResultCacheFactory(this).create() : undefined;\n this.relationLoader = new RelationLoader(this);\n this.isConnected = false;\n }\n\n // -------------------------------------------------------------------------\n // Public Accessors\n // -------------------------------------------------------------------------\n\n /**\n * Gets the mongodb entity manager that allows to perform mongodb-specific repository operations\n * with any entity in this connection.\n *\n * Available only in mongodb connections.\n */\n get mongoManager(): MongoEntityManager {\n if (!(this.manager instanceof MongoEntityManager))\n throw new TypeORMError(`MongoEntityManager is only available for MongoDB databases.`);\n\n return this.manager as MongoEntityManager;\n }\n\n /**\n * Gets a sql.js specific Entity Manager that allows to perform special load and save operations\n *\n * Available only in connection with the sqljs driver.\n */\n get sqljsManager(): SqljsEntityManager {\n if (!(this.manager instanceof SqljsEntityManager))\n throw new TypeORMError(`SqljsEntityManager is only available for Sqljs databases.`);\n\n return this.manager as SqljsEntityManager;\n }\n\n // -------------------------------------------------------------------------\n // Public Methods\n // -------------------------------------------------------------------------\n\n /**\n * Performs connection to the database.\n * This method should be called once on application bootstrap.\n * This method not necessarily creates database connection (depend on database type),\n * but it also can setup a connection pool with database to use.\n */\n async connect(): Promise<this> {\n if (this.isConnected)\n throw new CannotConnectAlreadyConnectedError(this.name);\n\n // connect to the database via its driver\n await this.driver.connect();\n\n // connect to the cache-specific database if cache is enabled\n if (this.queryResultCache)\n await this.queryResultCache.connect();\n\n // set connected status for the current connection\n ObjectUtils.assign(this, { isConnected: true });\n\n try {\n\n // build all metadatas registered in the current connection\n await this.buildMetadatas();\n\n await this.driver.afterConnect();\n\n // if option is set - drop schema once connection is done\n if (this.options.dropSchema)\n await this.dropDatabase();\n\n // if option is set - automatically synchronize a schema\n if (this.options.synchronize)\n await this.synchronize();\n\n // if option is set - automatically synchronize a schema\n if (this.options.migrationsRun)\n await this.runMigrations({ transaction: this.options.migrationsTransactionMode });\n\n } catch (error) {\n\n // if for some reason build metadata fail (for example validation error during entity metadata check)\n // connection needs to be closed\n await this.close();\n throw error;\n }\n\n return this;\n }\n\n /**\n * Closes connection with the database.\n * Once connection is closed, you cannot use repositories or perform any operations except opening connection again.\n */\n async close(): Promise<void> {\n if (!this.isConnected)\n throw new CannotExecuteNotConnectedError(this.name);\n\n await this.driver.disconnect();\n\n // disconnect from the cache-specific database if cache was enabled\n if (this.queryResultCache)\n await this.queryResultCache.disconnect();\n\n ObjectUtils.assign(this, { isConnected: false });\n }\n\n /**\n * Creates database schema for all entities registered in this connection.\n * Can be used only after connection to the database is established.\n *\n * @param dropBeforeSync If set to true then it drops the database with all its tables and data\n */\n async synchronize(dropBeforeSync: boolean = false): Promise<void> {\n\n if (!this.isConnected)\n throw new CannotExecuteNotConnectedError(this.name);\n\n if (dropBeforeSync)\n await this.dropDatabase();\n\n const schemaBuilder = this.driver.createSchemaBuilder();\n await schemaBuilder.build();\n }\n\n /**\n * Drops the database and all its data.\n * Be careful with this method on production since this method will erase all your database tables and their data.\n * Can be used only after connection to the database is established.\n */\n // TODO rename\n async dropDatabase(): Promise<void> {\n const queryRunner = this.createQueryRunner();\n try {\n if (this.driver instanceof SqlServerDriver || this.driver instanceof MysqlDriver || this.driver instanceof AuroraDataApiDriver) {\n const databases: string[] = this.driver.database ? [this.driver.database] : [];\n this.entityMetadatas.forEach(metadata => {\n if (metadata.database && databases.indexOf(metadata.database) === -1)\n databases.push(metadata.database);\n });\n\n for (const database of databases) {\n await queryRunner.clearDatabase(database);\n }\n } else {\n await queryRunner.clearDatabase();\n }\n } finally {\n await queryRunner.release();\n }\n }\n\n /**\n * Runs all pending migrations.\n * Can be used only after connection to the database is established.\n */\n async runMigrations(options?: { transaction?: \"all\" | \"none\" | \"each\" }): Promise<Migration[]> {\n if (!this.isConnected)\n throw new CannotExecuteNotConnectedError(this.name);\n\n const migrationExecutor = new MigrationExecutor(this);\n migrationExecutor.transaction = (options && options.transaction) || \"all\";\n\n const successMigrations = await migrationExecutor.executePendingMigrations();\n return successMigrations;\n }\n\n /**\n * Reverts last executed migration.\n * Can be used only after connection to the database is established.\n */\n async undoLastMigration(options?: { transaction?: \"all\" | \"none\" | \"each\" }): Promise<void> {\n\n if (!this.isConnected)\n throw new CannotExecuteNotConnectedError(this.name);\n\n const migrationExecutor = new MigrationExecutor(this);\n migrationExecutor.transaction = (options && options.transaction) || \"all\";\n\n await migrationExecutor.undoLastMigration();\n }\n\n /**\n * Lists all migrations and whether they have been run.\n * Returns true if there are pending migrations\n */\n async showMigrations(): Promise<boolean> {\n if (!this.isConnected) {\n throw new CannotExecuteNotConnectedError(this.name);\n }\n const migrationExecutor = new MigrationExecutor(this);\n return await migrationExecutor.showMigrations();\n }\n\n /**\n * Checks if entity metadata exist for the given entity class, target name or table name.\n */\n hasMetadata(target: EntityTarget<any>): boolean {\n return !!this.findMetadata(target);\n }\n\n /**\n * Gets entity metadata for the given entity class or schema name.\n */\n getMetadata(target: EntityTarget<any>): EntityMetadata {\n const metadata = this.findMetadata(target);\n if (!metadata)\n throw new EntityMetadataNotFoundError(target);\n\n return metadata;\n }\n\n /**\n * Gets repository for the given entity.\n */\n getRepository<Entity>(target: EntityTarget<Entity>): Repository<Entity> {\n return this.manager.getRepository(target);\n }\n\n /**\n * Gets tree repository for the given entity class or name.\n * Only tree-type entities can have a TreeRepository, like ones decorated with @Tree decorator.\n */\n getTreeRepository<Entity>(target: EntityTarget<Entity>): TreeRepository<Entity> {\n return this.manager.getTreeRepository(target);\n }\n\n /**\n * Gets mongodb-specific repository for the given entity class or name.\n * Works only if connection is mongodb-specific.\n */\n getMongoRepository<Entity>(target: EntityTarget<Entity>): MongoRepository<Entity> {\n if (!(this.driver instanceof MongoDriver))\n throw new TypeORMError(`You can use getMongoRepository only for MongoDB connections.`);\n\n return this.manager.getRepository(target) as any;\n }\n\n /**\n * Gets custom entity repository marked with @EntityRepository decorator.\n */\n getCustomRepository<T>(customRepository: ObjectType<T>): T {\n return this.manager.getCustomRepository(customRepository);\n }\n\n /**\n * Wraps given function execution (and all operations made there) into a transaction.\n * All database operations must be executed using provided entity manager.\n */\n async transaction<T>(runInTransaction: (entityManager: EntityManager) => Promise<T>): Promise<T>;\n async transaction<T>(isolationLevel: IsolationLevel, runInTransaction: (entityManager: EntityManager) => Promise<T>): Promise<T>;\n async transaction<T>(\n isolationOrRunInTransaction: IsolationLevel | ((entityManager: EntityManager) => Promise<T>),\n runInTransactionParam?: (entityManager: EntityManager) => Promise<T>\n ): Promise<any> {\n return this.manager.transaction(\n isolationOrRunInTransaction as any,\n runInTransactionParam as any\n );\n }\n\n /**\n * Executes raw SQL query and returns raw database results.\n */\n async query(query: string, parameters?: any[], queryRunner?: QueryRunner): Promise<any> {\n if (this instanceof MongoEntityManager)\n throw new TypeORMError(`Queries aren't supported by MongoDB.`);\n\n if (queryRunner && queryRunner.isReleased)\n throw new QueryRunnerProviderAlreadyReleasedError();\n\n const usedQueryRunner = queryRunner || this.createQueryRunner();\n\n try {\n return await usedQueryRunner.query(query, parameters); // await is needed here because we are using finally\n\n } finally {\n if (!queryRunner)\n await usedQueryRunner.release();\n }\n }\n\n /**\n * Creates a new query builder that can be used to build a SQL query.\n */\n createQueryBuilder<Entity>(entityClass: EntityTarget<Entity>, alias: string, queryRunner?: QueryRunner): SelectQueryBuilder<Entity>;\n\n /**\n * Creates a new query builder that can be used to build a SQL query.\n */\n createQueryBuilder(queryRunner?: QueryRunner): SelectQueryBuilder<any>;\n\n /**\n * Creates a new query builder that can be used to build a SQL query.\n */\n createQueryBuilder<Entity>(entityOrRunner?: EntityTarget<Entity>|QueryRunner, alias?: string, queryRunner?: QueryRunner): SelectQueryBuilder<Entity> {\n if (this instanceof MongoEntityManager)\n throw new TypeORMError(`Query Builder is not supported by MongoDB.`);\n\n if (alias) {\n const metadata = this.getMetadata(entityOrRunner as EntityTarget<Entity>);\n return new SelectQueryBuilder(this, queryRunner)\n .select(alias)\n .from(metadata.target, alias);\n\n } else {\n return new SelectQueryBuilder(this, entityOrRunner as QueryRunner|undefined);\n }\n }\n\n /**\n * Creates a query runner used for perform queries on a single database connection.\n * Using query runners you can control your queries to execute using single database connection and\n * manually control your database transaction.\n *\n * Mode is used in replication mode and indicates whatever you want to connect\n * to master database or any of slave databases.\n * If you perform writes you must use master database,\n * if you perform reads you can use slave databases.\n */\n createQueryRunner(mode: ReplicationMode = \"master\"): QueryRunner {\n const queryRunner = this.driver.createQueryRunner(mode);\n const manager = this.createEntityManager(queryRunner);\n Object.assign(queryRunner, { manager: manager });\n return queryRunner;\n }\n\n /**\n * Gets entity metadata of the junction table (many-to-many table).\n */\n getManyToManyMetadata(entityTarget: EntityTarget<any>, relationPropertyPath: string) {\n const relationMetadata = this.getMetadata(entityTarget).findRelationWithPropertyPath(relationPropertyPath);\n if (!relationMetadata)\n throw new TypeORMError(`Relation \"${relationPropertyPath}\" was not found in ${entityTarget} entity.`);\n if (!relationMetadata.isManyToMany)\n throw new TypeORMError(`Relation \"${entityTarget}#${relationPropertyPath}\" does not have a many-to-many relationship.` +\n `You can use this method only on many-to-many relations.`);\n\n return relationMetadata.junctionEntityMetadata;\n }\n\n /**\n * Creates an Entity Manager for the current connection with the help of the EntityManagerFactory.\n */\n createEntityManager(queryRunner?: QueryRunner): EntityManager {\n return new EntityManagerFactory().create(this, queryRunner);\n }\n\n // -------------------------------------------------------------------------\n // Protected Methods\n // -------------------------------------------------------------------------\n\n /**\n * Finds exist entity metadata by the given entity class, target name or table name.\n */\n protected findMetadata(target: EntityTarget<any>): EntityMetadata|undefined {\n return this.entityMetadatas.find(metadata => {\n if (metadata.target === target)\n return true;\n if (target instanceof EntitySchema) {\n return metadata.name === target.options.name;\n }\n if (typeof target === \"string\") {\n if (target.indexOf(\".\") !== -1) {\n return metadata.tablePath === target;\n } else {\n return metadata.name === target || metadata.tableName === target;\n }\n }\n\n return false;\n });\n }\n\n /**\n * Builds metadatas for all registered classes inside this connection.\n */\n protected async buildMetadatas(): Promise<void> {\n\n const connectionMetadataBuilder = new ConnectionMetadataBuilder(this);\n const entityMetadataValidator = new EntityMetadataValidator();\n\n // create subscribers instances if they are not disallowed from high-level (for example they can disallowed from migrations run process)\n const subscribers = await connectionMetadataBuilder.buildSubscribers(this.options.subscribers || []);\n ObjectUtils.assign(this, { subscribers: subscribers });\n\n // build entity metadatas\n const entityMetadatas = await connectionMetadataBuilder.buildEntityMetadatas(this.options.entities || []);\n ObjectUtils.assign(this, { entityMetadatas: entityMetadatas });\n\n // create migration instances\n const migrations = await connectionMetadataBuilder.buildMigrations(this.options.migrations || []);\n ObjectUtils.assign(this, { migrations: migrations });\n\n // validate all created entity metadatas to make sure user created entities are valid and correct\n entityMetadataValidator.validateMany(this.entityMetadatas.filter(metadata => metadata.tableType !== \"view\"), this.driver);\n }\n}\n"],"sourceRoot":".."}
|
|
@@ -38,6 +38,7 @@ var ConnectionOptionsEnvReader = /** @class */ (function () {
|
|
|
38
38
|
entities: this.stringToArray(PlatformTools_1.PlatformTools.getEnvVariable("TYPEORM_ENTITIES")),
|
|
39
39
|
migrations: this.stringToArray(PlatformTools_1.PlatformTools.getEnvVariable("TYPEORM_MIGRATIONS")),
|
|
40
40
|
migrationsTableName: PlatformTools_1.PlatformTools.getEnvVariable("TYPEORM_MIGRATIONS_TABLE_NAME"),
|
|
41
|
+
metadataTableName: PlatformTools_1.PlatformTools.getEnvVariable("TYPEORM_METADATA_TABLE_NAME"),
|
|
41
42
|
subscribers: this.stringToArray(PlatformTools_1.PlatformTools.getEnvVariable("TYPEORM_SUBSCRIBERS")),
|
|
42
43
|
logging: this.transformLogging(PlatformTools_1.PlatformTools.getEnvVariable("TYPEORM_LOGGING")),
|
|
43
44
|
logger: PlatformTools_1.PlatformTools.getEnvVariable("TYPEORM_LOGGER"),
|