typeorm 0.2.25 → 0.2.29
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/README.md +16 -7
- package/browser/cache/DbQueryResultCache.js +14 -14
- package/browser/cache/DbQueryResultCache.js.map +1 -1
- package/browser/cache/RedisQueryResultCache.js +19 -14
- package/browser/cache/RedisQueryResultCache.js.map +1 -1
- package/browser/common/DeepPartial.d.ts +1 -1
- package/browser/common/DeepPartial.js.map +1 -1
- package/browser/common/EntityTarget.d.ts +9 -0
- package/browser/common/EntityTarget.js +3 -0
- package/browser/common/EntityTarget.js.map +1 -0
- package/browser/connection/Connection.d.ts +11 -10
- package/browser/connection/Connection.js +63 -40
- package/browser/connection/Connection.js.map +1 -1
- package/browser/connection/ConnectionMetadataBuilder.js +8 -8
- package/browser/connection/ConnectionMetadataBuilder.js.map +1 -1
- package/browser/connection/ConnectionOptions.d.ts +2 -1
- package/browser/connection/ConnectionOptions.js.map +1 -1
- package/browser/connection/ConnectionOptionsReader.js +48 -43
- package/browser/connection/ConnectionOptionsReader.js.map +1 -1
- package/browser/connection/options-reader/ConnectionOptionsEnvReader.d.ts +5 -1
- package/browser/connection/options-reader/ConnectionOptionsEnvReader.js +45 -31
- package/browser/connection/options-reader/ConnectionOptionsEnvReader.js.map +1 -1
- package/browser/connection/options-reader/ConnectionOptionsXmlReader.js +4 -4
- package/browser/connection/options-reader/ConnectionOptionsXmlReader.js.map +1 -1
- package/browser/connection/options-reader/ConnectionOptionsYmlReader.d.ts +1 -1
- package/browser/connection/options-reader/ConnectionOptionsYmlReader.js +15 -4
- package/browser/connection/options-reader/ConnectionOptionsYmlReader.js.map +1 -1
- package/browser/decorator/Check.d.ts +2 -2
- package/browser/decorator/Check.js.map +1 -1
- package/browser/decorator/EntityRepository.d.ts +1 -1
- package/browser/decorator/EntityRepository.js.map +1 -1
- package/browser/decorator/Exclusion.d.ts +2 -2
- package/browser/decorator/Exclusion.js.map +1 -1
- package/browser/decorator/Generated.d.ts +1 -1
- package/browser/decorator/Generated.js.map +1 -1
- package/browser/decorator/Index.d.ts +7 -7
- package/browser/decorator/Index.js.map +1 -1
- package/browser/decorator/Unique.d.ts +4 -4
- package/browser/decorator/Unique.js +12 -1
- package/browser/decorator/Unique.js.map +1 -1
- package/browser/decorator/columns/Column.d.ts +12 -12
- package/browser/decorator/columns/Column.js.map +1 -1
- package/browser/decorator/columns/CreateDateColumn.d.ts +1 -1
- package/browser/decorator/columns/CreateDateColumn.js.map +1 -1
- package/browser/decorator/columns/DeleteDateColumn.d.ts +1 -1
- package/browser/decorator/columns/DeleteDateColumn.js.map +1 -1
- package/browser/decorator/columns/ObjectIdColumn.d.ts +1 -1
- package/browser/decorator/columns/ObjectIdColumn.js.map +1 -1
- package/browser/decorator/columns/PrimaryColumn.d.ts +2 -2
- package/browser/decorator/columns/PrimaryColumn.js.map +1 -1
- package/browser/decorator/columns/PrimaryGeneratedColumn.d.ts +5 -5
- package/browser/decorator/columns/PrimaryGeneratedColumn.js.map +1 -1
- package/browser/decorator/columns/UpdateDateColumn.d.ts +1 -1
- package/browser/decorator/columns/UpdateDateColumn.js.map +1 -1
- package/browser/decorator/columns/VersionColumn.d.ts +1 -1
- package/browser/decorator/columns/VersionColumn.js.map +1 -1
- package/browser/decorator/columns/ViewColumn.d.ts +1 -1
- package/browser/decorator/columns/ViewColumn.js.map +1 -1
- package/browser/decorator/entity/ChildEntity.d.ts +1 -1
- package/browser/decorator/entity/ChildEntity.js +1 -1
- package/browser/decorator/entity/ChildEntity.js.map +1 -1
- package/browser/decorator/entity/TableInheritance.d.ts +1 -1
- package/browser/decorator/entity/TableInheritance.js.map +1 -1
- package/browser/decorator/entity-view/ViewEntity.d.ts +2 -2
- package/browser/decorator/entity-view/ViewEntity.js.map +1 -1
- package/browser/decorator/listeners/AfterInsert.d.ts +1 -1
- package/browser/decorator/listeners/AfterInsert.js.map +1 -1
- package/browser/decorator/listeners/AfterLoad.d.ts +1 -1
- package/browser/decorator/listeners/AfterLoad.js.map +1 -1
- package/browser/decorator/listeners/AfterRemove.d.ts +1 -1
- package/browser/decorator/listeners/AfterRemove.js.map +1 -1
- package/browser/decorator/listeners/AfterUpdate.d.ts +1 -1
- package/browser/decorator/listeners/AfterUpdate.js.map +1 -1
- package/browser/decorator/listeners/BeforeInsert.d.ts +1 -1
- package/browser/decorator/listeners/BeforeInsert.js.map +1 -1
- package/browser/decorator/listeners/BeforeRemove.d.ts +1 -1
- package/browser/decorator/listeners/BeforeRemove.js.map +1 -1
- package/browser/decorator/listeners/BeforeUpdate.d.ts +1 -1
- package/browser/decorator/listeners/BeforeUpdate.js.map +1 -1
- package/browser/decorator/listeners/EventSubscriber.d.ts +1 -1
- package/browser/decorator/listeners/EventSubscriber.js.map +1 -1
- package/browser/decorator/options/ColumnOptions.js.map +1 -1
- package/browser/decorator/options/TransactionOptions.js.map +1 -1
- package/browser/decorator/relations/JoinColumn.d.ts +3 -3
- package/browser/decorator/relations/JoinColumn.js.map +1 -1
- package/browser/decorator/relations/JoinTable.d.ts +3 -3
- package/browser/decorator/relations/JoinTable.js.map +1 -1
- package/browser/decorator/relations/ManyToMany.d.ts +2 -2
- package/browser/decorator/relations/ManyToMany.js.map +1 -1
- package/browser/decorator/relations/ManyToOne.d.ts +2 -2
- package/browser/decorator/relations/ManyToOne.js.map +1 -1
- package/browser/decorator/relations/OneToMany.d.ts +3 -3
- package/browser/decorator/relations/OneToMany.js +2 -2
- package/browser/decorator/relations/OneToMany.js.map +1 -1
- package/browser/decorator/relations/OneToOne.d.ts +2 -2
- package/browser/decorator/relations/OneToOne.js.map +1 -1
- package/browser/decorator/relations/RelationCount.d.ts +1 -1
- package/browser/decorator/relations/RelationCount.js.map +1 -1
- package/browser/decorator/relations/RelationId.d.ts +1 -1
- package/browser/decorator/relations/RelationId.js.map +1 -1
- package/browser/decorator/transaction/Transaction.js +4 -4
- package/browser/decorator/transaction/Transaction.js.map +1 -1
- package/browser/decorator/transaction/TransactionManager.d.ts +1 -1
- package/browser/decorator/transaction/TransactionManager.js.map +1 -1
- package/browser/decorator/tree/Tree.d.ts +1 -1
- package/browser/decorator/tree/Tree.js.map +1 -1
- package/browser/decorator/tree/TreeChildren.d.ts +1 -1
- package/browser/decorator/tree/TreeChildren.js.map +1 -1
- package/browser/decorator/tree/TreeLevelColumn.d.ts +1 -1
- package/browser/decorator/tree/TreeLevelColumn.js.map +1 -1
- package/browser/decorator/tree/TreeParent.d.ts +1 -1
- package/browser/decorator/tree/TreeParent.js.map +1 -1
- package/browser/driver/Driver.d.ts +7 -2
- package/browser/driver/Driver.js.map +1 -1
- package/browser/driver/DriverFactory.js +4 -1
- package/browser/driver/DriverFactory.js.map +1 -1
- package/browser/driver/DriverUtils.d.ts +2 -2
- package/browser/driver/DriverUtils.js +27 -15
- package/browser/driver/DriverUtils.js.map +1 -1
- package/browser/driver/aurora-data-api/AuroraDataApiConnection.d.ts +2 -1
- package/browser/driver/aurora-data-api/AuroraDataApiConnection.js +2 -3
- package/browser/driver/aurora-data-api/AuroraDataApiConnection.js.map +1 -1
- package/browser/driver/aurora-data-api/AuroraDataApiConnectionOptions.d.ts +3 -0
- package/browser/driver/aurora-data-api/AuroraDataApiConnectionOptions.js.map +1 -1
- package/browser/driver/aurora-data-api/AuroraDataApiDriver.d.ts +6 -1
- package/browser/driver/aurora-data-api/AuroraDataApiDriver.js +14 -9
- package/browser/driver/aurora-data-api/AuroraDataApiDriver.js.map +1 -1
- package/browser/driver/aurora-data-api/AuroraDataApiQueryRunner.d.ts +5 -0
- package/browser/driver/aurora-data-api/AuroraDataApiQueryRunner.js +283 -149
- package/browser/driver/aurora-data-api/AuroraDataApiQueryRunner.js.map +1 -1
- package/browser/driver/aurora-data-api-pg/AuroraDataApiPostgresConnectionOptions.d.ts +6 -0
- package/browser/driver/aurora-data-api-pg/AuroraDataApiPostgresConnectionOptions.js.map +1 -1
- package/browser/driver/aurora-data-api-pg/AuroraDataApiPostgresDriver.d.ts +57 -0
- package/browser/driver/aurora-data-api-pg/AuroraDataApiPostgresDriver.js +99 -0
- package/browser/driver/aurora-data-api-pg/AuroraDataApiPostgresDriver.js.map +1 -0
- package/browser/driver/aurora-data-api-pg/AuroraDataApiPostgresQueryRunner.d.ts +4 -3
- package/browser/driver/aurora-data-api-pg/AuroraDataApiPostgresQueryRunner.js +66 -20
- package/browser/driver/aurora-data-api-pg/AuroraDataApiPostgresQueryRunner.js.map +1 -1
- package/browser/driver/better-sqlite3/BetterSqlite3ConnectionOptions.d.ts +50 -0
- package/browser/driver/better-sqlite3/BetterSqlite3ConnectionOptions.js +3 -0
- package/browser/driver/better-sqlite3/BetterSqlite3ConnectionOptions.js.map +1 -0
- package/browser/driver/better-sqlite3/BetterSqlite3Driver.d.ts +46 -0
- package/browser/driver/better-sqlite3/BetterSqlite3Driver.js +125 -0
- package/browser/driver/better-sqlite3/BetterSqlite3Driver.js.map +1 -0
- package/browser/driver/better-sqlite3/BetterSqlite3QueryRunner.d.ts +22 -0
- package/browser/driver/better-sqlite3/BetterSqlite3QueryRunner.js +113 -0
- package/browser/driver/better-sqlite3/BetterSqlite3QueryRunner.js.map +1 -0
- package/browser/driver/cockroachdb/CockroachConnectionCredentialsOptions.js.map +1 -1
- package/browser/driver/cockroachdb/CockroachDriver.d.ts +6 -1
- package/browser/driver/cockroachdb/CockroachDriver.js +21 -16
- package/browser/driver/cockroachdb/CockroachDriver.js.map +1 -1
- package/browser/driver/cockroachdb/CockroachQueryRunner.d.ts +7 -1
- package/browser/driver/cockroachdb/CockroachQueryRunner.js +509 -211
- package/browser/driver/cockroachdb/CockroachQueryRunner.js.map +1 -1
- package/browser/driver/cordova/CordovaDriver.d.ts +2 -1
- package/browser/driver/cordova/CordovaDriver.js +4 -5
- package/browser/driver/cordova/CordovaDriver.js.map +1 -1
- package/browser/driver/cordova/CordovaQueryRunner.js +4 -4
- package/browser/driver/cordova/CordovaQueryRunner.js.map +1 -1
- package/browser/driver/expo/ExpoDriver.d.ts +2 -1
- package/browser/driver/expo/ExpoDriver.js +4 -5
- package/browser/driver/expo/ExpoDriver.js.map +1 -1
- package/browser/driver/expo/ExpoQueryRunner.js +82 -24
- package/browser/driver/expo/ExpoQueryRunner.js.map +1 -1
- package/browser/driver/mongodb/MongoConnectionOptions.d.ts +4 -0
- package/browser/driver/mongodb/MongoConnectionOptions.js.map +1 -1
- package/browser/driver/mongodb/MongoDriver.d.ts +13 -4
- package/browser/driver/mongodb/MongoDriver.js +24 -18
- package/browser/driver/mongodb/MongoDriver.js.map +1 -1
- package/browser/driver/mongodb/MongoQueryRunner.d.ts +4 -3
- package/browser/driver/mongodb/MongoQueryRunner.js +175 -175
- package/browser/driver/mongodb/MongoQueryRunner.js.map +1 -1
- package/browser/driver/mongodb/typings.js.map +1 -1
- package/browser/driver/mysql/MysqlDriver.d.ts +7 -2
- package/browser/driver/mysql/MysqlDriver.js +20 -13
- package/browser/driver/mysql/MysqlDriver.js.map +1 -1
- package/browser/driver/mysql/MysqlQueryRunner.d.ts +11 -1
- package/browser/driver/mysql/MysqlQueryRunner.js +351 -185
- package/browser/driver/mysql/MysqlQueryRunner.js.map +1 -1
- package/browser/driver/nativescript/NativescriptDriver.d.ts +2 -1
- package/browser/driver/nativescript/NativescriptDriver.js +4 -5
- package/browser/driver/nativescript/NativescriptDriver.js.map +1 -1
- package/browser/driver/nativescript/NativescriptQueryRunner.js +2 -2
- package/browser/driver/nativescript/NativescriptQueryRunner.js.map +1 -1
- package/browser/driver/oracle/OracleDriver.d.ts +6 -1
- package/browser/driver/oracle/OracleDriver.js +17 -12
- package/browser/driver/oracle/OracleDriver.js.map +1 -1
- package/browser/driver/oracle/OracleQueryRunner.d.ts +3 -1
- package/browser/driver/oracle/OracleQueryRunner.js +247 -134
- package/browser/driver/oracle/OracleQueryRunner.js.map +1 -1
- package/browser/driver/postgres/PostgresConnectionCredentialsOptions.js.map +1 -1
- package/browser/driver/postgres/PostgresConnectionOptions.d.ts +9 -0
- package/browser/driver/postgres/PostgresConnectionOptions.js.map +1 -1
- package/browser/driver/postgres/PostgresDriver.d.ts +18 -55
- package/browser/driver/postgres/PostgresDriver.js +196 -206
- package/browser/driver/postgres/PostgresDriver.js.map +1 -1
- package/browser/driver/postgres/PostgresQueryRunner.d.ts +11 -1
- package/browser/driver/postgres/PostgresQueryRunner.js +517 -209
- package/browser/driver/postgres/PostgresQueryRunner.js.map +1 -1
- package/browser/driver/react-native/ReactNativeDriver.d.ts +2 -1
- package/browser/driver/react-native/ReactNativeDriver.js +4 -5
- package/browser/driver/react-native/ReactNativeDriver.js.map +1 -1
- package/browser/driver/react-native/ReactNativeQueryRunner.js +4 -4
- package/browser/driver/react-native/ReactNativeQueryRunner.js.map +1 -1
- package/browser/driver/sap/SapDriver.d.ts +6 -1
- package/browser/driver/sap/SapDriver.js +12 -7
- package/browser/driver/sap/SapDriver.js.map +1 -1
- package/browser/driver/sap/SapQueryRunner.d.ts +3 -1
- package/browser/driver/sap/SapQueryRunner.js +276 -160
- package/browser/driver/sap/SapQueryRunner.js.map +1 -1
- package/browser/driver/sqlite/SqliteConnectionOptions.d.ts +18 -0
- package/browser/driver/sqlite/SqliteConnectionOptions.js.map +1 -1
- package/browser/driver/sqlite/SqliteDriver.d.ts +2 -1
- package/browser/driver/sqlite/SqliteDriver.js +31 -17
- package/browser/driver/sqlite/SqliteDriver.js.map +1 -1
- package/browser/driver/sqlite/SqliteQueryRunner.js +37 -18
- package/browser/driver/sqlite/SqliteQueryRunner.js.map +1 -1
- package/browser/driver/sqlite-abstract/AbstractSqliteDriver.d.ts +7 -2
- package/browser/driver/sqlite-abstract/AbstractSqliteDriver.js +36 -9
- package/browser/driver/sqlite-abstract/AbstractSqliteDriver.js.map +1 -1
- package/browser/driver/sqlite-abstract/AbstractSqliteQueryRunner.d.ts +1 -0
- package/browser/driver/sqlite-abstract/AbstractSqliteQueryRunner.js +189 -127
- package/browser/driver/sqlite-abstract/AbstractSqliteQueryRunner.js.map +1 -1
- package/browser/driver/sqljs/SqljsDriver.d.ts +2 -1
- package/browser/driver/sqljs/SqljsDriver.js +14 -15
- package/browser/driver/sqljs/SqljsDriver.js.map +1 -1
- package/browser/driver/sqljs/SqljsQueryRunner.js +7 -6
- package/browser/driver/sqljs/SqljsQueryRunner.js.map +1 -1
- package/browser/driver/sqlserver/SqlServerDriver.d.ts +6 -1
- package/browser/driver/sqlserver/SqlServerDriver.js +13 -8
- package/browser/driver/sqlserver/SqlServerDriver.js.map +1 -1
- package/browser/driver/sqlserver/SqlServerQueryRunner.d.ts +3 -1
- package/browser/driver/sqlserver/SqlServerQueryRunner.js +368 -230
- package/browser/driver/sqlserver/SqlServerQueryRunner.js.map +1 -1
- package/browser/driver/types/ColumnTypes.d.ts +1 -1
- package/browser/driver/types/ColumnTypes.js.map +1 -1
- package/browser/driver/types/DatabaseType.d.ts +1 -1
- package/browser/driver/types/DatabaseType.js.map +1 -1
- package/browser/driver/types/ReplicationMode.d.ts +1 -0
- package/browser/driver/types/ReplicationMode.js +3 -0
- package/browser/driver/types/ReplicationMode.js.map +1 -0
- package/browser/entity-manager/EntityManager.d.ts +41 -256
- package/browser/entity-manager/EntityManager.js +32 -42
- package/browser/entity-manager/EntityManager.js.map +1 -1
- package/browser/entity-manager/MongoEntityManager.d.ts +46 -46
- package/browser/entity-manager/MongoEntityManager.js +31 -20
- package/browser/entity-manager/MongoEntityManager.js.map +1 -1
- package/browser/entity-manager/SqljsEntityManager.js +6 -6
- package/browser/entity-manager/SqljsEntityManager.js.map +1 -1
- package/browser/entity-schema/EntitySchemaColumnOptions.js.map +1 -1
- package/browser/entity-schema/EntitySchemaRelationOptions.d.ts +1 -1
- package/browser/entity-schema/EntitySchemaRelationOptions.js.map +1 -1
- package/browser/entity-schema/EntitySchemaTransformer.js +22 -7
- package/browser/entity-schema/EntitySchemaTransformer.js.map +1 -1
- package/browser/error/AlreadyHasActiveConnectionError.js +2 -2
- package/browser/error/AlreadyHasActiveConnectionError.js.map +1 -1
- package/browser/error/CannotAttachTreeChildrenEntityError.js +2 -2
- package/browser/error/CannotAttachTreeChildrenEntityError.js.map +1 -1
- package/browser/error/CannotConnectAlreadyConnectedError.js +2 -2
- package/browser/error/CannotConnectAlreadyConnectedError.js.map +1 -1
- package/browser/error/CannotCreateEntityIdMapError.js +2 -2
- package/browser/error/CannotCreateEntityIdMapError.js.map +1 -1
- package/browser/error/CannotDetermineEntityError.js +2 -2
- package/browser/error/CannotDetermineEntityError.js.map +1 -1
- package/browser/error/CannotExecuteNotConnectedError.js +2 -2
- package/browser/error/CannotExecuteNotConnectedError.js.map +1 -1
- package/browser/error/CannotGetEntityManagerNotConnectedError.js +2 -2
- package/browser/error/CannotGetEntityManagerNotConnectedError.js.map +1 -1
- package/browser/error/CannotReflectMethodParameterTypeError.js +2 -2
- package/browser/error/CannotReflectMethodParameterTypeError.js.map +1 -1
- package/browser/error/CircularRelationsError.js +2 -2
- package/browser/error/CircularRelationsError.js.map +1 -1
- package/browser/error/ColumnTypeUndefinedError.js +2 -2
- package/browser/error/ColumnTypeUndefinedError.js.map +1 -1
- package/browser/error/ConnectionIsNotSetError.js +2 -2
- package/browser/error/ConnectionIsNotSetError.js.map +1 -1
- package/browser/error/ConnectionNotFoundError.js +2 -2
- package/browser/error/ConnectionNotFoundError.js.map +1 -1
- package/browser/error/CustomRepositoryCannotInheritRepositoryError.js +2 -2
- package/browser/error/CustomRepositoryCannotInheritRepositoryError.js.map +1 -1
- package/browser/error/CustomRepositoryDoesNotHaveEntityError.js +2 -2
- package/browser/error/CustomRepositoryDoesNotHaveEntityError.js.map +1 -1
- package/browser/error/CustomRepositoryNotFoundError.js +2 -2
- package/browser/error/CustomRepositoryNotFoundError.js.map +1 -1
- package/browser/error/DataTypeNotSupportedError.js +2 -2
- package/browser/error/DataTypeNotSupportedError.js.map +1 -1
- package/browser/error/DriverOptionNotSetError.js +2 -2
- package/browser/error/DriverOptionNotSetError.js.map +1 -1
- package/browser/error/DriverPackageNotInstalledError.js +2 -2
- package/browser/error/DriverPackageNotInstalledError.js.map +1 -1
- package/browser/error/EntityColumnNotFound.js +2 -2
- package/browser/error/EntityColumnNotFound.js.map +1 -1
- package/browser/error/EntityMetadataNotFoundError.d.ts +2 -2
- package/browser/error/EntityMetadataNotFoundError.js +5 -2
- package/browser/error/EntityMetadataNotFoundError.js.map +1 -1
- package/browser/error/EntityNotFoundError.d.ts +2 -3
- package/browser/error/EntityNotFoundError.js +5 -2
- package/browser/error/EntityNotFoundError.js.map +1 -1
- package/browser/error/FindRelationsNotFoundError.js +4 -4
- package/browser/error/FindRelationsNotFoundError.js.map +1 -1
- package/browser/error/InitializedRelationError.js +2 -2
- package/browser/error/InitializedRelationError.js.map +1 -1
- package/browser/error/InsertValuesMissingError.js +2 -2
- package/browser/error/InsertValuesMissingError.js.map +1 -1
- package/browser/error/LimitOnUpdateNotSupportedError.js +2 -2
- package/browser/error/LimitOnUpdateNotSupportedError.js.map +1 -1
- package/browser/error/LockNotSupportedOnGivenDriverError.js +2 -2
- package/browser/error/LockNotSupportedOnGivenDriverError.js.map +1 -1
- package/browser/error/MetadataAlreadyExistsError.js +2 -2
- package/browser/error/MetadataAlreadyExistsError.js.map +1 -1
- package/browser/error/MetadataWithSuchNameAlreadyExistsError.js +2 -2
- package/browser/error/MetadataWithSuchNameAlreadyExistsError.js.map +1 -1
- package/browser/error/MissingDeleteDateColumnError.js +2 -2
- package/browser/error/MissingDeleteDateColumnError.js.map +1 -1
- package/browser/error/MissingDriverError.js +3 -3
- package/browser/error/MissingDriverError.js.map +1 -1
- package/browser/error/MissingJoinColumnError.js +2 -2
- package/browser/error/MissingJoinColumnError.js.map +1 -1
- package/browser/error/MissingJoinTableError.js +2 -2
- package/browser/error/MissingJoinTableError.js.map +1 -1
- package/browser/error/MissingPrimaryColumnError.js +2 -2
- package/browser/error/MissingPrimaryColumnError.js.map +1 -1
- package/browser/error/MustBeEntityError.js +2 -2
- package/browser/error/MustBeEntityError.js.map +1 -1
- package/browser/error/NamingStrategyNotFoundError.js +2 -2
- package/browser/error/NamingStrategyNotFoundError.js.map +1 -1
- package/browser/error/NoConnectionForRepositoryError.js +2 -2
- package/browser/error/NoConnectionForRepositoryError.js.map +1 -1
- package/browser/error/NoConnectionOptionError.js +2 -2
- package/browser/error/NoConnectionOptionError.js.map +1 -1
- package/browser/error/NoNeedToReleaseEntityManagerError.js +2 -2
- package/browser/error/NoNeedToReleaseEntityManagerError.js.map +1 -1
- package/browser/error/NoVersionOrUpdateDateColumnError.js +2 -2
- package/browser/error/NoVersionOrUpdateDateColumnError.js.map +1 -1
- package/browser/error/OffsetWithoutLimitNotSupportedError.js +2 -2
- package/browser/error/OffsetWithoutLimitNotSupportedError.js.map +1 -1
- package/browser/error/OptimisticLockCanNotBeUsedError.js +2 -2
- package/browser/error/OptimisticLockCanNotBeUsedError.js.map +1 -1
- package/browser/error/OptimisticLockVersionMismatchError.js +2 -2
- package/browser/error/OptimisticLockVersionMismatchError.js.map +1 -1
- package/browser/error/PersistedEntityNotFoundError.js +2 -2
- package/browser/error/PersistedEntityNotFoundError.js.map +1 -1
- package/browser/error/PessimisticLockTransactionRequiredError.js +2 -2
- package/browser/error/PessimisticLockTransactionRequiredError.js.map +1 -1
- package/browser/error/PrimaryColumnCannotBeNullableError.js +2 -2
- package/browser/error/PrimaryColumnCannotBeNullableError.js.map +1 -1
- package/browser/error/QueryFailedError.js +3 -3
- package/browser/error/QueryFailedError.js.map +1 -1
- package/browser/error/QueryRunnerAlreadyReleasedError.js +2 -2
- package/browser/error/QueryRunnerAlreadyReleasedError.js.map +1 -1
- package/browser/error/QueryRunnerProviderAlreadyReleasedError.js +2 -2
- package/browser/error/QueryRunnerProviderAlreadyReleasedError.js.map +1 -1
- package/browser/error/RepositoryNotFoundError.d.ts +2 -2
- package/browser/error/RepositoryNotFoundError.js +5 -2
- package/browser/error/RepositoryNotFoundError.js.map +1 -1
- package/browser/error/RepositoryNotTreeError.d.ts +2 -2
- package/browser/error/RepositoryNotTreeError.js +11 -8
- package/browser/error/RepositoryNotTreeError.js.map +1 -1
- package/browser/error/ReturningStatementNotSupportedError.js +2 -2
- package/browser/error/ReturningStatementNotSupportedError.js.map +1 -1
- package/browser/error/SubjectRemovedAndUpdatedError.js +2 -2
- package/browser/error/SubjectRemovedAndUpdatedError.js.map +1 -1
- package/browser/error/SubjectWithoutIdentifierError.js +2 -2
- package/browser/error/SubjectWithoutIdentifierError.js.map +1 -1
- package/browser/error/TransactionAlreadyStartedError.js +2 -2
- package/browser/error/TransactionAlreadyStartedError.js.map +1 -1
- package/browser/error/TransactionNotStartedError.js +2 -2
- package/browser/error/TransactionNotStartedError.js.map +1 -1
- package/browser/error/TreeRepositoryNotSupportedError.js +2 -2
- package/browser/error/TreeRepositoryNotSupportedError.js.map +1 -1
- package/browser/error/UpdateValuesMissingError.js +2 -2
- package/browser/error/UpdateValuesMissingError.js.map +1 -1
- package/browser/error/UsingJoinColumnIsNotAllowedError.js +2 -2
- package/browser/error/UsingJoinColumnIsNotAllowedError.js.map +1 -1
- package/browser/error/UsingJoinColumnOnlyOnOneSideAllowedError.js +2 -2
- package/browser/error/UsingJoinColumnOnlyOnOneSideAllowedError.js.map +1 -1
- package/browser/error/UsingJoinTableIsNotAllowedError.js +2 -2
- package/browser/error/UsingJoinTableIsNotAllowedError.js.map +1 -1
- package/browser/error/UsingJoinTableOnlyOnOneSideAllowedError.js +2 -2
- package/browser/error/UsingJoinTableOnlyOnOneSideAllowedError.js.map +1 -1
- package/browser/find-options/FindOneOptions.d.ts +4 -0
- package/browser/find-options/FindOneOptions.js.map +1 -1
- package/browser/find-options/FindOperator.d.ts +26 -4
- package/browser/find-options/FindOperator.js +49 -50
- package/browser/find-options/FindOperator.js.map +1 -1
- package/browser/find-options/FindOperatorType.d.ts +1 -1
- package/browser/find-options/FindOperatorType.js.map +1 -1
- package/browser/find-options/FindOptionsUtils.d.ts +2 -2
- package/browser/find-options/FindOptionsUtils.js +5 -1
- package/browser/find-options/FindOptionsUtils.js.map +1 -1
- package/browser/find-options/operator/Any.d.ts +1 -1
- package/browser/find-options/operator/Any.js.map +1 -1
- package/browser/find-options/operator/Between.d.ts +1 -1
- package/browser/find-options/operator/Between.js.map +1 -1
- package/browser/find-options/operator/ILike.d.ts +6 -0
- package/browser/find-options/operator/ILike.js +10 -0
- package/browser/find-options/operator/ILike.js.map +1 -0
- package/browser/find-options/operator/In.d.ts +1 -1
- package/browser/find-options/operator/In.js.map +1 -1
- package/browser/find-options/operator/Raw.d.ts +14 -2
- package/browser/find-options/operator/Raw.js +5 -6
- package/browser/find-options/operator/Raw.js.map +1 -1
- package/browser/index.d.ts +10 -11
- package/browser/index.js +9 -15
- package/browser/index.js.map +1 -1
- package/browser/logger/DebugLogger.d.ts +0 -1
- package/browser/logger/DebugLogger.js +9 -9
- package/browser/logger/DebugLogger.js.map +1 -1
- package/browser/logger/FileLogger.d.ts +3 -1
- package/browser/logger/FileLogger.js +9 -3
- package/browser/logger/FileLogger.js.map +1 -1
- package/browser/logger/Logger.d.ts +1 -1
- package/browser/logger/Logger.js.map +1 -1
- package/browser/logger/LoggerOptions.d.ts +9 -0
- package/browser/logger/LoggerOptions.js.map +1 -1
- package/browser/metadata/ColumnMetadata.js +29 -19
- package/browser/metadata/ColumnMetadata.js.map +1 -1
- package/browser/metadata/EmbeddedMetadata.js +2 -2
- package/browser/metadata/EmbeddedMetadata.js.map +1 -1
- package/browser/metadata/EntityMetadata.d.ts +1 -0
- package/browser/metadata/EntityMetadata.js +13 -5
- package/browser/metadata/EntityMetadata.js.map +1 -1
- package/browser/metadata/RelationMetadata.js +7 -7
- package/browser/metadata/RelationMetadata.js.map +1 -1
- package/browser/metadata/types/EventListenerTypes.d.ts +7 -7
- package/browser/metadata/types/EventListenerTypes.js.map +1 -1
- package/browser/metadata-args/EntityRepositoryMetadataArgs.d.ts +2 -2
- package/browser/metadata-args/EntityRepositoryMetadataArgs.js.map +1 -1
- package/browser/metadata-args/RelationCountMetadataArgs.js.map +1 -1
- package/browser/metadata-args/RelationIdMetadataArgs.js.map +1 -1
- package/browser/metadata-builder/EntityMetadataBuilder.js +21 -15
- package/browser/metadata-builder/EntityMetadataBuilder.js.map +1 -1
- package/browser/metadata-builder/EntityMetadataValidator.js +8 -5
- package/browser/metadata-builder/EntityMetadataValidator.js.map +1 -1
- package/browser/metadata-builder/JunctionEntityMetadataBuilder.js +3 -2
- package/browser/metadata-builder/JunctionEntityMetadataBuilder.js.map +1 -1
- package/browser/migration/MigrationExecutor.js +132 -103
- package/browser/migration/MigrationExecutor.js.map +1 -1
- package/browser/naming-strategy/DefaultNamingStrategy.js +6 -6
- package/browser/naming-strategy/DefaultNamingStrategy.js.map +1 -1
- package/browser/persistence/EntityPersistExecutor.js +65 -47
- package/browser/persistence/EntityPersistExecutor.js.map +1 -1
- package/browser/persistence/Subject.js +4 -3
- package/browser/persistence/Subject.js.map +1 -1
- package/browser/persistence/SubjectDatabaseEntityLoader.js +9 -8
- package/browser/persistence/SubjectDatabaseEntityLoader.js.map +1 -1
- package/browser/persistence/SubjectExecutor.js +263 -206
- package/browser/persistence/SubjectExecutor.js.map +1 -1
- package/browser/persistence/SubjectTopoligicalSorter.js +6 -6
- package/browser/persistence/SubjectTopoligicalSorter.js.map +1 -1
- package/browser/persistence/subject-builder/CascadesSubjectBuilder.js +2 -2
- package/browser/persistence/subject-builder/CascadesSubjectBuilder.js.map +1 -1
- package/browser/persistence/tree/ClosureSubjectExecutor.js +4 -4
- package/browser/persistence/tree/ClosureSubjectExecutor.js.map +1 -1
- package/browser/persistence/tree/MaterializedPathSubjectExecutor.js +5 -4
- package/browser/persistence/tree/MaterializedPathSubjectExecutor.js.map +1 -1
- package/browser/persistence/tree/NestedSetSubjectExecutor.js +3 -3
- package/browser/platform/BrowserConnectionOptionsReaderDummy.d.ts +38 -0
- package/browser/platform/BrowserConnectionOptionsReaderDummy.js +93 -0
- package/browser/platform/BrowserConnectionOptionsReaderDummy.js.map +1 -0
- package/browser/platform/BrowserDirectoryExportedClassesLoader.d.ts +15 -0
- package/browser/platform/BrowserDirectoryExportedClassesLoader.js +22 -0
- package/browser/platform/BrowserDirectoryExportedClassesLoader.js.map +1 -0
- package/browser/platform/BrowserDisabledDriversDummy.d.ts +32 -2
- package/browser/platform/BrowserDisabledDriversDummy.js +52 -2
- package/browser/platform/BrowserDisabledDriversDummy.js.map +1 -1
- package/browser/platform/BrowserFileLoggerDummy.d.ts +33 -0
- package/browser/platform/BrowserFileLoggerDummy.js +58 -0
- package/browser/platform/BrowserFileLoggerDummy.js.map +1 -0
- package/browser/platform/BrowserPlatformTools.d.ts +74 -0
- package/browser/platform/BrowserPlatformTools.js +157 -0
- package/browser/platform/BrowserPlatformTools.js.map +1 -0
- package/browser/platform/PlatformTools.d.ts +15 -21
- package/browser/platform/PlatformTools.js +142 -81
- package/browser/platform/PlatformTools.js.map +1 -1
- package/browser/query-builder/Alias.js.map +1 -1
- package/browser/query-builder/DeleteQueryBuilder.d.ts +2 -3
- package/browser/query-builder/DeleteQueryBuilder.js +12 -6
- package/browser/query-builder/DeleteQueryBuilder.js.map +1 -1
- package/browser/query-builder/InsertQueryBuilder.d.ts +2 -3
- package/browser/query-builder/InsertQueryBuilder.js +49 -16
- package/browser/query-builder/InsertQueryBuilder.js.map +1 -1
- package/browser/query-builder/JoinAttribute.js +2 -2
- package/browser/query-builder/JoinAttribute.js.map +1 -1
- package/browser/query-builder/QueryBuilder.d.ts +18 -15
- package/browser/query-builder/QueryBuilder.js +205 -55
- package/browser/query-builder/QueryBuilder.js.map +1 -1
- package/browser/query-builder/QueryBuilderUtils.js +2 -2
- package/browser/query-builder/QueryBuilderUtils.js.map +1 -1
- package/browser/query-builder/QueryExpressionMap.d.ts +4 -0
- package/browser/query-builder/QueryExpressionMap.js +4 -4
- package/browser/query-builder/QueryExpressionMap.js.map +1 -1
- package/browser/query-builder/QueryPartialEntity.d.ts +1 -1
- package/browser/query-builder/QueryPartialEntity.js.map +1 -1
- package/browser/query-builder/RelationIdLoader.js +5 -5
- package/browser/query-builder/RelationLoader.js +3 -3
- package/browser/query-builder/RelationLoader.js.map +1 -1
- package/browser/query-builder/RelationQueryBuilder.js +14 -14
- package/browser/query-builder/RelationQueryBuilder.js.map +1 -1
- package/browser/query-builder/RelationRemover.js +7 -7
- package/browser/query-builder/RelationRemover.js.map +1 -1
- package/browser/query-builder/RelationUpdater.js +3 -3
- package/browser/query-builder/ReturningResultsEntityUpdator.js +30 -31
- package/browser/query-builder/ReturningResultsEntityUpdator.js.map +1 -1
- package/browser/query-builder/SelectQueryBuilder.d.ts +9 -3
- package/browser/query-builder/SelectQueryBuilder.js +116 -68
- package/browser/query-builder/SelectQueryBuilder.js.map +1 -1
- package/browser/query-builder/SoftDeleteQueryBuilder.d.ts +2 -3
- package/browser/query-builder/SoftDeleteQueryBuilder.js +6 -6
- package/browser/query-builder/SoftDeleteQueryBuilder.js.map +1 -1
- package/browser/query-builder/UpdateQueryBuilder.js +13 -7
- package/browser/query-builder/UpdateQueryBuilder.js.map +1 -1
- package/browser/query-builder/relation-count/RelationCountAttribute.js +3 -3
- package/browser/query-builder/relation-count/RelationCountAttribute.js.map +1 -1
- package/browser/query-builder/relation-count/RelationCountLoader.js +5 -5
- package/browser/query-builder/relation-id/RelationIdAttribute.js +2 -2
- package/browser/query-builder/relation-id/RelationIdAttribute.js.map +1 -1
- package/browser/query-builder/relation-id/RelationIdLoader.js +6 -6
- package/browser/query-builder/relation-id/RelationIdLoader.js.map +1 -1
- package/browser/query-builder/transformer/PlainObjectToDatabaseEntityTransformer.js +4 -4
- package/browser/query-builder/transformer/PlainObjectToDatabaseEntityTransformer.js.map +1 -1
- package/browser/query-builder/transformer/RawSqlResultsToEntityTransformer.js +9 -6
- package/browser/query-builder/transformer/RawSqlResultsToEntityTransformer.js.map +1 -1
- package/browser/query-runner/BaseQueryRunner.d.ts +2 -5
- package/browser/query-runner/BaseQueryRunner.js +106 -56
- package/browser/query-runner/BaseQueryRunner.js.map +1 -1
- package/browser/query-runner/QueryRunner.d.ts +2 -1
- package/browser/query-runner/QueryRunner.js.map +1 -1
- package/browser/repository/AbstractRepository.js.map +1 -1
- package/browser/repository/BaseEntity.js +5 -5
- package/browser/repository/BaseEntity.js.map +1 -1
- package/browser/repository/MongoRepository.js +2 -2
- package/browser/repository/MongoRepository.js.map +1 -1
- package/browser/repository/Repository.js +3 -3
- package/browser/repository/Repository.js.map +1 -1
- package/browser/repository/TreeRepository.js +6 -6
- package/browser/repository/TreeRepository.js.map +1 -1
- package/browser/schema-builder/MongoSchemaBuilder.js +4 -4
- package/browser/schema-builder/MongoSchemaBuilder.js.map +1 -1
- package/browser/schema-builder/RdbmsSchemaBuilder.js +924 -368
- package/browser/schema-builder/RdbmsSchemaBuilder.js.map +1 -1
- package/browser/schema-builder/options/TableIndexOptions.d.ts +1 -1
- package/browser/schema-builder/options/TableIndexOptions.js.map +1 -1
- package/browser/schema-builder/table/TableCheck.js +2 -2
- package/browser/schema-builder/table/TableCheck.js.map +1 -1
- package/browser/schema-builder/table/TableForeignKey.js +3 -3
- package/browser/schema-builder/table/TableForeignKey.js.map +1 -1
- package/browser/schema-builder/table/TableIndex.js +2 -2
- package/browser/schema-builder/table/TableIndex.js.map +1 -1
- package/browser/schema-builder/table/TableUnique.js +2 -2
- package/browser/schema-builder/table/TableUnique.js.map +1 -1
- package/browser/schema-builder/view/View.d.ts +1 -2
- package/browser/schema-builder/view/View.js.map +1 -1
- package/browser/subscriber/Broadcaster.d.ts +24 -0
- package/browser/subscriber/Broadcaster.js +120 -0
- package/browser/subscriber/Broadcaster.js.map +1 -1
- package/browser/subscriber/EntitySubscriberInterface.d.ts +27 -0
- package/browser/subscriber/EntitySubscriberInterface.js.map +1 -1
- package/browser/subscriber/event/TransactionCommitEvent.d.ts +22 -0
- package/browser/subscriber/event/TransactionCommitEvent.js +3 -0
- package/browser/subscriber/event/TransactionCommitEvent.js.map +1 -0
- package/browser/subscriber/event/TransactionRollbackEvent.d.ts +22 -0
- package/browser/subscriber/event/TransactionRollbackEvent.js +3 -0
- package/browser/subscriber/event/TransactionRollbackEvent.js.map +1 -0
- package/browser/subscriber/event/TransactionStartEvent.d.ts +22 -0
- package/browser/subscriber/event/TransactionStartEvent.js +3 -0
- package/browser/subscriber/event/TransactionStartEvent.js.map +1 -0
- package/browser/util/ApplyValueTransformers.js.map +1 -1
- package/browser/util/DateUtils.js +3 -9
- package/browser/util/DateUtils.js.map +1 -1
- package/browser/util/DirectoryExportedClassesLoader.js +6 -5
- package/browser/util/DirectoryExportedClassesLoader.js.map +1 -1
- package/browser/util/ObjectUtils.js +4 -4
- package/browser/util/ObjectUtils.js.map +1 -1
- package/browser/util/OrmUtils.js +5 -8
- package/browser/util/OrmUtils.js.map +1 -1
- package/cache/DbQueryResultCache.js +1 -1
- package/cache/DbQueryResultCache.js.map +1 -1
- package/cache/RedisQueryResultCache.js +6 -1
- package/cache/RedisQueryResultCache.js.map +1 -1
- package/commands/CacheClearCommand.js +4 -4
- package/commands/CacheClearCommand.js.map +1 -1
- package/commands/CommandUtils.d.ts +1 -1
- package/commands/CommandUtils.js +2 -2
- package/commands/CommandUtils.js.map +1 -1
- package/commands/EntityCreateCommand.js +9 -6
- package/commands/EntityCreateCommand.js.map +1 -1
- package/commands/InitCommand.js +15 -5
- package/commands/InitCommand.js.map +1 -1
- package/commands/MigrationCreateCommand.js +8 -5
- package/commands/MigrationCreateCommand.js.map +1 -1
- package/commands/MigrationGenerateCommand.d.ts +7 -1
- package/commands/MigrationGenerateCommand.js +53 -32
- package/commands/MigrationGenerateCommand.js.map +1 -1
- package/commands/MigrationRevertCommand.js +2 -2
- package/commands/MigrationRevertCommand.js.map +1 -1
- package/commands/MigrationRunCommand.js +2 -2
- package/commands/MigrationRunCommand.js.map +1 -1
- package/commands/MigrationShowCommand.js +2 -2
- package/commands/MigrationShowCommand.js.map +1 -1
- package/commands/QueryCommand.d.ts +2 -0
- package/commands/QueryCommand.js +16 -7
- package/commands/QueryCommand.js.map +1 -1
- package/commands/SchemaDropCommand.js +3 -3
- package/commands/SchemaDropCommand.js.map +1 -1
- package/commands/SchemaLogCommand.js +6 -6
- package/commands/SchemaLogCommand.js.map +1 -1
- package/commands/SchemaSyncCommand.js +3 -3
- package/commands/SchemaSyncCommand.js.map +1 -1
- package/commands/SubscriberCreateCommand.js +8 -5
- package/commands/SubscriberCreateCommand.js.map +1 -1
- package/commands/VersionCommand.js +2 -2
- package/commands/VersionCommand.js.map +1 -1
- package/common/DeepPartial.d.ts +1 -1
- package/common/DeepPartial.js.map +1 -1
- package/common/EntityTarget.d.ts +9 -0
- package/common/EntityTarget.js +4 -0
- package/common/EntityTarget.js.map +1 -0
- package/connection/Connection.d.ts +11 -10
- package/connection/Connection.js +45 -22
- package/connection/Connection.js.map +1 -1
- package/connection/ConnectionOptions.d.ts +2 -1
- package/connection/ConnectionOptions.js.map +1 -1
- package/connection/ConnectionOptionsReader.js +39 -34
- package/connection/ConnectionOptionsReader.js.map +1 -1
- package/connection/options-reader/ConnectionOptionsEnvReader.d.ts +5 -1
- package/connection/options-reader/ConnectionOptionsEnvReader.js +45 -31
- package/connection/options-reader/ConnectionOptionsEnvReader.js.map +1 -1
- package/connection/options-reader/ConnectionOptionsXmlReader.js +2 -2
- package/connection/options-reader/ConnectionOptionsXmlReader.js.map +1 -1
- package/connection/options-reader/ConnectionOptionsYmlReader.d.ts +1 -1
- package/connection/options-reader/ConnectionOptionsYmlReader.js +15 -4
- package/connection/options-reader/ConnectionOptionsYmlReader.js.map +1 -1
- package/decorator/Check.d.ts +2 -2
- package/decorator/Check.js.map +1 -1
- package/decorator/EntityRepository.d.ts +1 -1
- package/decorator/EntityRepository.js.map +1 -1
- package/decorator/Exclusion.d.ts +2 -2
- package/decorator/Exclusion.js.map +1 -1
- package/decorator/Generated.d.ts +1 -1
- package/decorator/Generated.js.map +1 -1
- package/decorator/Index.d.ts +7 -7
- package/decorator/Index.js.map +1 -1
- package/decorator/Unique.d.ts +4 -4
- package/decorator/Unique.js +12 -1
- package/decorator/Unique.js.map +1 -1
- package/decorator/columns/Column.d.ts +12 -12
- package/decorator/columns/Column.js.map +1 -1
- package/decorator/columns/CreateDateColumn.d.ts +1 -1
- package/decorator/columns/CreateDateColumn.js.map +1 -1
- package/decorator/columns/DeleteDateColumn.d.ts +1 -1
- package/decorator/columns/DeleteDateColumn.js.map +1 -1
- package/decorator/columns/ObjectIdColumn.d.ts +1 -1
- package/decorator/columns/ObjectIdColumn.js.map +1 -1
- package/decorator/columns/PrimaryColumn.d.ts +2 -2
- package/decorator/columns/PrimaryColumn.js.map +1 -1
- package/decorator/columns/PrimaryGeneratedColumn.d.ts +5 -5
- package/decorator/columns/PrimaryGeneratedColumn.js.map +1 -1
- package/decorator/columns/UpdateDateColumn.d.ts +1 -1
- package/decorator/columns/UpdateDateColumn.js.map +1 -1
- package/decorator/columns/VersionColumn.d.ts +1 -1
- package/decorator/columns/VersionColumn.js.map +1 -1
- package/decorator/columns/ViewColumn.d.ts +1 -1
- package/decorator/columns/ViewColumn.js.map +1 -1
- package/decorator/entity/ChildEntity.d.ts +1 -1
- package/decorator/entity/ChildEntity.js +1 -1
- package/decorator/entity/ChildEntity.js.map +1 -1
- package/decorator/entity/TableInheritance.d.ts +1 -1
- package/decorator/entity/TableInheritance.js.map +1 -1
- package/decorator/entity-view/ViewEntity.d.ts +2 -2
- package/decorator/entity-view/ViewEntity.js.map +1 -1
- package/decorator/listeners/AfterInsert.d.ts +1 -1
- package/decorator/listeners/AfterInsert.js.map +1 -1
- package/decorator/listeners/AfterLoad.d.ts +1 -1
- package/decorator/listeners/AfterLoad.js.map +1 -1
- package/decorator/listeners/AfterRemove.d.ts +1 -1
- package/decorator/listeners/AfterRemove.js.map +1 -1
- package/decorator/listeners/AfterUpdate.d.ts +1 -1
- package/decorator/listeners/AfterUpdate.js.map +1 -1
- package/decorator/listeners/BeforeInsert.d.ts +1 -1
- package/decorator/listeners/BeforeInsert.js.map +1 -1
- package/decorator/listeners/BeforeRemove.d.ts +1 -1
- package/decorator/listeners/BeforeRemove.js.map +1 -1
- package/decorator/listeners/BeforeUpdate.d.ts +1 -1
- package/decorator/listeners/BeforeUpdate.js.map +1 -1
- package/decorator/listeners/EventSubscriber.d.ts +1 -1
- package/decorator/listeners/EventSubscriber.js.map +1 -1
- package/decorator/options/ColumnOptions.js.map +1 -1
- package/decorator/options/TransactionOptions.js.map +1 -1
- package/decorator/relations/JoinColumn.d.ts +3 -3
- package/decorator/relations/JoinColumn.js.map +1 -1
- package/decorator/relations/JoinTable.d.ts +3 -3
- package/decorator/relations/JoinTable.js.map +1 -1
- package/decorator/relations/ManyToMany.d.ts +2 -2
- package/decorator/relations/ManyToMany.js.map +1 -1
- package/decorator/relations/ManyToOne.d.ts +2 -2
- package/decorator/relations/ManyToOne.js.map +1 -1
- package/decorator/relations/OneToMany.d.ts +3 -3
- package/decorator/relations/OneToMany.js +2 -2
- package/decorator/relations/OneToMany.js.map +1 -1
- package/decorator/relations/OneToOne.d.ts +2 -2
- package/decorator/relations/OneToOne.js.map +1 -1
- package/decorator/relations/RelationCount.d.ts +1 -1
- package/decorator/relations/RelationCount.js.map +1 -1
- package/decorator/relations/RelationId.d.ts +1 -1
- package/decorator/relations/RelationId.js.map +1 -1
- package/decorator/transaction/TransactionManager.d.ts +1 -1
- package/decorator/transaction/TransactionManager.js.map +1 -1
- package/decorator/tree/Tree.d.ts +1 -1
- package/decorator/tree/Tree.js.map +1 -1
- package/decorator/tree/TreeChildren.d.ts +1 -1
- package/decorator/tree/TreeChildren.js.map +1 -1
- package/decorator/tree/TreeLevelColumn.d.ts +1 -1
- package/decorator/tree/TreeLevelColumn.js.map +1 -1
- package/decorator/tree/TreeParent.d.ts +1 -1
- package/decorator/tree/TreeParent.js.map +1 -1
- package/driver/Driver.d.ts +7 -2
- package/driver/Driver.js.map +1 -1
- package/driver/DriverFactory.js +5 -2
- package/driver/DriverFactory.js.map +1 -1
- package/driver/DriverUtils.d.ts +2 -2
- package/driver/DriverUtils.js +25 -13
- package/driver/DriverUtils.js.map +1 -1
- package/driver/aurora-data-api/AuroraDataApiConnection.d.ts +2 -1
- package/driver/aurora-data-api/AuroraDataApiConnection.js +0 -1
- package/driver/aurora-data-api/AuroraDataApiConnection.js.map +1 -1
- package/driver/aurora-data-api/AuroraDataApiConnectionOptions.d.ts +3 -0
- package/driver/aurora-data-api/AuroraDataApiConnectionOptions.js.map +1 -1
- package/driver/aurora-data-api/AuroraDataApiDriver.d.ts +6 -1
- package/driver/aurora-data-api/AuroraDataApiDriver.js +7 -2
- package/driver/aurora-data-api/AuroraDataApiDriver.js.map +1 -1
- package/driver/aurora-data-api/AuroraDataApiQueryRunner.d.ts +4 -0
- package/driver/aurora-data-api/AuroraDataApiQueryRunner.js +159 -25
- package/driver/aurora-data-api/AuroraDataApiQueryRunner.js.map +1 -1
- package/driver/aurora-data-api-pg/AuroraDataApiPostgresConnectionOptions.d.ts +6 -0
- package/driver/aurora-data-api-pg/AuroraDataApiPostgresConnectionOptions.js.map +1 -1
- package/driver/aurora-data-api-pg/AuroraDataApiPostgresDriver.d.ts +57 -0
- package/driver/aurora-data-api-pg/AuroraDataApiPostgresDriver.js +101 -0
- package/driver/aurora-data-api-pg/AuroraDataApiPostgresDriver.js.map +1 -0
- package/driver/aurora-data-api-pg/AuroraDataApiPostgresQueryRunner.d.ts +4 -3
- package/driver/aurora-data-api-pg/AuroraDataApiPostgresQueryRunner.js +53 -7
- package/driver/aurora-data-api-pg/AuroraDataApiPostgresQueryRunner.js.map +1 -1
- package/driver/better-sqlite3/BetterSqlite3ConnectionOptions.d.ts +50 -0
- package/driver/better-sqlite3/BetterSqlite3ConnectionOptions.js +4 -0
- package/driver/better-sqlite3/BetterSqlite3ConnectionOptions.js.map +1 -0
- package/driver/better-sqlite3/BetterSqlite3Driver.d.ts +46 -0
- package/driver/better-sqlite3/BetterSqlite3Driver.js +127 -0
- package/driver/better-sqlite3/BetterSqlite3Driver.js.map +1 -0
- package/driver/better-sqlite3/BetterSqlite3QueryRunner.d.ts +22 -0
- package/driver/better-sqlite3/BetterSqlite3QueryRunner.js +115 -0
- package/driver/better-sqlite3/BetterSqlite3QueryRunner.js.map +1 -0
- package/driver/cockroachdb/CockroachConnectionCredentialsOptions.js.map +1 -1
- package/driver/cockroachdb/CockroachDriver.d.ts +6 -1
- package/driver/cockroachdb/CockroachDriver.js +9 -4
- package/driver/cockroachdb/CockroachDriver.js.map +1 -1
- package/driver/cockroachdb/CockroachQueryRunner.d.ts +6 -1
- package/driver/cockroachdb/CockroachQueryRunner.js +392 -94
- package/driver/cockroachdb/CockroachQueryRunner.js.map +1 -1
- package/driver/cordova/CordovaDriver.d.ts +2 -1
- package/driver/cordova/CordovaDriver.js +0 -1
- package/driver/cordova/CordovaDriver.js.map +1 -1
- package/driver/expo/ExpoDriver.d.ts +2 -1
- package/driver/expo/ExpoDriver.js +0 -1
- package/driver/expo/ExpoDriver.js.map +1 -1
- package/driver/expo/ExpoQueryRunner.js +72 -14
- package/driver/expo/ExpoQueryRunner.js.map +1 -1
- package/driver/mongodb/MongoConnectionOptions.d.ts +4 -0
- package/driver/mongodb/MongoConnectionOptions.js.map +1 -1
- package/driver/mongodb/MongoDriver.d.ts +13 -4
- package/driver/mongodb/MongoDriver.js +21 -15
- package/driver/mongodb/MongoDriver.js.map +1 -1
- package/driver/mongodb/MongoQueryRunner.d.ts +3 -3
- package/driver/mongodb/MongoQueryRunner.js.map +1 -1
- package/driver/mongodb/typings.js.map +1 -1
- package/driver/mysql/MysqlDriver.d.ts +7 -2
- package/driver/mysql/MysqlDriver.js +14 -7
- package/driver/mysql/MysqlDriver.js.map +1 -1
- package/driver/mysql/MysqlQueryRunner.d.ts +10 -1
- package/driver/mysql/MysqlQueryRunner.js +227 -61
- package/driver/mysql/MysqlQueryRunner.js.map +1 -1
- package/driver/nativescript/NativescriptDriver.d.ts +2 -1
- package/driver/nativescript/NativescriptDriver.js +0 -1
- package/driver/nativescript/NativescriptDriver.js.map +1 -1
- package/driver/oracle/OracleDriver.d.ts +6 -1
- package/driver/oracle/OracleDriver.js +8 -3
- package/driver/oracle/OracleDriver.js.map +1 -1
- package/driver/oracle/OracleQueryRunner.d.ts +2 -1
- package/driver/oracle/OracleQueryRunner.js +139 -26
- package/driver/oracle/OracleQueryRunner.js.map +1 -1
- package/driver/postgres/PostgresConnectionCredentialsOptions.js.map +1 -1
- package/driver/postgres/PostgresConnectionOptions.d.ts +9 -0
- package/driver/postgres/PostgresConnectionOptions.js.map +1 -1
- package/driver/postgres/PostgresDriver.d.ts +18 -55
- package/driver/postgres/PostgresDriver.js +181 -191
- package/driver/postgres/PostgresDriver.js.map +1 -1
- package/driver/postgres/PostgresQueryRunner.d.ts +10 -1
- package/driver/postgres/PostgresQueryRunner.js +389 -81
- package/driver/postgres/PostgresQueryRunner.js.map +1 -1
- package/driver/react-native/ReactNativeDriver.d.ts +2 -1
- package/driver/react-native/ReactNativeDriver.js +0 -1
- package/driver/react-native/ReactNativeDriver.js.map +1 -1
- package/driver/sap/SapDriver.d.ts +6 -1
- package/driver/sap/SapDriver.js +6 -1
- package/driver/sap/SapDriver.js.map +1 -1
- package/driver/sap/SapQueryRunner.d.ts +2 -1
- package/driver/sap/SapQueryRunner.js +143 -27
- package/driver/sap/SapQueryRunner.js.map +1 -1
- package/driver/sqlite/SqliteConnectionOptions.d.ts +18 -0
- package/driver/sqlite/SqliteConnectionOptions.js.map +1 -1
- package/driver/sqlite/SqliteDriver.d.ts +2 -1
- package/driver/sqlite/SqliteDriver.js +25 -11
- package/driver/sqlite/SqliteDriver.js.map +1 -1
- package/driver/sqlite/SqliteQueryRunner.js +33 -14
- package/driver/sqlite/SqliteQueryRunner.js.map +1 -1
- package/driver/sqlite-abstract/AbstractSqliteDriver.d.ts +7 -2
- package/driver/sqlite-abstract/AbstractSqliteDriver.js +31 -4
- package/driver/sqlite-abstract/AbstractSqliteDriver.js.map +1 -1
- package/driver/sqlite-abstract/AbstractSqliteQueryRunner.js +72 -10
- package/driver/sqlite-abstract/AbstractSqliteQueryRunner.js.map +1 -1
- package/driver/sqljs/SqljsDriver.d.ts +2 -1
- package/driver/sqljs/SqljsDriver.js +0 -1
- package/driver/sqljs/SqljsDriver.js.map +1 -1
- package/driver/sqljs/SqljsQueryRunner.js +1 -0
- package/driver/sqljs/SqljsQueryRunner.js.map +1 -1
- package/driver/sqlserver/SqlServerDriver.d.ts +6 -1
- package/driver/sqlserver/SqlServerDriver.js +6 -1
- package/driver/sqlserver/SqlServerDriver.js.map +1 -1
- package/driver/sqlserver/SqlServerQueryRunner.d.ts +2 -1
- package/driver/sqlserver/SqlServerQueryRunner.js +224 -86
- package/driver/sqlserver/SqlServerQueryRunner.js.map +1 -1
- package/driver/types/ColumnTypes.d.ts +1 -1
- package/driver/types/ColumnTypes.js.map +1 -1
- package/driver/types/DatabaseType.d.ts +1 -1
- package/driver/types/DatabaseType.js.map +1 -1
- package/driver/types/ReplicationMode.d.ts +1 -0
- package/driver/types/ReplicationMode.js +4 -0
- package/driver/types/ReplicationMode.js.map +1 -0
- package/entity-manager/EntityManager.d.ts +41 -256
- package/entity-manager/EntityManager.js +3 -13
- package/entity-manager/EntityManager.js.map +1 -1
- package/entity-manager/MongoEntityManager.d.ts +46 -46
- package/entity-manager/MongoEntityManager.js +14 -3
- package/entity-manager/MongoEntityManager.js.map +1 -1
- package/entity-schema/EntitySchemaColumnOptions.js.map +1 -1
- package/entity-schema/EntitySchemaRelationOptions.d.ts +1 -1
- package/entity-schema/EntitySchemaRelationOptions.js.map +1 -1
- package/entity-schema/EntitySchemaTransformer.js +22 -7
- package/entity-schema/EntitySchemaTransformer.js.map +1 -1
- package/error/EntityMetadataNotFoundError.d.ts +2 -2
- package/error/EntityMetadataNotFoundError.js +3 -0
- package/error/EntityMetadataNotFoundError.js.map +1 -1
- package/error/EntityNotFoundError.d.ts +2 -3
- package/error/EntityNotFoundError.js +3 -0
- package/error/EntityNotFoundError.js.map +1 -1
- package/error/FindRelationsNotFoundError.js +2 -2
- package/error/FindRelationsNotFoundError.js.map +1 -1
- package/error/MissingDriverError.js +1 -1
- package/error/MissingDriverError.js.map +1 -1
- package/error/QueryFailedError.js +1 -1
- package/error/QueryFailedError.js.map +1 -1
- package/error/RepositoryNotFoundError.d.ts +2 -2
- package/error/RepositoryNotFoundError.js +3 -0
- package/error/RepositoryNotFoundError.js.map +1 -1
- package/error/RepositoryNotTreeError.d.ts +2 -2
- package/error/RepositoryNotTreeError.js +9 -6
- package/error/RepositoryNotTreeError.js.map +1 -1
- package/find-options/FindOneOptions.d.ts +4 -0
- package/find-options/FindOneOptions.js.map +1 -1
- package/find-options/FindOperator.d.ts +26 -4
- package/find-options/FindOperator.js +49 -50
- package/find-options/FindOperator.js.map +1 -1
- package/find-options/FindOperatorType.d.ts +1 -1
- package/find-options/FindOperatorType.js.map +1 -1
- package/find-options/FindOptionsUtils.d.ts +2 -2
- package/find-options/FindOptionsUtils.js +5 -1
- package/find-options/FindOptionsUtils.js.map +1 -1
- package/find-options/operator/Any.d.ts +1 -1
- package/find-options/operator/Any.js.map +1 -1
- package/find-options/operator/Between.d.ts +1 -1
- package/find-options/operator/Between.js.map +1 -1
- package/find-options/operator/ILike.d.ts +6 -0
- package/find-options/operator/ILike.js +13 -0
- package/find-options/operator/ILike.js.map +1 -0
- package/find-options/operator/In.d.ts +1 -1
- package/find-options/operator/In.js.map +1 -1
- package/find-options/operator/Raw.d.ts +14 -2
- package/find-options/operator/Raw.js +5 -6
- package/find-options/operator/Raw.js.map +1 -1
- package/index.d.ts +10 -11
- package/index.js +2 -14
- package/index.js.map +1 -1
- package/logger/DebugLogger.d.ts +0 -1
- package/logger/DebugLogger.js +10 -9
- package/logger/DebugLogger.js.map +1 -1
- package/logger/FileLogger.d.ts +3 -1
- package/logger/FileLogger.js +10 -3
- package/logger/FileLogger.js.map +1 -1
- package/logger/Logger.d.ts +1 -1
- package/logger/Logger.js.map +1 -1
- package/logger/LoggerOptions.d.ts +9 -0
- package/logger/LoggerOptions.js.map +1 -1
- package/metadata/ColumnMetadata.js +24 -14
- package/metadata/ColumnMetadata.js.map +1 -1
- package/metadata/EntityMetadata.d.ts +1 -0
- package/metadata/EntityMetadata.js +11 -3
- package/metadata/EntityMetadata.js.map +1 -1
- package/metadata/RelationMetadata.js +2 -2
- package/metadata/RelationMetadata.js.map +1 -1
- package/metadata/types/EventListenerTypes.d.ts +7 -7
- package/metadata/types/EventListenerTypes.js.map +1 -1
- package/metadata-args/EntityRepositoryMetadataArgs.d.ts +2 -2
- package/metadata-args/EntityRepositoryMetadataArgs.js.map +1 -1
- package/metadata-args/RelationCountMetadataArgs.js.map +1 -1
- package/metadata-args/RelationIdMetadataArgs.js.map +1 -1
- package/metadata-builder/EntityMetadataBuilder.js +15 -9
- package/metadata-builder/EntityMetadataBuilder.js.map +1 -1
- package/metadata-builder/EntityMetadataValidator.js +8 -5
- package/metadata-builder/EntityMetadataValidator.js.map +1 -1
- package/metadata-builder/JunctionEntityMetadataBuilder.js +1 -0
- package/metadata-builder/JunctionEntityMetadataBuilder.js.map +1 -1
- package/migration/MigrationExecutor.js +103 -74
- package/migration/MigrationExecutor.js.map +1 -1
- package/package.json +72 -51
- package/persistence/EntityPersistExecutor.js +61 -43
- package/persistence/EntityPersistExecutor.js.map +1 -1
- package/persistence/Subject.js +2 -1
- package/persistence/Subject.js.map +1 -1
- package/persistence/SubjectDatabaseEntityLoader.js +2 -1
- package/persistence/SubjectDatabaseEntityLoader.js.map +1 -1
- package/persistence/SubjectExecutor.js +244 -187
- package/persistence/SubjectExecutor.js.map +1 -1
- package/persistence/tree/MaterializedPathSubjectExecutor.js +2 -1
- package/persistence/tree/MaterializedPathSubjectExecutor.js.map +1 -1
- package/platform/PlatformTools.d.ts +7 -1
- package/platform/PlatformTools.js +42 -41
- package/platform/PlatformTools.js.map +1 -1
- package/query-builder/Alias.js.map +1 -1
- package/query-builder/DeleteQueryBuilder.d.ts +2 -3
- package/query-builder/DeleteQueryBuilder.js +7 -1
- package/query-builder/DeleteQueryBuilder.js.map +1 -1
- package/query-builder/InsertQueryBuilder.d.ts +2 -3
- package/query-builder/InsertQueryBuilder.js +44 -11
- package/query-builder/InsertQueryBuilder.js.map +1 -1
- package/query-builder/QueryBuilder.d.ts +18 -15
- package/query-builder/QueryBuilder.js +198 -48
- package/query-builder/QueryBuilder.js.map +1 -1
- package/query-builder/QueryExpressionMap.d.ts +4 -0
- package/query-builder/QueryExpressionMap.js.map +1 -1
- package/query-builder/QueryPartialEntity.d.ts +1 -1
- package/query-builder/QueryPartialEntity.js.map +1 -1
- package/query-builder/ReturningResultsEntityUpdator.js +23 -24
- package/query-builder/ReturningResultsEntityUpdator.js.map +1 -1
- package/query-builder/SelectQueryBuilder.d.ts +8 -3
- package/query-builder/SelectQueryBuilder.js +80 -32
- package/query-builder/SelectQueryBuilder.js.map +1 -1
- package/query-builder/SoftDeleteQueryBuilder.d.ts +2 -3
- package/query-builder/SoftDeleteQueryBuilder.js +1 -1
- package/query-builder/SoftDeleteQueryBuilder.js.map +1 -1
- package/query-builder/UpdateQueryBuilder.js +8 -2
- package/query-builder/UpdateQueryBuilder.js.map +1 -1
- package/query-builder/transformer/RawSqlResultsToEntityTransformer.js +6 -3
- package/query-builder/transformer/RawSqlResultsToEntityTransformer.js.map +1 -1
- package/query-runner/BaseQueryRunner.d.ts +2 -5
- package/query-runner/BaseQueryRunner.js +90 -40
- package/query-runner/BaseQueryRunner.js.map +1 -1
- package/query-runner/QueryRunner.d.ts +1 -1
- package/query-runner/QueryRunner.js.map +1 -1
- package/repository/AbstractRepository.js.map +1 -1
- package/repository/BaseEntity.js +1 -1
- package/repository/BaseEntity.js.map +1 -1
- package/repository/MongoRepository.js.map +1 -1
- package/repository/Repository.js +1 -1
- package/repository/Repository.js.map +1 -1
- package/repository/TreeRepository.js +2 -2
- package/repository/TreeRepository.js.map +1 -1
- package/schema-builder/MongoSchemaBuilder.js +1 -1
- package/schema-builder/MongoSchemaBuilder.js.map +1 -1
- package/schema-builder/RdbmsSchemaBuilder.js +875 -319
- package/schema-builder/RdbmsSchemaBuilder.js.map +1 -1
- package/schema-builder/options/TableIndexOptions.d.ts +1 -1
- package/schema-builder/options/TableIndexOptions.js.map +1 -1
- package/schema-builder/view/View.d.ts +1 -2
- package/schema-builder/view/View.js.map +1 -1
- package/subscriber/Broadcaster.d.ts +24 -0
- package/subscriber/Broadcaster.js +120 -0
- package/subscriber/Broadcaster.js.map +1 -1
- package/subscriber/EntitySubscriberInterface.d.ts +27 -0
- package/subscriber/EntitySubscriberInterface.js.map +1 -1
- package/subscriber/event/TransactionCommitEvent.d.ts +22 -0
- package/subscriber/event/TransactionCommitEvent.js +4 -0
- package/subscriber/event/TransactionCommitEvent.js.map +1 -0
- package/subscriber/event/TransactionRollbackEvent.d.ts +22 -0
- package/subscriber/event/TransactionRollbackEvent.js +4 -0
- package/subscriber/event/TransactionRollbackEvent.js.map +1 -0
- package/subscriber/event/TransactionStartEvent.d.ts +22 -0
- package/subscriber/event/TransactionStartEvent.js +4 -0
- package/subscriber/event/TransactionStartEvent.js.map +1 -0
- package/typeorm-class-transformer-shim.js +16 -2
- package/typeorm-model-shim.js +146 -111
- package/util/ApplyValueTransformers.js.map +1 -1
- package/util/DateUtils.js +1 -7
- package/util/DateUtils.js.map +1 -1
- package/util/DirectoryExportedClassesLoader.js +7 -5
- package/util/DirectoryExportedClassesLoader.js.map +1 -1
- package/util/ObjectUtils.js +2 -2
- package/util/ObjectUtils.js.map +1 -1
- package/util/OrmUtils.js +3 -6
- package/util/OrmUtils.js.map +1 -1
- package/browser/util/PromiseUtils.d.ts +0 -24
- package/browser/util/PromiseUtils.js +0 -62
- package/browser/util/PromiseUtils.js.map +0 -1
- package/util/PromiseUtils.d.ts +0 -24
- package/util/PromiseUtils.js +0 -64
- package/util/PromiseUtils.js.map +0 -1
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { PromiseUtils } from "../../";
|
|
1
|
+
import { __awaiter, __extends, __generator, __read, __values } from "tslib";
|
|
3
2
|
import { QueryFailedError } from "../../error/QueryFailedError";
|
|
4
3
|
import { QueryRunnerAlreadyReleasedError } from "../../error/QueryRunnerAlreadyReleasedError";
|
|
5
4
|
import { TransactionAlreadyStartedError } from "../../error/TransactionAlreadyStartedError";
|
|
@@ -16,16 +15,16 @@ import { View } from "../../schema-builder/view/View";
|
|
|
16
15
|
import { Broadcaster } from "../../subscriber/Broadcaster";
|
|
17
16
|
import { OrmUtils } from "../../util/OrmUtils";
|
|
18
17
|
import { Query } from "../Query";
|
|
18
|
+
import { BroadcasterResult } from "../../subscriber/BroadcasterResult";
|
|
19
19
|
/**
|
|
20
20
|
* Runs queries on a single postgres database connection.
|
|
21
21
|
*/
|
|
22
22
|
var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
23
|
-
|
|
23
|
+
__extends(PostgresQueryRunner, _super);
|
|
24
24
|
// -------------------------------------------------------------------------
|
|
25
25
|
// Constructor
|
|
26
26
|
// -------------------------------------------------------------------------
|
|
27
27
|
function PostgresQueryRunner(driver, mode) {
|
|
28
|
-
if (mode === void 0) { mode = "master"; }
|
|
29
28
|
var _this = _super.call(this) || this;
|
|
30
29
|
_this.driver = driver;
|
|
31
30
|
_this.connection = driver.connection;
|
|
@@ -48,19 +47,29 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
48
47
|
return this.databaseConnectionPromise;
|
|
49
48
|
if (this.mode === "slave" && this.driver.isReplicated) {
|
|
50
49
|
this.databaseConnectionPromise = this.driver.obtainSlaveConnection().then(function (_a) {
|
|
51
|
-
var _b =
|
|
50
|
+
var _b = __read(_a, 2), connection = _b[0], release = _b[1];
|
|
52
51
|
_this.driver.connectedQueryRunners.push(_this);
|
|
53
52
|
_this.databaseConnection = connection;
|
|
54
|
-
|
|
53
|
+
var onErrorCallback = function () { return _this.release(); };
|
|
54
|
+
_this.releaseCallback = function () {
|
|
55
|
+
_this.databaseConnection.removeListener("error", onErrorCallback);
|
|
56
|
+
release();
|
|
57
|
+
};
|
|
58
|
+
_this.databaseConnection.on("error", onErrorCallback);
|
|
55
59
|
return _this.databaseConnection;
|
|
56
60
|
});
|
|
57
61
|
}
|
|
58
62
|
else { // master
|
|
59
63
|
this.databaseConnectionPromise = this.driver.obtainMasterConnection().then(function (_a) {
|
|
60
|
-
var _b =
|
|
64
|
+
var _b = __read(_a, 2), connection = _b[0], release = _b[1];
|
|
61
65
|
_this.driver.connectedQueryRunners.push(_this);
|
|
62
66
|
_this.databaseConnection = connection;
|
|
63
|
-
|
|
67
|
+
var onErrorCallback = function () { return _this.release(); };
|
|
68
|
+
_this.releaseCallback = function () {
|
|
69
|
+
_this.databaseConnection.removeListener("error", onErrorCallback);
|
|
70
|
+
release();
|
|
71
|
+
};
|
|
72
|
+
_this.databaseConnection.on("error", onErrorCallback);
|
|
64
73
|
return _this.databaseConnection;
|
|
65
74
|
});
|
|
66
75
|
}
|
|
@@ -71,6 +80,9 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
71
80
|
* You cannot use query runner methods once its released.
|
|
72
81
|
*/
|
|
73
82
|
PostgresQueryRunner.prototype.release = function () {
|
|
83
|
+
if (this.isReleased) {
|
|
84
|
+
return Promise.resolve();
|
|
85
|
+
}
|
|
74
86
|
this.isReleased = true;
|
|
75
87
|
if (this.releaseCallback)
|
|
76
88
|
this.releaseCallback();
|
|
@@ -83,22 +95,39 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
83
95
|
* Starts transaction.
|
|
84
96
|
*/
|
|
85
97
|
PostgresQueryRunner.prototype.startTransaction = function (isolationLevel) {
|
|
86
|
-
return
|
|
87
|
-
|
|
98
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
99
|
+
var beforeBroadcastResult, afterBroadcastResult;
|
|
100
|
+
return __generator(this, function (_a) {
|
|
88
101
|
switch (_a.label) {
|
|
89
102
|
case 0:
|
|
90
103
|
if (this.isTransactionActive)
|
|
91
104
|
throw new TransactionAlreadyStartedError();
|
|
105
|
+
beforeBroadcastResult = new BroadcasterResult();
|
|
106
|
+
this.broadcaster.broadcastBeforeTransactionStartEvent(beforeBroadcastResult);
|
|
107
|
+
if (!(beforeBroadcastResult.promises.length > 0)) return [3 /*break*/, 2];
|
|
108
|
+
return [4 /*yield*/, Promise.all(beforeBroadcastResult.promises)];
|
|
109
|
+
case 1:
|
|
110
|
+
_a.sent();
|
|
111
|
+
_a.label = 2;
|
|
112
|
+
case 2:
|
|
92
113
|
this.isTransactionActive = true;
|
|
93
114
|
return [4 /*yield*/, this.query("START TRANSACTION")];
|
|
94
|
-
case
|
|
115
|
+
case 3:
|
|
95
116
|
_a.sent();
|
|
96
|
-
if (!isolationLevel) return [3 /*break*/,
|
|
117
|
+
if (!isolationLevel) return [3 /*break*/, 5];
|
|
97
118
|
return [4 /*yield*/, this.query("SET TRANSACTION ISOLATION LEVEL " + isolationLevel)];
|
|
98
|
-
case
|
|
119
|
+
case 4:
|
|
99
120
|
_a.sent();
|
|
100
|
-
_a.label =
|
|
101
|
-
case
|
|
121
|
+
_a.label = 5;
|
|
122
|
+
case 5:
|
|
123
|
+
afterBroadcastResult = new BroadcasterResult();
|
|
124
|
+
this.broadcaster.broadcastAfterTransactionStartEvent(afterBroadcastResult);
|
|
125
|
+
if (!(afterBroadcastResult.promises.length > 0)) return [3 /*break*/, 7];
|
|
126
|
+
return [4 /*yield*/, Promise.all(afterBroadcastResult.promises)];
|
|
127
|
+
case 6:
|
|
128
|
+
_a.sent();
|
|
129
|
+
_a.label = 7;
|
|
130
|
+
case 7: return [2 /*return*/];
|
|
102
131
|
}
|
|
103
132
|
});
|
|
104
133
|
});
|
|
@@ -108,17 +137,32 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
108
137
|
* Error will be thrown if transaction was not started.
|
|
109
138
|
*/
|
|
110
139
|
PostgresQueryRunner.prototype.commitTransaction = function () {
|
|
111
|
-
return
|
|
112
|
-
|
|
140
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
141
|
+
var beforeBroadcastResult, afterBroadcastResult;
|
|
142
|
+
return __generator(this, function (_a) {
|
|
113
143
|
switch (_a.label) {
|
|
114
144
|
case 0:
|
|
115
145
|
if (!this.isTransactionActive)
|
|
116
146
|
throw new TransactionNotStartedError();
|
|
117
|
-
|
|
147
|
+
beforeBroadcastResult = new BroadcasterResult();
|
|
148
|
+
this.broadcaster.broadcastBeforeTransactionCommitEvent(beforeBroadcastResult);
|
|
149
|
+
if (!(beforeBroadcastResult.promises.length > 0)) return [3 /*break*/, 2];
|
|
150
|
+
return [4 /*yield*/, Promise.all(beforeBroadcastResult.promises)];
|
|
118
151
|
case 1:
|
|
152
|
+
_a.sent();
|
|
153
|
+
_a.label = 2;
|
|
154
|
+
case 2: return [4 /*yield*/, this.query("COMMIT")];
|
|
155
|
+
case 3:
|
|
119
156
|
_a.sent();
|
|
120
157
|
this.isTransactionActive = false;
|
|
121
|
-
|
|
158
|
+
afterBroadcastResult = new BroadcasterResult();
|
|
159
|
+
this.broadcaster.broadcastAfterTransactionCommitEvent(afterBroadcastResult);
|
|
160
|
+
if (!(afterBroadcastResult.promises.length > 0)) return [3 /*break*/, 5];
|
|
161
|
+
return [4 /*yield*/, Promise.all(afterBroadcastResult.promises)];
|
|
162
|
+
case 4:
|
|
163
|
+
_a.sent();
|
|
164
|
+
_a.label = 5;
|
|
165
|
+
case 5: return [2 /*return*/];
|
|
122
166
|
}
|
|
123
167
|
});
|
|
124
168
|
});
|
|
@@ -128,17 +172,32 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
128
172
|
* Error will be thrown if transaction was not started.
|
|
129
173
|
*/
|
|
130
174
|
PostgresQueryRunner.prototype.rollbackTransaction = function () {
|
|
131
|
-
return
|
|
132
|
-
|
|
175
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
176
|
+
var beforeBroadcastResult, afterBroadcastResult;
|
|
177
|
+
return __generator(this, function (_a) {
|
|
133
178
|
switch (_a.label) {
|
|
134
179
|
case 0:
|
|
135
180
|
if (!this.isTransactionActive)
|
|
136
181
|
throw new TransactionNotStartedError();
|
|
137
|
-
|
|
182
|
+
beforeBroadcastResult = new BroadcasterResult();
|
|
183
|
+
this.broadcaster.broadcastBeforeTransactionRollbackEvent(beforeBroadcastResult);
|
|
184
|
+
if (!(beforeBroadcastResult.promises.length > 0)) return [3 /*break*/, 2];
|
|
185
|
+
return [4 /*yield*/, Promise.all(beforeBroadcastResult.promises)];
|
|
138
186
|
case 1:
|
|
187
|
+
_a.sent();
|
|
188
|
+
_a.label = 2;
|
|
189
|
+
case 2: return [4 /*yield*/, this.query("ROLLBACK")];
|
|
190
|
+
case 3:
|
|
139
191
|
_a.sent();
|
|
140
192
|
this.isTransactionActive = false;
|
|
141
|
-
|
|
193
|
+
afterBroadcastResult = new BroadcasterResult();
|
|
194
|
+
this.broadcaster.broadcastAfterTransactionRollbackEvent(afterBroadcastResult);
|
|
195
|
+
if (!(afterBroadcastResult.promises.length > 0)) return [3 /*break*/, 5];
|
|
196
|
+
return [4 /*yield*/, Promise.all(afterBroadcastResult.promises)];
|
|
197
|
+
case 4:
|
|
198
|
+
_a.sent();
|
|
199
|
+
_a.label = 5;
|
|
200
|
+
case 5: return [2 /*return*/];
|
|
142
201
|
}
|
|
143
202
|
});
|
|
144
203
|
});
|
|
@@ -150,10 +209,10 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
150
209
|
var _this = this;
|
|
151
210
|
if (this.isReleased)
|
|
152
211
|
throw new QueryRunnerAlreadyReleasedError();
|
|
153
|
-
return new Promise(function (ok, fail) { return
|
|
212
|
+
return new Promise(function (ok, fail) { return __awaiter(_this, void 0, void 0, function () {
|
|
154
213
|
var databaseConnection, queryStartTime_1, err_1;
|
|
155
214
|
var _this = this;
|
|
156
|
-
return
|
|
215
|
+
return __generator(this, function (_a) {
|
|
157
216
|
switch (_a.label) {
|
|
158
217
|
case 0:
|
|
159
218
|
_a.trys.push([0, 2, , 3]);
|
|
@@ -203,9 +262,9 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
203
262
|
var QueryStream = this.driver.loadStreamDependency();
|
|
204
263
|
if (this.isReleased)
|
|
205
264
|
throw new QueryRunnerAlreadyReleasedError();
|
|
206
|
-
return new Promise(function (ok, fail) { return
|
|
265
|
+
return new Promise(function (ok, fail) { return __awaiter(_this, void 0, void 0, function () {
|
|
207
266
|
var databaseConnection, stream, err_2;
|
|
208
|
-
return
|
|
267
|
+
return __generator(this, function (_a) {
|
|
209
268
|
switch (_a.label) {
|
|
210
269
|
case 0:
|
|
211
270
|
_a.trys.push([0, 2, , 3]);
|
|
@@ -233,8 +292,8 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
233
292
|
* Returns all available database names including system databases.
|
|
234
293
|
*/
|
|
235
294
|
PostgresQueryRunner.prototype.getDatabases = function () {
|
|
236
|
-
return
|
|
237
|
-
return
|
|
295
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
296
|
+
return __generator(this, function (_a) {
|
|
238
297
|
return [2 /*return*/, Promise.resolve([])];
|
|
239
298
|
});
|
|
240
299
|
});
|
|
@@ -244,8 +303,8 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
244
303
|
* If database parameter specified, returns schemas of that database.
|
|
245
304
|
*/
|
|
246
305
|
PostgresQueryRunner.prototype.getSchemas = function (database) {
|
|
247
|
-
return
|
|
248
|
-
return
|
|
306
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
307
|
+
return __generator(this, function (_a) {
|
|
249
308
|
return [2 /*return*/, Promise.resolve([])];
|
|
250
309
|
});
|
|
251
310
|
});
|
|
@@ -254,8 +313,8 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
254
313
|
* Checks if database with the given name exist.
|
|
255
314
|
*/
|
|
256
315
|
PostgresQueryRunner.prototype.hasDatabase = function (database) {
|
|
257
|
-
return
|
|
258
|
-
return
|
|
316
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
317
|
+
return __generator(this, function (_a) {
|
|
259
318
|
return [2 /*return*/, Promise.resolve(false)];
|
|
260
319
|
});
|
|
261
320
|
});
|
|
@@ -264,9 +323,9 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
264
323
|
* Checks if schema with the given name exist.
|
|
265
324
|
*/
|
|
266
325
|
PostgresQueryRunner.prototype.hasSchema = function (schema) {
|
|
267
|
-
return
|
|
326
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
268
327
|
var result;
|
|
269
|
-
return
|
|
328
|
+
return __generator(this, function (_a) {
|
|
270
329
|
switch (_a.label) {
|
|
271
330
|
case 0: return [4 /*yield*/, this.query("SELECT * FROM \"information_schema\".\"schemata\" WHERE \"schema_name\" = '" + schema + "'")];
|
|
272
331
|
case 1:
|
|
@@ -280,9 +339,9 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
280
339
|
* Checks if table with the given name exist in the database.
|
|
281
340
|
*/
|
|
282
341
|
PostgresQueryRunner.prototype.hasTable = function (tableOrName) {
|
|
283
|
-
return
|
|
342
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
284
343
|
var parsedTableName, sql, result;
|
|
285
|
-
return
|
|
344
|
+
return __generator(this, function (_a) {
|
|
286
345
|
switch (_a.label) {
|
|
287
346
|
case 0:
|
|
288
347
|
parsedTableName = this.parseTableName(tableOrName);
|
|
@@ -299,9 +358,9 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
299
358
|
* Checks if column with the given name exist in the given table.
|
|
300
359
|
*/
|
|
301
360
|
PostgresQueryRunner.prototype.hasColumn = function (tableOrName, columnName) {
|
|
302
|
-
return
|
|
361
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
303
362
|
var parsedTableName, sql, result;
|
|
304
|
-
return
|
|
363
|
+
return __generator(this, function (_a) {
|
|
305
364
|
switch (_a.label) {
|
|
306
365
|
case 0:
|
|
307
366
|
parsedTableName = this.parseTableName(tableOrName);
|
|
@@ -319,8 +378,8 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
319
378
|
* Postgres does not supports database creation inside a transaction block.
|
|
320
379
|
*/
|
|
321
380
|
PostgresQueryRunner.prototype.createDatabase = function (database, ifNotExist) {
|
|
322
|
-
return
|
|
323
|
-
return
|
|
381
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
382
|
+
return __generator(this, function (_a) {
|
|
324
383
|
switch (_a.label) {
|
|
325
384
|
case 0: return [4 /*yield*/, Promise.resolve()];
|
|
326
385
|
case 1:
|
|
@@ -335,8 +394,8 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
335
394
|
* Postgres does not supports database drop inside a transaction block.
|
|
336
395
|
*/
|
|
337
396
|
PostgresQueryRunner.prototype.dropDatabase = function (database, ifExist) {
|
|
338
|
-
return
|
|
339
|
-
return
|
|
397
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
398
|
+
return __generator(this, function (_a) {
|
|
340
399
|
return [2 /*return*/, Promise.resolve()];
|
|
341
400
|
});
|
|
342
401
|
});
|
|
@@ -345,9 +404,9 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
345
404
|
* Creates a new table schema.
|
|
346
405
|
*/
|
|
347
406
|
PostgresQueryRunner.prototype.createSchema = function (schema, ifNotExist) {
|
|
348
|
-
return
|
|
407
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
349
408
|
var up, down;
|
|
350
|
-
return
|
|
409
|
+
return __generator(this, function (_a) {
|
|
351
410
|
switch (_a.label) {
|
|
352
411
|
case 0:
|
|
353
412
|
up = ifNotExist ? "CREATE SCHEMA IF NOT EXISTS \"" + schema + "\"" : "CREATE SCHEMA \"" + schema + "\"";
|
|
@@ -364,9 +423,9 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
364
423
|
* Drops table schema.
|
|
365
424
|
*/
|
|
366
425
|
PostgresQueryRunner.prototype.dropSchema = function (schemaPath, ifExist, isCascade) {
|
|
367
|
-
return
|
|
426
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
368
427
|
var schema, up, down;
|
|
369
|
-
return
|
|
428
|
+
return __generator(this, function (_a) {
|
|
370
429
|
switch (_a.label) {
|
|
371
430
|
case 0:
|
|
372
431
|
schema = schemaPath.indexOf(".") === -1 ? schemaPath : schemaPath.split(".")[0];
|
|
@@ -387,10 +446,10 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
387
446
|
if (ifNotExist === void 0) { ifNotExist = false; }
|
|
388
447
|
if (createForeignKeys === void 0) { createForeignKeys = true; }
|
|
389
448
|
if (createIndices === void 0) { createIndices = true; }
|
|
390
|
-
return
|
|
449
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
391
450
|
var isTableExist, upQueries, downQueries;
|
|
392
451
|
var _this = this;
|
|
393
|
-
return
|
|
452
|
+
return __generator(this, function (_a) {
|
|
394
453
|
switch (_a.label) {
|
|
395
454
|
case 0:
|
|
396
455
|
if (!ifNotExist) return [3 /*break*/, 2];
|
|
@@ -406,9 +465,9 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
406
465
|
// if table have column with ENUM type, we must create this type in postgres.
|
|
407
466
|
return [4 /*yield*/, Promise.all(table.columns
|
|
408
467
|
.filter(function (column) { return column.type === "enum" || column.type === "simple-enum"; })
|
|
409
|
-
.map(function (column) { return
|
|
468
|
+
.map(function (column) { return __awaiter(_this, void 0, void 0, function () {
|
|
410
469
|
var hasEnum;
|
|
411
|
-
return
|
|
470
|
+
return __generator(this, function (_a) {
|
|
412
471
|
switch (_a.label) {
|
|
413
472
|
case 0: return [4 /*yield*/, this.hasEnumType(table, column)];
|
|
414
473
|
case 1:
|
|
@@ -454,10 +513,10 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
454
513
|
PostgresQueryRunner.prototype.dropTable = function (target, ifExist, dropForeignKeys, dropIndices) {
|
|
455
514
|
if (dropForeignKeys === void 0) { dropForeignKeys = true; }
|
|
456
515
|
if (dropIndices === void 0) { dropIndices = true; }
|
|
457
|
-
return
|
|
516
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
458
517
|
var isTableExist, createForeignKeys, tableName, table, upQueries, downQueries;
|
|
459
518
|
var _this = this;
|
|
460
|
-
return
|
|
519
|
+
return __generator(this, function (_a) {
|
|
461
520
|
switch (_a.label) {
|
|
462
521
|
case 0:
|
|
463
522
|
if (!ifExist) return [3 /*break*/, 2];
|
|
@@ -497,9 +556,9 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
497
556
|
* Creates a new view.
|
|
498
557
|
*/
|
|
499
558
|
PostgresQueryRunner.prototype.createView = function (view) {
|
|
500
|
-
return
|
|
559
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
501
560
|
var upQueries, downQueries, _a, _b, _c, _d;
|
|
502
|
-
return
|
|
561
|
+
return __generator(this, function (_e) {
|
|
503
562
|
switch (_e.label) {
|
|
504
563
|
case 0:
|
|
505
564
|
upQueries = [];
|
|
@@ -526,9 +585,9 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
526
585
|
* Drops the view.
|
|
527
586
|
*/
|
|
528
587
|
PostgresQueryRunner.prototype.dropView = function (target) {
|
|
529
|
-
return
|
|
588
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
530
589
|
var viewName, view, upQueries, downQueries, _a, _b, _c, _d;
|
|
531
|
-
return
|
|
590
|
+
return __generator(this, function (_e) {
|
|
532
591
|
switch (_e.label) {
|
|
533
592
|
case 0:
|
|
534
593
|
viewName = target instanceof View ? target.name : target;
|
|
@@ -559,23 +618,24 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
559
618
|
* Renames the given table.
|
|
560
619
|
*/
|
|
561
620
|
PostgresQueryRunner.prototype.renameTable = function (oldTableOrName, newTableName) {
|
|
562
|
-
return
|
|
563
|
-
var
|
|
621
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
622
|
+
var upQueries, downQueries, oldTable, _a, newTable, oldTableName, schemaName, columnNames, oldPkName, newPkName, enumColumns, enumColumns_1, enumColumns_1_1, column, oldEnumType, e_1_1;
|
|
623
|
+
var e_1, _b;
|
|
564
624
|
var _this = this;
|
|
565
|
-
return
|
|
625
|
+
return __generator(this, function (_c) {
|
|
566
626
|
switch (_c.label) {
|
|
567
627
|
case 0:
|
|
568
628
|
upQueries = [];
|
|
569
629
|
downQueries = [];
|
|
570
630
|
if (!(oldTableOrName instanceof Table)) return [3 /*break*/, 1];
|
|
571
|
-
|
|
631
|
+
_a = oldTableOrName;
|
|
572
632
|
return [3 /*break*/, 3];
|
|
573
633
|
case 1: return [4 /*yield*/, this.getCachedTable(oldTableOrName)];
|
|
574
634
|
case 2:
|
|
575
|
-
|
|
635
|
+
_a = _c.sent();
|
|
576
636
|
_c.label = 3;
|
|
577
637
|
case 3:
|
|
578
|
-
oldTable =
|
|
638
|
+
oldTable = _a;
|
|
579
639
|
newTable = oldTable.clone();
|
|
580
640
|
oldTableName = oldTable.name.indexOf(".") === -1 ? oldTable.name : oldTable.name.split(".")[1];
|
|
581
641
|
schemaName = oldTable.name.indexOf(".") === -1 ? undefined : oldTable.name.split(".")[0];
|
|
@@ -627,7 +687,7 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
627
687
|
_c.label = 4;
|
|
628
688
|
case 4:
|
|
629
689
|
_c.trys.push([4, 9, 10, 11]);
|
|
630
|
-
enumColumns_1 =
|
|
690
|
+
enumColumns_1 = __values(enumColumns), enumColumns_1_1 = enumColumns_1.next();
|
|
631
691
|
_c.label = 5;
|
|
632
692
|
case 5:
|
|
633
693
|
if (!!enumColumns_1_1.done) return [3 /*break*/, 8];
|
|
@@ -648,7 +708,7 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
648
708
|
return [3 /*break*/, 11];
|
|
649
709
|
case 10:
|
|
650
710
|
try {
|
|
651
|
-
if (enumColumns_1_1 && !enumColumns_1_1.done && (
|
|
711
|
+
if (enumColumns_1_1 && !enumColumns_1_1.done && (_b = enumColumns_1.return)) _b.call(enumColumns_1);
|
|
652
712
|
}
|
|
653
713
|
finally { if (e_1) throw e_1.error; }
|
|
654
714
|
return [7 /*endfinally*/];
|
|
@@ -664,9 +724,9 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
664
724
|
* Creates a new column from the column in the table.
|
|
665
725
|
*/
|
|
666
726
|
PostgresQueryRunner.prototype.addColumn = function (tableOrName, column) {
|
|
667
|
-
return
|
|
727
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
668
728
|
var table, _a, clonedTable, upQueries, downQueries, hasEnum, primaryColumns, pkName_1, columnNames_1, pkName, columnNames, columnIndex, uniqueConstraint;
|
|
669
|
-
return
|
|
729
|
+
return __generator(this, function (_b) {
|
|
670
730
|
switch (_b.label) {
|
|
671
731
|
case 0:
|
|
672
732
|
if (!(tableOrName instanceof Table)) return [3 /*break*/, 1];
|
|
@@ -724,6 +784,11 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
724
784
|
upQueries.push(new Query("ALTER TABLE " + this.escapePath(table) + " ADD CONSTRAINT \"" + uniqueConstraint.name + "\" UNIQUE (\"" + column.name + "\")"));
|
|
725
785
|
downQueries.push(new Query("ALTER TABLE " + this.escapePath(table) + " DROP CONSTRAINT \"" + uniqueConstraint.name + "\""));
|
|
726
786
|
}
|
|
787
|
+
// create column's comment
|
|
788
|
+
if (column.comment) {
|
|
789
|
+
upQueries.push(new Query("COMMENT ON COLUMN " + this.escapePath(table) + ".\"" + column.name + "\" IS " + this.escapeComment(column.comment)));
|
|
790
|
+
downQueries.push(new Query("COMMENT ON COLUMN " + this.escapePath(table) + ".\"" + column.name + "\" IS " + this.escapeComment(column.comment)));
|
|
791
|
+
}
|
|
727
792
|
return [4 /*yield*/, this.executeQueries(upQueries, downQueries)];
|
|
728
793
|
case 6:
|
|
729
794
|
_b.sent();
|
|
@@ -738,14 +803,37 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
738
803
|
* Creates a new columns from the column in the table.
|
|
739
804
|
*/
|
|
740
805
|
PostgresQueryRunner.prototype.addColumns = function (tableOrName, columns) {
|
|
741
|
-
return
|
|
742
|
-
var
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
806
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
807
|
+
var columns_1, columns_1_1, column, e_2_1;
|
|
808
|
+
var e_2, _a;
|
|
809
|
+
return __generator(this, function (_b) {
|
|
810
|
+
switch (_b.label) {
|
|
811
|
+
case 0:
|
|
812
|
+
_b.trys.push([0, 5, 6, 7]);
|
|
813
|
+
columns_1 = __values(columns), columns_1_1 = columns_1.next();
|
|
814
|
+
_b.label = 1;
|
|
746
815
|
case 1:
|
|
747
|
-
|
|
748
|
-
|
|
816
|
+
if (!!columns_1_1.done) return [3 /*break*/, 4];
|
|
817
|
+
column = columns_1_1.value;
|
|
818
|
+
return [4 /*yield*/, this.addColumn(tableOrName, column)];
|
|
819
|
+
case 2:
|
|
820
|
+
_b.sent();
|
|
821
|
+
_b.label = 3;
|
|
822
|
+
case 3:
|
|
823
|
+
columns_1_1 = columns_1.next();
|
|
824
|
+
return [3 /*break*/, 1];
|
|
825
|
+
case 4: return [3 /*break*/, 7];
|
|
826
|
+
case 5:
|
|
827
|
+
e_2_1 = _b.sent();
|
|
828
|
+
e_2 = { error: e_2_1 };
|
|
829
|
+
return [3 /*break*/, 7];
|
|
830
|
+
case 6:
|
|
831
|
+
try {
|
|
832
|
+
if (columns_1_1 && !columns_1_1.done && (_a = columns_1.return)) _a.call(columns_1);
|
|
833
|
+
}
|
|
834
|
+
finally { if (e_2) throw e_2.error; }
|
|
835
|
+
return [7 /*endfinally*/];
|
|
836
|
+
case 7: return [2 /*return*/];
|
|
749
837
|
}
|
|
750
838
|
});
|
|
751
839
|
});
|
|
@@ -754,9 +842,9 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
754
842
|
* Renames column in the given table.
|
|
755
843
|
*/
|
|
756
844
|
PostgresQueryRunner.prototype.renameColumn = function (tableOrName, oldTableColumnOrName, newTableColumnOrName) {
|
|
757
|
-
return
|
|
845
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
758
846
|
var table, _a, oldColumn, newColumn;
|
|
759
|
-
return
|
|
847
|
+
return __generator(this, function (_b) {
|
|
760
848
|
switch (_b.label) {
|
|
761
849
|
case 0:
|
|
762
850
|
if (!(tableOrName instanceof Table)) return [3 /*break*/, 1];
|
|
@@ -787,10 +875,10 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
787
875
|
* Changes a column in the table.
|
|
788
876
|
*/
|
|
789
877
|
PostgresQueryRunner.prototype.changeColumn = function (tableOrName, oldTableColumnOrName, newColumn) {
|
|
790
|
-
return
|
|
878
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
791
879
|
var table, _a, clonedTable, upQueries, downQueries, oldColumn, oldEnumType, primaryColumns, columnNames, oldPkName, newPkName, schema, seqName, newSeqName, up, down, oldTableColumn, enumName, arraySuffix, oldEnumName, oldEnumNameWithoutSchema, enumTypeBeforeColumnChange, upType, downType, primaryColumns, pkName, columnNames, column, pkName, columnNames, primaryColumn, column, pkName, columnNames, uniqueConstraint, uniqueConstraint;
|
|
792
880
|
var _this = this;
|
|
793
|
-
return
|
|
881
|
+
return __generator(this, function (_b) {
|
|
794
882
|
switch (_b.label) {
|
|
795
883
|
case 0:
|
|
796
884
|
if (!(tableOrName instanceof Table)) return [3 /*break*/, 1];
|
|
@@ -952,8 +1040,8 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
952
1040
|
}
|
|
953
1041
|
}
|
|
954
1042
|
if (oldColumn.comment !== newColumn.comment) {
|
|
955
|
-
upQueries.push(new Query("COMMENT ON COLUMN " + this.escapePath(table) + ".\"" + oldColumn.name + "\" IS
|
|
956
|
-
downQueries.push(new Query("COMMENT ON COLUMN " + this.escapePath(table) + ".\"" + newColumn.name + "\" IS
|
|
1043
|
+
upQueries.push(new Query("COMMENT ON COLUMN " + this.escapePath(table) + ".\"" + oldColumn.name + "\" IS " + this.escapeComment(newColumn.comment)));
|
|
1044
|
+
downQueries.push(new Query("COMMENT ON COLUMN " + this.escapePath(table) + ".\"" + newColumn.name + "\" IS " + this.escapeComment(oldColumn.comment)));
|
|
957
1045
|
}
|
|
958
1046
|
if (newColumn.isPrimary !== oldColumn.isPrimary) {
|
|
959
1047
|
primaryColumns = clonedTable.primaryColumns;
|
|
@@ -1053,14 +1141,37 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
1053
1141
|
* Changes a column in the table.
|
|
1054
1142
|
*/
|
|
1055
1143
|
PostgresQueryRunner.prototype.changeColumns = function (tableOrName, changedColumns) {
|
|
1056
|
-
return
|
|
1057
|
-
var
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1144
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1145
|
+
var changedColumns_1, changedColumns_1_1, _a, oldColumn, newColumn, e_3_1;
|
|
1146
|
+
var e_3, _b;
|
|
1147
|
+
return __generator(this, function (_c) {
|
|
1148
|
+
switch (_c.label) {
|
|
1149
|
+
case 0:
|
|
1150
|
+
_c.trys.push([0, 5, 6, 7]);
|
|
1151
|
+
changedColumns_1 = __values(changedColumns), changedColumns_1_1 = changedColumns_1.next();
|
|
1152
|
+
_c.label = 1;
|
|
1061
1153
|
case 1:
|
|
1062
|
-
|
|
1063
|
-
|
|
1154
|
+
if (!!changedColumns_1_1.done) return [3 /*break*/, 4];
|
|
1155
|
+
_a = changedColumns_1_1.value, oldColumn = _a.oldColumn, newColumn = _a.newColumn;
|
|
1156
|
+
return [4 /*yield*/, this.changeColumn(tableOrName, oldColumn, newColumn)];
|
|
1157
|
+
case 2:
|
|
1158
|
+
_c.sent();
|
|
1159
|
+
_c.label = 3;
|
|
1160
|
+
case 3:
|
|
1161
|
+
changedColumns_1_1 = changedColumns_1.next();
|
|
1162
|
+
return [3 /*break*/, 1];
|
|
1163
|
+
case 4: return [3 /*break*/, 7];
|
|
1164
|
+
case 5:
|
|
1165
|
+
e_3_1 = _c.sent();
|
|
1166
|
+
e_3 = { error: e_3_1 };
|
|
1167
|
+
return [3 /*break*/, 7];
|
|
1168
|
+
case 6:
|
|
1169
|
+
try {
|
|
1170
|
+
if (changedColumns_1_1 && !changedColumns_1_1.done && (_b = changedColumns_1.return)) _b.call(changedColumns_1);
|
|
1171
|
+
}
|
|
1172
|
+
finally { if (e_3) throw e_3.error; }
|
|
1173
|
+
return [7 /*endfinally*/];
|
|
1174
|
+
case 7: return [2 /*return*/];
|
|
1064
1175
|
}
|
|
1065
1176
|
});
|
|
1066
1177
|
});
|
|
@@ -1069,9 +1180,9 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
1069
1180
|
* Drops column in the table.
|
|
1070
1181
|
*/
|
|
1071
1182
|
PostgresQueryRunner.prototype.dropColumn = function (tableOrName, columnOrName) {
|
|
1072
|
-
return
|
|
1183
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1073
1184
|
var table, _a, column, clonedTable, upQueries, downQueries, pkName, columnNames, tableColumn, pkName_2, columnNames_2, columnIndex, columnCheck, columnUnique, hasEnum, enumType, escapedEnumName;
|
|
1074
|
-
return
|
|
1185
|
+
return __generator(this, function (_b) {
|
|
1075
1186
|
switch (_b.label) {
|
|
1076
1187
|
case 0:
|
|
1077
1188
|
if (!(tableOrName instanceof Table)) return [3 /*break*/, 1];
|
|
@@ -1151,14 +1262,37 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
1151
1262
|
* Drops the columns in the table.
|
|
1152
1263
|
*/
|
|
1153
1264
|
PostgresQueryRunner.prototype.dropColumns = function (tableOrName, columns) {
|
|
1154
|
-
return
|
|
1155
|
-
var
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1265
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1266
|
+
var columns_2, columns_2_1, column, e_4_1;
|
|
1267
|
+
var e_4, _a;
|
|
1268
|
+
return __generator(this, function (_b) {
|
|
1269
|
+
switch (_b.label) {
|
|
1270
|
+
case 0:
|
|
1271
|
+
_b.trys.push([0, 5, 6, 7]);
|
|
1272
|
+
columns_2 = __values(columns), columns_2_1 = columns_2.next();
|
|
1273
|
+
_b.label = 1;
|
|
1159
1274
|
case 1:
|
|
1160
|
-
|
|
1161
|
-
|
|
1275
|
+
if (!!columns_2_1.done) return [3 /*break*/, 4];
|
|
1276
|
+
column = columns_2_1.value;
|
|
1277
|
+
return [4 /*yield*/, this.dropColumn(tableOrName, column)];
|
|
1278
|
+
case 2:
|
|
1279
|
+
_b.sent();
|
|
1280
|
+
_b.label = 3;
|
|
1281
|
+
case 3:
|
|
1282
|
+
columns_2_1 = columns_2.next();
|
|
1283
|
+
return [3 /*break*/, 1];
|
|
1284
|
+
case 4: return [3 /*break*/, 7];
|
|
1285
|
+
case 5:
|
|
1286
|
+
e_4_1 = _b.sent();
|
|
1287
|
+
e_4 = { error: e_4_1 };
|
|
1288
|
+
return [3 /*break*/, 7];
|
|
1289
|
+
case 6:
|
|
1290
|
+
try {
|
|
1291
|
+
if (columns_2_1 && !columns_2_1.done && (_a = columns_2.return)) _a.call(columns_2);
|
|
1292
|
+
}
|
|
1293
|
+
finally { if (e_4) throw e_4.error; }
|
|
1294
|
+
return [7 /*endfinally*/];
|
|
1295
|
+
case 7: return [2 /*return*/];
|
|
1162
1296
|
}
|
|
1163
1297
|
});
|
|
1164
1298
|
});
|
|
@@ -1167,9 +1301,9 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
1167
1301
|
* Creates a new primary key.
|
|
1168
1302
|
*/
|
|
1169
1303
|
PostgresQueryRunner.prototype.createPrimaryKey = function (tableOrName, columnNames) {
|
|
1170
|
-
return
|
|
1304
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1171
1305
|
var table, _a, clonedTable, up, down;
|
|
1172
|
-
return
|
|
1306
|
+
return __generator(this, function (_b) {
|
|
1173
1307
|
switch (_b.label) {
|
|
1174
1308
|
case 0:
|
|
1175
1309
|
if (!(tableOrName instanceof Table)) return [3 /*break*/, 1];
|
|
@@ -1202,9 +1336,9 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
1202
1336
|
* Updates composite primary keys.
|
|
1203
1337
|
*/
|
|
1204
1338
|
PostgresQueryRunner.prototype.updatePrimaryKeys = function (tableOrName, columns) {
|
|
1205
|
-
return
|
|
1339
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1206
1340
|
var table, _a, clonedTable, columnNames, upQueries, downQueries, primaryColumns, pkName_3, columnNamesString_1, pkName, columnNamesString;
|
|
1207
|
-
return
|
|
1341
|
+
return __generator(this, function (_b) {
|
|
1208
1342
|
switch (_b.label) {
|
|
1209
1343
|
case 0:
|
|
1210
1344
|
if (!(tableOrName instanceof Table)) return [3 /*break*/, 1];
|
|
@@ -1248,9 +1382,9 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
1248
1382
|
* Drops a primary key.
|
|
1249
1383
|
*/
|
|
1250
1384
|
PostgresQueryRunner.prototype.dropPrimaryKey = function (tableOrName) {
|
|
1251
|
-
return
|
|
1385
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1252
1386
|
var table, _a, up, down;
|
|
1253
|
-
return
|
|
1387
|
+
return __generator(this, function (_b) {
|
|
1254
1388
|
switch (_b.label) {
|
|
1255
1389
|
case 0:
|
|
1256
1390
|
if (!(tableOrName instanceof Table)) return [3 /*break*/, 1];
|
|
@@ -1279,9 +1413,9 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
1279
1413
|
* Creates new unique constraint.
|
|
1280
1414
|
*/
|
|
1281
1415
|
PostgresQueryRunner.prototype.createUniqueConstraint = function (tableOrName, uniqueConstraint) {
|
|
1282
|
-
return
|
|
1416
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1283
1417
|
var table, _a, up, down;
|
|
1284
|
-
return
|
|
1418
|
+
return __generator(this, function (_b) {
|
|
1285
1419
|
switch (_b.label) {
|
|
1286
1420
|
case 0:
|
|
1287
1421
|
if (!(tableOrName instanceof Table)) return [3 /*break*/, 1];
|
|
@@ -1311,14 +1445,37 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
1311
1445
|
* Creates new unique constraints.
|
|
1312
1446
|
*/
|
|
1313
1447
|
PostgresQueryRunner.prototype.createUniqueConstraints = function (tableOrName, uniqueConstraints) {
|
|
1314
|
-
return
|
|
1315
|
-
var
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1448
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1449
|
+
var uniqueConstraints_1, uniqueConstraints_1_1, uniqueConstraint, e_5_1;
|
|
1450
|
+
var e_5, _a;
|
|
1451
|
+
return __generator(this, function (_b) {
|
|
1452
|
+
switch (_b.label) {
|
|
1453
|
+
case 0:
|
|
1454
|
+
_b.trys.push([0, 5, 6, 7]);
|
|
1455
|
+
uniqueConstraints_1 = __values(uniqueConstraints), uniqueConstraints_1_1 = uniqueConstraints_1.next();
|
|
1456
|
+
_b.label = 1;
|
|
1319
1457
|
case 1:
|
|
1320
|
-
|
|
1321
|
-
|
|
1458
|
+
if (!!uniqueConstraints_1_1.done) return [3 /*break*/, 4];
|
|
1459
|
+
uniqueConstraint = uniqueConstraints_1_1.value;
|
|
1460
|
+
return [4 /*yield*/, this.createUniqueConstraint(tableOrName, uniqueConstraint)];
|
|
1461
|
+
case 2:
|
|
1462
|
+
_b.sent();
|
|
1463
|
+
_b.label = 3;
|
|
1464
|
+
case 3:
|
|
1465
|
+
uniqueConstraints_1_1 = uniqueConstraints_1.next();
|
|
1466
|
+
return [3 /*break*/, 1];
|
|
1467
|
+
case 4: return [3 /*break*/, 7];
|
|
1468
|
+
case 5:
|
|
1469
|
+
e_5_1 = _b.sent();
|
|
1470
|
+
e_5 = { error: e_5_1 };
|
|
1471
|
+
return [3 /*break*/, 7];
|
|
1472
|
+
case 6:
|
|
1473
|
+
try {
|
|
1474
|
+
if (uniqueConstraints_1_1 && !uniqueConstraints_1_1.done && (_a = uniqueConstraints_1.return)) _a.call(uniqueConstraints_1);
|
|
1475
|
+
}
|
|
1476
|
+
finally { if (e_5) throw e_5.error; }
|
|
1477
|
+
return [7 /*endfinally*/];
|
|
1478
|
+
case 7: return [2 /*return*/];
|
|
1322
1479
|
}
|
|
1323
1480
|
});
|
|
1324
1481
|
});
|
|
@@ -1327,9 +1484,9 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
1327
1484
|
* Drops unique constraint.
|
|
1328
1485
|
*/
|
|
1329
1486
|
PostgresQueryRunner.prototype.dropUniqueConstraint = function (tableOrName, uniqueOrName) {
|
|
1330
|
-
return
|
|
1487
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1331
1488
|
var table, _a, uniqueConstraint, up, down;
|
|
1332
|
-
return
|
|
1489
|
+
return __generator(this, function (_b) {
|
|
1333
1490
|
switch (_b.label) {
|
|
1334
1491
|
case 0:
|
|
1335
1492
|
if (!(tableOrName instanceof Table)) return [3 /*break*/, 1];
|
|
@@ -1359,14 +1516,37 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
1359
1516
|
* Drops unique constraints.
|
|
1360
1517
|
*/
|
|
1361
1518
|
PostgresQueryRunner.prototype.dropUniqueConstraints = function (tableOrName, uniqueConstraints) {
|
|
1362
|
-
return
|
|
1363
|
-
var
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1519
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1520
|
+
var uniqueConstraints_2, uniqueConstraints_2_1, uniqueConstraint, e_6_1;
|
|
1521
|
+
var e_6, _a;
|
|
1522
|
+
return __generator(this, function (_b) {
|
|
1523
|
+
switch (_b.label) {
|
|
1524
|
+
case 0:
|
|
1525
|
+
_b.trys.push([0, 5, 6, 7]);
|
|
1526
|
+
uniqueConstraints_2 = __values(uniqueConstraints), uniqueConstraints_2_1 = uniqueConstraints_2.next();
|
|
1527
|
+
_b.label = 1;
|
|
1367
1528
|
case 1:
|
|
1368
|
-
|
|
1369
|
-
|
|
1529
|
+
if (!!uniqueConstraints_2_1.done) return [3 /*break*/, 4];
|
|
1530
|
+
uniqueConstraint = uniqueConstraints_2_1.value;
|
|
1531
|
+
return [4 /*yield*/, this.dropUniqueConstraint(tableOrName, uniqueConstraint)];
|
|
1532
|
+
case 2:
|
|
1533
|
+
_b.sent();
|
|
1534
|
+
_b.label = 3;
|
|
1535
|
+
case 3:
|
|
1536
|
+
uniqueConstraints_2_1 = uniqueConstraints_2.next();
|
|
1537
|
+
return [3 /*break*/, 1];
|
|
1538
|
+
case 4: return [3 /*break*/, 7];
|
|
1539
|
+
case 5:
|
|
1540
|
+
e_6_1 = _b.sent();
|
|
1541
|
+
e_6 = { error: e_6_1 };
|
|
1542
|
+
return [3 /*break*/, 7];
|
|
1543
|
+
case 6:
|
|
1544
|
+
try {
|
|
1545
|
+
if (uniqueConstraints_2_1 && !uniqueConstraints_2_1.done && (_a = uniqueConstraints_2.return)) _a.call(uniqueConstraints_2);
|
|
1546
|
+
}
|
|
1547
|
+
finally { if (e_6) throw e_6.error; }
|
|
1548
|
+
return [7 /*endfinally*/];
|
|
1549
|
+
case 7: return [2 /*return*/];
|
|
1370
1550
|
}
|
|
1371
1551
|
});
|
|
1372
1552
|
});
|
|
@@ -1375,9 +1555,9 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
1375
1555
|
* Creates new check constraint.
|
|
1376
1556
|
*/
|
|
1377
1557
|
PostgresQueryRunner.prototype.createCheckConstraint = function (tableOrName, checkConstraint) {
|
|
1378
|
-
return
|
|
1558
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1379
1559
|
var table, _a, up, down;
|
|
1380
|
-
return
|
|
1560
|
+
return __generator(this, function (_b) {
|
|
1381
1561
|
switch (_b.label) {
|
|
1382
1562
|
case 0:
|
|
1383
1563
|
if (!(tableOrName instanceof Table)) return [3 /*break*/, 1];
|
|
@@ -1407,10 +1587,10 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
1407
1587
|
* Creates new check constraints.
|
|
1408
1588
|
*/
|
|
1409
1589
|
PostgresQueryRunner.prototype.createCheckConstraints = function (tableOrName, checkConstraints) {
|
|
1410
|
-
return
|
|
1590
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1411
1591
|
var promises;
|
|
1412
1592
|
var _this = this;
|
|
1413
|
-
return
|
|
1593
|
+
return __generator(this, function (_a) {
|
|
1414
1594
|
switch (_a.label) {
|
|
1415
1595
|
case 0:
|
|
1416
1596
|
promises = checkConstraints.map(function (checkConstraint) { return _this.createCheckConstraint(tableOrName, checkConstraint); });
|
|
@@ -1426,9 +1606,9 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
1426
1606
|
* Drops check constraint.
|
|
1427
1607
|
*/
|
|
1428
1608
|
PostgresQueryRunner.prototype.dropCheckConstraint = function (tableOrName, checkOrName) {
|
|
1429
|
-
return
|
|
1609
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1430
1610
|
var table, _a, checkConstraint, up, down;
|
|
1431
|
-
return
|
|
1611
|
+
return __generator(this, function (_b) {
|
|
1432
1612
|
switch (_b.label) {
|
|
1433
1613
|
case 0:
|
|
1434
1614
|
if (!(tableOrName instanceof Table)) return [3 /*break*/, 1];
|
|
@@ -1458,10 +1638,10 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
1458
1638
|
* Drops check constraints.
|
|
1459
1639
|
*/
|
|
1460
1640
|
PostgresQueryRunner.prototype.dropCheckConstraints = function (tableOrName, checkConstraints) {
|
|
1461
|
-
return
|
|
1641
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1462
1642
|
var promises;
|
|
1463
1643
|
var _this = this;
|
|
1464
|
-
return
|
|
1644
|
+
return __generator(this, function (_a) {
|
|
1465
1645
|
switch (_a.label) {
|
|
1466
1646
|
case 0:
|
|
1467
1647
|
promises = checkConstraints.map(function (checkConstraint) { return _this.dropCheckConstraint(tableOrName, checkConstraint); });
|
|
@@ -1477,9 +1657,9 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
1477
1657
|
* Creates new exclusion constraint.
|
|
1478
1658
|
*/
|
|
1479
1659
|
PostgresQueryRunner.prototype.createExclusionConstraint = function (tableOrName, exclusionConstraint) {
|
|
1480
|
-
return
|
|
1660
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1481
1661
|
var table, _a, up, down;
|
|
1482
|
-
return
|
|
1662
|
+
return __generator(this, function (_b) {
|
|
1483
1663
|
switch (_b.label) {
|
|
1484
1664
|
case 0:
|
|
1485
1665
|
if (!(tableOrName instanceof Table)) return [3 /*break*/, 1];
|
|
@@ -1509,10 +1689,10 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
1509
1689
|
* Creates new exclusion constraints.
|
|
1510
1690
|
*/
|
|
1511
1691
|
PostgresQueryRunner.prototype.createExclusionConstraints = function (tableOrName, exclusionConstraints) {
|
|
1512
|
-
return
|
|
1692
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1513
1693
|
var promises;
|
|
1514
1694
|
var _this = this;
|
|
1515
|
-
return
|
|
1695
|
+
return __generator(this, function (_a) {
|
|
1516
1696
|
switch (_a.label) {
|
|
1517
1697
|
case 0:
|
|
1518
1698
|
promises = exclusionConstraints.map(function (exclusionConstraint) { return _this.createExclusionConstraint(tableOrName, exclusionConstraint); });
|
|
@@ -1528,9 +1708,9 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
1528
1708
|
* Drops exclusion constraint.
|
|
1529
1709
|
*/
|
|
1530
1710
|
PostgresQueryRunner.prototype.dropExclusionConstraint = function (tableOrName, exclusionOrName) {
|
|
1531
|
-
return
|
|
1711
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1532
1712
|
var table, _a, exclusionConstraint, up, down;
|
|
1533
|
-
return
|
|
1713
|
+
return __generator(this, function (_b) {
|
|
1534
1714
|
switch (_b.label) {
|
|
1535
1715
|
case 0:
|
|
1536
1716
|
if (!(tableOrName instanceof Table)) return [3 /*break*/, 1];
|
|
@@ -1560,10 +1740,10 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
1560
1740
|
* Drops exclusion constraints.
|
|
1561
1741
|
*/
|
|
1562
1742
|
PostgresQueryRunner.prototype.dropExclusionConstraints = function (tableOrName, exclusionConstraints) {
|
|
1563
|
-
return
|
|
1743
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1564
1744
|
var promises;
|
|
1565
1745
|
var _this = this;
|
|
1566
|
-
return
|
|
1746
|
+
return __generator(this, function (_a) {
|
|
1567
1747
|
switch (_a.label) {
|
|
1568
1748
|
case 0:
|
|
1569
1749
|
promises = exclusionConstraints.map(function (exclusionConstraint) { return _this.dropExclusionConstraint(tableOrName, exclusionConstraint); });
|
|
@@ -1579,9 +1759,9 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
1579
1759
|
* Creates a new foreign key.
|
|
1580
1760
|
*/
|
|
1581
1761
|
PostgresQueryRunner.prototype.createForeignKey = function (tableOrName, foreignKey) {
|
|
1582
|
-
return
|
|
1762
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1583
1763
|
var table, _a, up, down;
|
|
1584
|
-
return
|
|
1764
|
+
return __generator(this, function (_b) {
|
|
1585
1765
|
switch (_b.label) {
|
|
1586
1766
|
case 0:
|
|
1587
1767
|
if (!(tableOrName instanceof Table)) return [3 /*break*/, 1];
|
|
@@ -1611,14 +1791,37 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
1611
1791
|
* Creates a new foreign keys.
|
|
1612
1792
|
*/
|
|
1613
1793
|
PostgresQueryRunner.prototype.createForeignKeys = function (tableOrName, foreignKeys) {
|
|
1614
|
-
return
|
|
1615
|
-
var
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1794
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1795
|
+
var foreignKeys_1, foreignKeys_1_1, foreignKey, e_7_1;
|
|
1796
|
+
var e_7, _a;
|
|
1797
|
+
return __generator(this, function (_b) {
|
|
1798
|
+
switch (_b.label) {
|
|
1799
|
+
case 0:
|
|
1800
|
+
_b.trys.push([0, 5, 6, 7]);
|
|
1801
|
+
foreignKeys_1 = __values(foreignKeys), foreignKeys_1_1 = foreignKeys_1.next();
|
|
1802
|
+
_b.label = 1;
|
|
1619
1803
|
case 1:
|
|
1620
|
-
|
|
1621
|
-
|
|
1804
|
+
if (!!foreignKeys_1_1.done) return [3 /*break*/, 4];
|
|
1805
|
+
foreignKey = foreignKeys_1_1.value;
|
|
1806
|
+
return [4 /*yield*/, this.createForeignKey(tableOrName, foreignKey)];
|
|
1807
|
+
case 2:
|
|
1808
|
+
_b.sent();
|
|
1809
|
+
_b.label = 3;
|
|
1810
|
+
case 3:
|
|
1811
|
+
foreignKeys_1_1 = foreignKeys_1.next();
|
|
1812
|
+
return [3 /*break*/, 1];
|
|
1813
|
+
case 4: return [3 /*break*/, 7];
|
|
1814
|
+
case 5:
|
|
1815
|
+
e_7_1 = _b.sent();
|
|
1816
|
+
e_7 = { error: e_7_1 };
|
|
1817
|
+
return [3 /*break*/, 7];
|
|
1818
|
+
case 6:
|
|
1819
|
+
try {
|
|
1820
|
+
if (foreignKeys_1_1 && !foreignKeys_1_1.done && (_a = foreignKeys_1.return)) _a.call(foreignKeys_1);
|
|
1821
|
+
}
|
|
1822
|
+
finally { if (e_7) throw e_7.error; }
|
|
1823
|
+
return [7 /*endfinally*/];
|
|
1824
|
+
case 7: return [2 /*return*/];
|
|
1622
1825
|
}
|
|
1623
1826
|
});
|
|
1624
1827
|
});
|
|
@@ -1627,9 +1830,9 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
1627
1830
|
* Drops a foreign key from the table.
|
|
1628
1831
|
*/
|
|
1629
1832
|
PostgresQueryRunner.prototype.dropForeignKey = function (tableOrName, foreignKeyOrName) {
|
|
1630
|
-
return
|
|
1833
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1631
1834
|
var table, _a, foreignKey, up, down;
|
|
1632
|
-
return
|
|
1835
|
+
return __generator(this, function (_b) {
|
|
1633
1836
|
switch (_b.label) {
|
|
1634
1837
|
case 0:
|
|
1635
1838
|
if (!(tableOrName instanceof Table)) return [3 /*break*/, 1];
|
|
@@ -1659,14 +1862,37 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
1659
1862
|
* Drops a foreign keys from the table.
|
|
1660
1863
|
*/
|
|
1661
1864
|
PostgresQueryRunner.prototype.dropForeignKeys = function (tableOrName, foreignKeys) {
|
|
1662
|
-
return
|
|
1663
|
-
var
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1865
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1866
|
+
var foreignKeys_2, foreignKeys_2_1, foreignKey, e_8_1;
|
|
1867
|
+
var e_8, _a;
|
|
1868
|
+
return __generator(this, function (_b) {
|
|
1869
|
+
switch (_b.label) {
|
|
1870
|
+
case 0:
|
|
1871
|
+
_b.trys.push([0, 5, 6, 7]);
|
|
1872
|
+
foreignKeys_2 = __values(foreignKeys), foreignKeys_2_1 = foreignKeys_2.next();
|
|
1873
|
+
_b.label = 1;
|
|
1667
1874
|
case 1:
|
|
1668
|
-
|
|
1669
|
-
|
|
1875
|
+
if (!!foreignKeys_2_1.done) return [3 /*break*/, 4];
|
|
1876
|
+
foreignKey = foreignKeys_2_1.value;
|
|
1877
|
+
return [4 /*yield*/, this.dropForeignKey(tableOrName, foreignKey)];
|
|
1878
|
+
case 2:
|
|
1879
|
+
_b.sent();
|
|
1880
|
+
_b.label = 3;
|
|
1881
|
+
case 3:
|
|
1882
|
+
foreignKeys_2_1 = foreignKeys_2.next();
|
|
1883
|
+
return [3 /*break*/, 1];
|
|
1884
|
+
case 4: return [3 /*break*/, 7];
|
|
1885
|
+
case 5:
|
|
1886
|
+
e_8_1 = _b.sent();
|
|
1887
|
+
e_8 = { error: e_8_1 };
|
|
1888
|
+
return [3 /*break*/, 7];
|
|
1889
|
+
case 6:
|
|
1890
|
+
try {
|
|
1891
|
+
if (foreignKeys_2_1 && !foreignKeys_2_1.done && (_a = foreignKeys_2.return)) _a.call(foreignKeys_2);
|
|
1892
|
+
}
|
|
1893
|
+
finally { if (e_8) throw e_8.error; }
|
|
1894
|
+
return [7 /*endfinally*/];
|
|
1895
|
+
case 7: return [2 /*return*/];
|
|
1670
1896
|
}
|
|
1671
1897
|
});
|
|
1672
1898
|
});
|
|
@@ -1675,9 +1901,9 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
1675
1901
|
* Creates a new index.
|
|
1676
1902
|
*/
|
|
1677
1903
|
PostgresQueryRunner.prototype.createIndex = function (tableOrName, index) {
|
|
1678
|
-
return
|
|
1904
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1679
1905
|
var table, _a, up, down;
|
|
1680
|
-
return
|
|
1906
|
+
return __generator(this, function (_b) {
|
|
1681
1907
|
switch (_b.label) {
|
|
1682
1908
|
case 0:
|
|
1683
1909
|
if (!(tableOrName instanceof Table)) return [3 /*break*/, 1];
|
|
@@ -1707,14 +1933,37 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
1707
1933
|
* Creates a new indices
|
|
1708
1934
|
*/
|
|
1709
1935
|
PostgresQueryRunner.prototype.createIndices = function (tableOrName, indices) {
|
|
1710
|
-
return
|
|
1711
|
-
var
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1936
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1937
|
+
var indices_1, indices_1_1, index, e_9_1;
|
|
1938
|
+
var e_9, _a;
|
|
1939
|
+
return __generator(this, function (_b) {
|
|
1940
|
+
switch (_b.label) {
|
|
1941
|
+
case 0:
|
|
1942
|
+
_b.trys.push([0, 5, 6, 7]);
|
|
1943
|
+
indices_1 = __values(indices), indices_1_1 = indices_1.next();
|
|
1944
|
+
_b.label = 1;
|
|
1715
1945
|
case 1:
|
|
1716
|
-
|
|
1717
|
-
|
|
1946
|
+
if (!!indices_1_1.done) return [3 /*break*/, 4];
|
|
1947
|
+
index = indices_1_1.value;
|
|
1948
|
+
return [4 /*yield*/, this.createIndex(tableOrName, index)];
|
|
1949
|
+
case 2:
|
|
1950
|
+
_b.sent();
|
|
1951
|
+
_b.label = 3;
|
|
1952
|
+
case 3:
|
|
1953
|
+
indices_1_1 = indices_1.next();
|
|
1954
|
+
return [3 /*break*/, 1];
|
|
1955
|
+
case 4: return [3 /*break*/, 7];
|
|
1956
|
+
case 5:
|
|
1957
|
+
e_9_1 = _b.sent();
|
|
1958
|
+
e_9 = { error: e_9_1 };
|
|
1959
|
+
return [3 /*break*/, 7];
|
|
1960
|
+
case 6:
|
|
1961
|
+
try {
|
|
1962
|
+
if (indices_1_1 && !indices_1_1.done && (_a = indices_1.return)) _a.call(indices_1);
|
|
1963
|
+
}
|
|
1964
|
+
finally { if (e_9) throw e_9.error; }
|
|
1965
|
+
return [7 /*endfinally*/];
|
|
1966
|
+
case 7: return [2 /*return*/];
|
|
1718
1967
|
}
|
|
1719
1968
|
});
|
|
1720
1969
|
});
|
|
@@ -1723,9 +1972,9 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
1723
1972
|
* Drops an index from the table.
|
|
1724
1973
|
*/
|
|
1725
1974
|
PostgresQueryRunner.prototype.dropIndex = function (tableOrName, indexOrName) {
|
|
1726
|
-
return
|
|
1975
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1727
1976
|
var table, _a, index, up, down;
|
|
1728
|
-
return
|
|
1977
|
+
return __generator(this, function (_b) {
|
|
1729
1978
|
switch (_b.label) {
|
|
1730
1979
|
case 0:
|
|
1731
1980
|
if (!(tableOrName instanceof Table)) return [3 /*break*/, 1];
|
|
@@ -1755,14 +2004,37 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
1755
2004
|
* Drops an indices from the table.
|
|
1756
2005
|
*/
|
|
1757
2006
|
PostgresQueryRunner.prototype.dropIndices = function (tableOrName, indices) {
|
|
1758
|
-
return
|
|
1759
|
-
var
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
2007
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
2008
|
+
var indices_2, indices_2_1, index, e_10_1;
|
|
2009
|
+
var e_10, _a;
|
|
2010
|
+
return __generator(this, function (_b) {
|
|
2011
|
+
switch (_b.label) {
|
|
2012
|
+
case 0:
|
|
2013
|
+
_b.trys.push([0, 5, 6, 7]);
|
|
2014
|
+
indices_2 = __values(indices), indices_2_1 = indices_2.next();
|
|
2015
|
+
_b.label = 1;
|
|
1763
2016
|
case 1:
|
|
1764
|
-
|
|
1765
|
-
|
|
2017
|
+
if (!!indices_2_1.done) return [3 /*break*/, 4];
|
|
2018
|
+
index = indices_2_1.value;
|
|
2019
|
+
return [4 /*yield*/, this.dropIndex(tableOrName, index)];
|
|
2020
|
+
case 2:
|
|
2021
|
+
_b.sent();
|
|
2022
|
+
_b.label = 3;
|
|
2023
|
+
case 3:
|
|
2024
|
+
indices_2_1 = indices_2.next();
|
|
2025
|
+
return [3 /*break*/, 1];
|
|
2026
|
+
case 4: return [3 /*break*/, 7];
|
|
2027
|
+
case 5:
|
|
2028
|
+
e_10_1 = _b.sent();
|
|
2029
|
+
e_10 = { error: e_10_1 };
|
|
2030
|
+
return [3 /*break*/, 7];
|
|
2031
|
+
case 6:
|
|
2032
|
+
try {
|
|
2033
|
+
if (indices_2_1 && !indices_2_1.done && (_a = indices_2.return)) _a.call(indices_2);
|
|
2034
|
+
}
|
|
2035
|
+
finally { if (e_10) throw e_10.error; }
|
|
2036
|
+
return [7 /*endfinally*/];
|
|
2037
|
+
case 7: return [2 /*return*/];
|
|
1766
2038
|
}
|
|
1767
2039
|
});
|
|
1768
2040
|
});
|
|
@@ -1772,8 +2044,8 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
1772
2044
|
* Note: this operation uses SQL's TRUNCATE query which cannot be reverted in transactions.
|
|
1773
2045
|
*/
|
|
1774
2046
|
PostgresQueryRunner.prototype.clearTable = function (tableName) {
|
|
1775
|
-
return
|
|
1776
|
-
return
|
|
2047
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
2048
|
+
return __generator(this, function (_a) {
|
|
1777
2049
|
switch (_a.label) {
|
|
1778
2050
|
case 0: return [4 /*yield*/, this.query("TRUNCATE TABLE " + this.escapePath(tableName))];
|
|
1779
2051
|
case 1:
|
|
@@ -1787,10 +2059,10 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
1787
2059
|
* Removes all tables from the currently connected database.
|
|
1788
2060
|
*/
|
|
1789
2061
|
PostgresQueryRunner.prototype.clearDatabase = function () {
|
|
1790
|
-
return
|
|
2062
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1791
2063
|
var schemas, schemaNamesString, selectViewDropsQuery, dropViewQueries, selectTableDropsQuery, dropTableQueries, error_1, rollbackError_1;
|
|
1792
2064
|
var _this = this;
|
|
1793
|
-
return
|
|
2065
|
+
return __generator(this, function (_a) {
|
|
1794
2066
|
switch (_a.label) {
|
|
1795
2067
|
case 0:
|
|
1796
2068
|
schemas = [];
|
|
@@ -1855,10 +2127,10 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
1855
2127
|
// Protected Methods
|
|
1856
2128
|
// -------------------------------------------------------------------------
|
|
1857
2129
|
PostgresQueryRunner.prototype.loadViews = function (viewNames) {
|
|
1858
|
-
return
|
|
2130
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1859
2131
|
var hasTable, currentSchemaQuery, currentSchema, viewsCondition, query, dbViews;
|
|
1860
2132
|
var _this = this;
|
|
1861
|
-
return
|
|
2133
|
+
return __generator(this, function (_a) {
|
|
1862
2134
|
switch (_a.label) {
|
|
1863
2135
|
case 0: return [4 /*yield*/, this.hasTable(this.getTypeormMetadataTableName())];
|
|
1864
2136
|
case 1:
|
|
@@ -1870,7 +2142,7 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
1870
2142
|
currentSchemaQuery = _a.sent();
|
|
1871
2143
|
currentSchema = currentSchemaQuery[0]["current_schema"];
|
|
1872
2144
|
viewsCondition = viewNames.map(function (viewName) {
|
|
1873
|
-
var _a =
|
|
2145
|
+
var _a = __read(viewName.split("."), 2), schema = _a[0], name = _a[1];
|
|
1874
2146
|
if (!name) {
|
|
1875
2147
|
name = schema;
|
|
1876
2148
|
schema = _this.driver.options.schema || currentSchema;
|
|
@@ -1897,10 +2169,10 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
1897
2169
|
* Loads all tables (with given names) from the database and creates a Table from them.
|
|
1898
2170
|
*/
|
|
1899
2171
|
PostgresQueryRunner.prototype.loadTables = function (tableNames) {
|
|
1900
|
-
return
|
|
1901
|
-
var currentSchemaQuery, currentSchema, tablesCondition, tablesSql, columnsSql, constraintsCondition, constraintsSql, indicesSql, foreignKeysCondition, foreignKeysSql, _a, dbTables, dbColumns, dbConstraints, dbIndices, dbForeignKeys;
|
|
2172
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
2173
|
+
var currentSchemaQuery, currentSchema, tablesCondition, tablesSql, columnsSql, constraintsCondition, constraintsSql, indicesSql, foreignKeysCondition, hasRelispartitionColumn, isPartitionCondition, foreignKeysSql, _a, dbTables, dbColumns, dbConstraints, dbIndices, dbForeignKeys;
|
|
1902
2174
|
var _this = this;
|
|
1903
|
-
return
|
|
2175
|
+
return __generator(this, function (_b) {
|
|
1904
2176
|
switch (_b.label) {
|
|
1905
2177
|
case 0:
|
|
1906
2178
|
// if no tables given then no need to proceed
|
|
@@ -1911,7 +2183,7 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
1911
2183
|
currentSchemaQuery = _b.sent();
|
|
1912
2184
|
currentSchema = currentSchemaQuery[0]["current_schema"];
|
|
1913
2185
|
tablesCondition = tableNames.map(function (tableName) {
|
|
1914
|
-
var _a =
|
|
2186
|
+
var _a = __read(tableName.split("."), 2), schema = _a[0], name = _a[1];
|
|
1915
2187
|
if (!name) {
|
|
1916
2188
|
name = schema;
|
|
1917
2189
|
schema = _this.driver.options.schema || currentSchema;
|
|
@@ -1919,9 +2191,9 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
1919
2191
|
return "(\"table_schema\" = '" + schema + "' AND \"table_name\" = '" + name + "')";
|
|
1920
2192
|
}).join(" OR ");
|
|
1921
2193
|
tablesSql = "SELECT * FROM \"information_schema\".\"tables\" WHERE " + tablesCondition;
|
|
1922
|
-
columnsSql = "SELECT
|
|
2194
|
+
columnsSql = "\n SELECT\n *,\n pg_catalog.col_description(('\"' || table_catalog || '\".\"' || table_schema || '\".\"' || table_name || '\"')::regclass::oid, ordinal_position) as description,\n ('\"' || \"udt_schema\" || '\".\"' || \"udt_name\" || '\"')::\"regtype\" AS \"regtype\"\n FROM \"information_schema\".\"columns\"\n WHERE\n " + tablesCondition;
|
|
1923
2195
|
constraintsCondition = tableNames.map(function (tableName) {
|
|
1924
|
-
var _a =
|
|
2196
|
+
var _a = __read(tableName.split("."), 2), schema = _a[0], name = _a[1];
|
|
1925
2197
|
if (!name) {
|
|
1926
2198
|
name = schema;
|
|
1927
2199
|
schema = _this.driver.options.schema || currentSchema;
|
|
@@ -1935,7 +2207,7 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
1935
2207
|
"INNER JOIN \"pg_class\" \"t\" ON \"t\".\"oid\" = \"cnst\".\"conrelid\" " +
|
|
1936
2208
|
"INNER JOIN \"pg_namespace\" \"ns\" ON \"ns\".\"oid\" = \"cnst\".\"connamespace\" " +
|
|
1937
2209
|
"LEFT JOIN \"pg_attribute\" \"a\" ON \"a\".\"attrelid\" = \"cnst\".\"conrelid\" AND \"a\".\"attnum\" = ANY (\"cnst\".\"conkey\") " +
|
|
1938
|
-
("WHERE \"t\".\"relkind\"
|
|
2210
|
+
("WHERE \"t\".\"relkind\" IN ('r', 'p') AND (" + constraintsCondition + ")");
|
|
1939
2211
|
indicesSql = "SELECT \"ns\".\"nspname\" AS \"table_schema\", \"t\".\"relname\" AS \"table_name\", \"i\".\"relname\" AS \"constraint_name\", \"a\".\"attname\" AS \"column_name\", " +
|
|
1940
2212
|
"CASE \"ix\".\"indisunique\" WHEN 't' THEN 'TRUE' ELSE'FALSE' END AS \"is_unique\", pg_get_expr(\"ix\".\"indpred\", \"ix\".\"indrelid\") AS \"condition\", " +
|
|
1941
2213
|
"\"types\".\"typname\" AS \"type_name\" " +
|
|
@@ -1946,15 +2218,19 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
1946
2218
|
"INNER JOIN \"pg_class\" \"i\" ON \"i\".\"oid\" = \"ix\".\"indexrelid\" " +
|
|
1947
2219
|
"INNER JOIN \"pg_type\" \"types\" ON \"types\".\"oid\" = \"a\".\"atttypid\" " +
|
|
1948
2220
|
"LEFT JOIN \"pg_constraint\" \"cnst\" ON \"cnst\".\"conname\" = \"i\".\"relname\" " +
|
|
1949
|
-
("WHERE \"t\".\"relkind\"
|
|
2221
|
+
("WHERE \"t\".\"relkind\" IN ('r', 'p') AND \"cnst\".\"contype\" IS NULL AND (" + constraintsCondition + ")");
|
|
1950
2222
|
foreignKeysCondition = tableNames.map(function (tableName) {
|
|
1951
|
-
var _a =
|
|
2223
|
+
var _a = __read(tableName.split("."), 2), schema = _a[0], name = _a[1];
|
|
1952
2224
|
if (!name) {
|
|
1953
2225
|
name = schema;
|
|
1954
2226
|
schema = _this.driver.options.schema || currentSchema;
|
|
1955
2227
|
}
|
|
1956
2228
|
return "(\"ns\".\"nspname\" = '" + schema + "' AND \"cl\".\"relname\" = '" + name + "')";
|
|
1957
2229
|
}).join(" OR ");
|
|
2230
|
+
return [4 /*yield*/, this.hasSupportForPartitionedTables()];
|
|
2231
|
+
case 2:
|
|
2232
|
+
hasRelispartitionColumn = _b.sent();
|
|
2233
|
+
isPartitionCondition = hasRelispartitionColumn ? " AND \"cl\".\"relispartition\" = 'f'" : "";
|
|
1958
2234
|
foreignKeysSql = "SELECT \"con\".\"conname\" AS \"constraint_name\", \"con\".\"nspname\" AS \"table_schema\", \"con\".\"relname\" AS \"table_name\", \"att2\".\"attname\" AS \"column_name\", " +
|
|
1959
2235
|
"\"ns\".\"nspname\" AS \"referenced_table_schema\", \"cl\".\"relname\" AS \"referenced_table_name\", \"att\".\"attname\" AS \"referenced_column_name\", \"con\".\"confdeltype\" AS \"on_delete\", " +
|
|
1960
2236
|
"\"con\".\"confupdtype\" AS \"on_update\", \"con\".\"condeferrable\" AS \"deferrable\", \"con\".\"condeferred\" AS \"deferred\" " +
|
|
@@ -1970,7 +2246,7 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
1970
2246
|
("WHERE \"con1\".\"contype\" = 'f' AND (" + foreignKeysCondition + ") ") +
|
|
1971
2247
|
") \"con\" " +
|
|
1972
2248
|
"INNER JOIN \"pg_attribute\" \"att\" ON \"att\".\"attrelid\" = \"con\".\"confrelid\" AND \"att\".\"attnum\" = \"con\".\"child\" " +
|
|
1973
|
-
"INNER JOIN \"pg_class\" \"cl\" ON \"cl\".\"oid\" = \"con\".\"confrelid\" " +
|
|
2249
|
+
("INNER JOIN \"pg_class\" \"cl\" ON \"cl\".\"oid\" = \"con\".\"confrelid\" " + isPartitionCondition) +
|
|
1974
2250
|
"INNER JOIN \"pg_namespace\" \"ns\" ON \"cl\".\"relnamespace\" = \"ns\".\"oid\" " +
|
|
1975
2251
|
"INNER JOIN \"pg_attribute\" \"att2\" ON \"att2\".\"attrelid\" = \"con\".\"conrelid\" AND \"att2\".\"attnum\" = \"con\".\"parent\"";
|
|
1976
2252
|
return [4 /*yield*/, Promise.all([
|
|
@@ -1980,16 +2256,16 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
1980
2256
|
this.query(indicesSql),
|
|
1981
2257
|
this.query(foreignKeysSql),
|
|
1982
2258
|
])];
|
|
1983
|
-
case
|
|
1984
|
-
_a =
|
|
2259
|
+
case 3:
|
|
2260
|
+
_a = __read.apply(void 0, [_b.sent(), 5]), dbTables = _a[0], dbColumns = _a[1], dbConstraints = _a[2], dbIndices = _a[3], dbForeignKeys = _a[4];
|
|
1985
2261
|
// if tables were not found in the db, no need to proceed
|
|
1986
2262
|
if (!dbTables.length)
|
|
1987
2263
|
return [2 /*return*/, []];
|
|
1988
2264
|
// create tables for loaded tables
|
|
1989
|
-
return [2 /*return*/, Promise.all(dbTables.map(function (dbTable) { return
|
|
2265
|
+
return [2 /*return*/, Promise.all(dbTables.map(function (dbTable) { return __awaiter(_this, void 0, void 0, function () {
|
|
1990
2266
|
var table, getSchemaFromKey, schema, tableFullName, _a, tableUniqueConstraints, tableCheckConstraints, tableExclusionConstraints, tableForeignKeyConstraints, tableIndexConstraints;
|
|
1991
2267
|
var _this = this;
|
|
1992
|
-
return
|
|
2268
|
+
return __generator(this, function (_b) {
|
|
1993
2269
|
switch (_b.label) {
|
|
1994
2270
|
case 0:
|
|
1995
2271
|
table = new Table();
|
|
@@ -2001,10 +2277,10 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
2001
2277
|
_a = table;
|
|
2002
2278
|
return [4 /*yield*/, Promise.all(dbColumns
|
|
2003
2279
|
.filter(function (dbColumn) { return _this.driver.buildTableName(dbColumn["table_name"], dbColumn["table_schema"]) === tableFullName; })
|
|
2004
|
-
.map(function (dbColumn) { return
|
|
2280
|
+
.map(function (dbColumn) { return __awaiter(_this, void 0, void 0, function () {
|
|
2005
2281
|
var columnConstraints, tableColumn, type, sql, results, geometryColumnSql, results, geographyColumnSql, results, length_1, uniqueConstraint, isConstraintComposite;
|
|
2006
2282
|
var _this = this;
|
|
2007
|
-
return
|
|
2283
|
+
return __generator(this, function (_a) {
|
|
2008
2284
|
switch (_a.label) {
|
|
2009
2285
|
case 0:
|
|
2010
2286
|
columnConstraints = dbConstraints.filter(function (dbConstraint) {
|
|
@@ -2096,9 +2372,10 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
2096
2372
|
}
|
|
2097
2373
|
else {
|
|
2098
2374
|
tableColumn.default = dbColumn["column_default"].replace(/::.*/, "");
|
|
2375
|
+
tableColumn.default = tableColumn.default.replace(/^(-?\d+)$/, "'$1'");
|
|
2099
2376
|
}
|
|
2100
2377
|
}
|
|
2101
|
-
tableColumn.comment = ""
|
|
2378
|
+
tableColumn.comment = dbColumn["description"] == null ? undefined : dbColumn["description"];
|
|
2102
2379
|
if (dbColumn["character_set_name"])
|
|
2103
2380
|
tableColumn.charset = dbColumn["character_set_name"];
|
|
2104
2381
|
if (dbColumn["collation_name"])
|
|
@@ -2251,6 +2528,9 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
2251
2528
|
sql += ", CONSTRAINT \"" + primaryKeyName + "\" PRIMARY KEY (" + columnNames + ")";
|
|
2252
2529
|
}
|
|
2253
2530
|
sql += ")";
|
|
2531
|
+
table.columns
|
|
2532
|
+
.filter(function (it) { return it.comment; })
|
|
2533
|
+
.forEach(function (it) { return sql += "; COMMENT ON COLUMN " + _this.escapePath(table) + ".\"" + it.name + "\" IS " + _this.escapeComment(it.comment); });
|
|
2254
2534
|
return new Query(sql);
|
|
2255
2535
|
};
|
|
2256
2536
|
/**
|
|
@@ -2270,9 +2550,9 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
2270
2550
|
}
|
|
2271
2551
|
};
|
|
2272
2552
|
PostgresQueryRunner.prototype.insertViewDefinitionSql = function (view) {
|
|
2273
|
-
return
|
|
2553
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
2274
2554
|
var currentSchemaQuery, currentSchema, splittedName, schema, name, expression, _a, query, parameters;
|
|
2275
|
-
return
|
|
2555
|
+
return __generator(this, function (_b) {
|
|
2276
2556
|
switch (_b.label) {
|
|
2277
2557
|
case 0: return [4 /*yield*/, this.query("SELECT * FROM current_schema()")];
|
|
2278
2558
|
case 1:
|
|
@@ -2286,7 +2566,7 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
2286
2566
|
name = splittedName[1];
|
|
2287
2567
|
}
|
|
2288
2568
|
expression = typeof view.expression === "string" ? view.expression.trim() : view.expression(this.connection).getQuery();
|
|
2289
|
-
_a =
|
|
2569
|
+
_a = __read(this.connection.createQueryBuilder()
|
|
2290
2570
|
.insert()
|
|
2291
2571
|
.into(this.getTypeormMetadataTableName())
|
|
2292
2572
|
.values({ type: "VIEW", schema: schema, name: name, value: expression })
|
|
@@ -2306,9 +2586,9 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
2306
2586
|
* Builds remove view sql.
|
|
2307
2587
|
*/
|
|
2308
2588
|
PostgresQueryRunner.prototype.deleteViewDefinitionSql = function (viewOrPath) {
|
|
2309
|
-
return
|
|
2589
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
2310
2590
|
var currentSchemaQuery, currentSchema, viewName, splittedName, schema, name, qb, _a, query, parameters;
|
|
2311
|
-
return
|
|
2591
|
+
return __generator(this, function (_b) {
|
|
2312
2592
|
switch (_b.label) {
|
|
2313
2593
|
case 0: return [4 /*yield*/, this.query("SELECT * FROM current_schema()")];
|
|
2314
2594
|
case 1:
|
|
@@ -2323,7 +2603,7 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
2323
2603
|
name = splittedName[1];
|
|
2324
2604
|
}
|
|
2325
2605
|
qb = this.connection.createQueryBuilder();
|
|
2326
|
-
_a =
|
|
2606
|
+
_a = __read(qb.delete()
|
|
2327
2607
|
.from(this.getTypeormMetadataTableName())
|
|
2328
2608
|
.where(qb.escape("type") + " = 'VIEW'")
|
|
2329
2609
|
.andWhere(qb.escape("schema") + " = :schema", { schema: schema })
|
|
@@ -2345,10 +2625,10 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
2345
2625
|
* Drops ENUM type from given schemas.
|
|
2346
2626
|
*/
|
|
2347
2627
|
PostgresQueryRunner.prototype.dropEnumTypes = function (schemaNames) {
|
|
2348
|
-
return
|
|
2628
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
2349
2629
|
var selectDropsQuery, dropQueries;
|
|
2350
2630
|
var _this = this;
|
|
2351
|
-
return
|
|
2631
|
+
return __generator(this, function (_a) {
|
|
2352
2632
|
switch (_a.label) {
|
|
2353
2633
|
case 0:
|
|
2354
2634
|
selectDropsQuery = "SELECT 'DROP TYPE IF EXISTS \"' || n.nspname || '\".\"' || t.typname || '\" CASCADE;' as \"query\" FROM \"pg_type\" \"t\" " +
|
|
@@ -2370,9 +2650,9 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
2370
2650
|
* Checks if enum with the given name exist in the database.
|
|
2371
2651
|
*/
|
|
2372
2652
|
PostgresQueryRunner.prototype.hasEnumType = function (table, column) {
|
|
2373
|
-
return
|
|
2653
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
2374
2654
|
var schema, enumName, sql, result;
|
|
2375
|
-
return
|
|
2655
|
+
return __generator(this, function (_a) {
|
|
2376
2656
|
switch (_a.label) {
|
|
2377
2657
|
case 0:
|
|
2378
2658
|
schema = this.parseTableName(table).schema;
|
|
@@ -2545,15 +2825,15 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
2545
2825
|
}).join(".");
|
|
2546
2826
|
};
|
|
2547
2827
|
PostgresQueryRunner.prototype.getEnumTypeName = function (table, column) {
|
|
2548
|
-
return
|
|
2828
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
2549
2829
|
var currentSchemaQuery, currentSchema, _a, schema, name, result;
|
|
2550
|
-
return
|
|
2830
|
+
return __generator(this, function (_b) {
|
|
2551
2831
|
switch (_b.label) {
|
|
2552
2832
|
case 0: return [4 /*yield*/, this.query("SELECT * FROM current_schema()")];
|
|
2553
2833
|
case 1:
|
|
2554
2834
|
currentSchemaQuery = _b.sent();
|
|
2555
2835
|
currentSchema = currentSchemaQuery[0]["current_schema"];
|
|
2556
|
-
_a =
|
|
2836
|
+
_a = __read(table.name.split("."), 2), schema = _a[0], name = _a[1];
|
|
2557
2837
|
if (!name) {
|
|
2558
2838
|
name = schema;
|
|
2559
2839
|
schema = this.driver.options.schema || currentSchema;
|
|
@@ -2570,6 +2850,18 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
2570
2850
|
});
|
|
2571
2851
|
});
|
|
2572
2852
|
};
|
|
2853
|
+
/**
|
|
2854
|
+
* Escapes a given comment so it's safe to include in a query.
|
|
2855
|
+
*/
|
|
2856
|
+
PostgresQueryRunner.prototype.escapeComment = function (comment) {
|
|
2857
|
+
if (comment === undefined || comment.length === 0) {
|
|
2858
|
+
return 'NULL';
|
|
2859
|
+
}
|
|
2860
|
+
comment = comment
|
|
2861
|
+
.replace("'", "''")
|
|
2862
|
+
.replace("\0", ""); // Null bytes aren't allowed in comments
|
|
2863
|
+
return "'" + comment + "'";
|
|
2864
|
+
};
|
|
2573
2865
|
/**
|
|
2574
2866
|
* Escapes given table or view path.
|
|
2575
2867
|
*/
|
|
@@ -2631,6 +2923,22 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
2631
2923
|
c += " DEFAULT " + this.driver.uuidGenerator;
|
|
2632
2924
|
return c;
|
|
2633
2925
|
};
|
|
2926
|
+
/**
|
|
2927
|
+
* Checks if the PostgreSQL server has support for partitioned tables
|
|
2928
|
+
*/
|
|
2929
|
+
PostgresQueryRunner.prototype.hasSupportForPartitionedTables = function () {
|
|
2930
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
2931
|
+
var result;
|
|
2932
|
+
return __generator(this, function (_a) {
|
|
2933
|
+
switch (_a.label) {
|
|
2934
|
+
case 0: return [4 /*yield*/, this.query("SELECT TRUE FROM information_schema.columns WHERE table_name = 'pg_class' and column_name = 'relispartition'")];
|
|
2935
|
+
case 1:
|
|
2936
|
+
result = _a.sent();
|
|
2937
|
+
return [2 /*return*/, result.length ? true : false];
|
|
2938
|
+
}
|
|
2939
|
+
});
|
|
2940
|
+
});
|
|
2941
|
+
};
|
|
2634
2942
|
return PostgresQueryRunner;
|
|
2635
2943
|
}(BaseQueryRunner));
|
|
2636
2944
|
export { PostgresQueryRunner };
|