typeorm 0.2.24 → 0.2.28
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 +12 -8
- package/browser/cache/DbQueryResultCache.js +14 -14
- package/browser/cache/DbQueryResultCache.js.map +1 -1
- package/browser/cache/RedisQueryResultCache.js +20 -15
- 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 +66 -42
- 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 +3 -1
- package/browser/connection/ConnectionOptions.js.map +1 -1
- package/browser/connection/ConnectionOptionsReader.js +47 -42
- 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 +2 -1
- package/browser/decorator/columns/ViewColumn.js +2 -2
- package/browser/decorator/columns/ViewColumn.js.map +1 -1
- package/browser/decorator/entity/ChildEntity.d.ts +1 -1
- package/browser/decorator/entity/ChildEntity.js.map +1 -1
- package/browser/decorator/entity/Entity.d.ts +2 -2
- package/browser/decorator/entity/Entity.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/options/ViewColumnOptions.d.ts +9 -0
- package/browser/decorator/options/ViewColumnOptions.js +3 -0
- package/browser/decorator/options/ViewColumnOptions.js.map +1 -0
- 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 +6 -0
- package/browser/driver/DriverFactory.js.map +1 -1
- package/browser/driver/DriverUtils.d.ts +2 -2
- package/browser/driver/DriverUtils.js +8 -4
- 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 +6 -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 +230 -143
- package/browser/driver/aurora-data-api/AuroraDataApiQueryRunner.js.map +1 -1
- package/browser/driver/aurora-data-api-pg/AuroraDataApiPostgresConnectionOptions.d.ts +27 -0
- package/browser/driver/aurora-data-api-pg/AuroraDataApiPostgresConnectionOptions.js +3 -0
- package/browser/driver/aurora-data-api-pg/AuroraDataApiPostgresConnectionOptions.js.map +1 -0
- 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 +51 -0
- package/browser/driver/aurora-data-api-pg/AuroraDataApiPostgresQueryRunner.js +142 -0
- package/browser/driver/aurora-data-api-pg/AuroraDataApiPostgresQueryRunner.js.map +1 -0
- 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 +18 -13
- package/browser/driver/cockroachdb/CockroachDriver.js.map +1 -1
- package/browser/driver/cockroachdb/CockroachQueryRunner.d.ts +3 -1
- package/browser/driver/cockroachdb/CockroachQueryRunner.js +420 -192
- 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 +5 -5
- package/browser/driver/expo/ExpoDriver.js.map +1 -1
- package/browser/driver/expo/ExpoQueryRunner.js +10 -10
- package/browser/driver/expo/ExpoQueryRunner.js.map +1 -1
- package/browser/driver/mongodb/MongoDriver.d.ts +6 -1
- package/browser/driver/mongodb/MongoDriver.js +9 -4
- package/browser/driver/mongodb/MongoDriver.js.map +1 -1
- package/browser/driver/mongodb/MongoQueryRunner.d.ts +1 -0
- package/browser/driver/mongodb/MongoQueryRunner.js +175 -175
- package/browser/driver/mongodb/MongoQueryRunner.js.map +1 -1
- package/browser/driver/mongodb/typings.d.ts +4 -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 +16 -9
- package/browser/driver/mysql/MysqlDriver.js.map +1 -1
- package/browser/driver/mysql/MysqlQueryRunner.d.ts +7 -1
- package/browser/driver/mysql/MysqlQueryRunner.js +246 -149
- 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 +195 -128
- package/browser/driver/oracle/OracleQueryRunner.js.map +1 -1
- package/browser/driver/postgres/PostgresConnectionCredentialsOptions.d.ts +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 +19 -4
- package/browser/driver/postgres/PostgresDriver.js +194 -124
- package/browser/driver/postgres/PostgresDriver.js.map +1 -1
- package/browser/driver/postgres/PostgresQueryRunner.d.ts +3 -1
- package/browser/driver/postgres/PostgresQueryRunner.js +416 -196
- 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 +6 -6
- 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/SapConnectionCredentialsOptions.d.ts +1 -1
- package/browser/driver/sap/SapConnectionCredentialsOptions.js.map +1 -1
- package/browser/driver/sap/SapDriver.d.ts +6 -1
- package/browser/driver/sap/SapDriver.js +25 -15
- package/browser/driver/sap/SapDriver.js.map +1 -1
- package/browser/driver/sap/SapQueryRunner.d.ts +3 -1
- package/browser/driver/sap/SapQueryRunner.js +224 -156
- 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 +30 -18
- package/browser/driver/sqlite/SqliteDriver.js.map +1 -1
- package/browser/driver/sqlite/SqliteQueryRunner.js +33 -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 +134 -120
- 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 +15 -16
- package/browser/driver/sqljs/SqljsDriver.js.map +1 -1
- package/browser/driver/sqljs/SqljsQueryRunner.js +11 -7
- 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 +237 -170
- 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 +42 -257
- package/browser/entity-manager/EntityManager.js +39 -39
- package/browser/entity-manager/EntityManager.js.map +1 -1
- package/browser/entity-manager/MongoEntityManager.d.ts +46 -46
- package/browser/entity-manager/MongoEntityManager.js +17 -17
- 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 +2 -2
- package/browser/find-options/FindOneOptions.js.map +1 -1
- package/browser/find-options/FindOperator.d.ts +6 -3
- package/browser/find-options/FindOperator.js +22 -45
- package/browser/find-options/FindOperator.js.map +1 -1
- package/browser/find-options/FindOptionsUtils.d.ts +2 -2
- package/browser/find-options/FindOptionsUtils.js +1 -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/In.d.ts +1 -1
- package/browser/find-options/operator/In.js.map +1 -1
- package/browser/find-options/operator/Raw.d.ts +1 -1
- package/browser/find-options/operator/Raw.js.map +1 -1
- package/browser/index.d.ts +8 -11
- package/browser/index.js +8 -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/LoggerOptions.d.ts +9 -0
- package/browser/logger/LoggerOptions.js.map +1 -1
- package/browser/metadata/ColumnMetadata.js +15 -16
- 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 -5
- package/browser/metadata/EntityMetadata.js +15 -16
- package/browser/metadata/EntityMetadata.js.map +1 -1
- package/browser/metadata/RelationMetadata.js +12 -12
- package/browser/metadata/RelationMetadata.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 +14 -12
- package/browser/metadata-builder/EntityMetadataBuilder.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.d.ts +5 -0
- package/browser/naming-strategy/DefaultNamingStrategy.js +8 -6
- package/browser/naming-strategy/DefaultNamingStrategy.js.map +1 -1
- package/browser/naming-strategy/NamingStrategyInterface.d.ts +11 -0
- package/browser/naming-strategy/NamingStrategyInterface.js.map +1 -1
- package/browser/persistence/EntityPersistExecutor.js +64 -46
- package/browser/persistence/EntityPersistExecutor.js.map +1 -1
- package/browser/persistence/Subject.js +2 -2
- package/browser/persistence/Subject.js.map +1 -1
- package/browser/persistence/SubjectChangedColumnsComputer.js +11 -7
- package/browser/persistence/SubjectChangedColumnsComputer.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/subject-builder/ManyToManySubjectBuilder.js +2 -3
- package/browser/persistence/subject-builder/ManyToManySubjectBuilder.js.map +1 -1
- package/browser/persistence/subject-builder/OneToManySubjectBuilder.js +1 -1
- package/browser/persistence/subject-builder/OneToManySubjectBuilder.js.map +1 -1
- package/browser/persistence/subject-builder/OneToOneInverseSideSubjectBuilder.js +1 -1
- package/browser/persistence/subject-builder/OneToOneInverseSideSubjectBuilder.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 +10 -5
- package/browser/query-builder/DeleteQueryBuilder.js.map +1 -1
- package/browser/query-builder/InsertQueryBuilder.d.ts +2 -3
- package/browser/query-builder/InsertQueryBuilder.js +23 -9
- 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 +11 -15
- package/browser/query-builder/QueryBuilder.js +92 -31
- 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 +1 -1
- 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 +5 -4
- package/browser/query-builder/SelectQueryBuilder.js +77 -41
- package/browser/query-builder/SelectQueryBuilder.js.map +1 -1
- package/browser/query-builder/SoftDeleteQueryBuilder.d.ts +2 -3
- package/browser/query-builder/SoftDeleteQueryBuilder.js +7 -7
- package/browser/query-builder/SoftDeleteQueryBuilder.js.map +1 -1
- package/browser/query-builder/UpdateQueryBuilder.js +22 -8
- 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 +4 -7
- 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 +1 -0
- package/browser/repository/AbstractRepository.js.map +1 -1
- package/browser/repository/BaseEntity.d.ts +17 -1
- package/browser/repository/BaseEntity.js +24 -6
- 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.d.ts +1 -1
- package/browser/repository/Repository.js +4 -4
- package/browser/repository/Repository.js.map +1 -1
- package/browser/repository/TreeRepository.js +4 -4
- 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/util/ApplyValueTransformers.js.map +1 -1
- package/browser/util/DateUtils.js +3 -3
- 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.d.ts +4 -0
- package/browser/util/OrmUtils.js +19 -4
- package/browser/util/OrmUtils.js.map +1 -1
- package/browser/util/StringUtils.js +1 -1
- package/browser/util/StringUtils.js.map +1 -1
- package/cache/DbQueryResultCache.js +1 -1
- package/cache/DbQueryResultCache.js.map +1 -1
- package/cache/RedisQueryResultCache.js +7 -2
- package/cache/RedisQueryResultCache.js.map +1 -1
- package/cli.js +2 -1
- package/cli.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 +4 -4
- package/commands/CommandUtils.js.map +1 -1
- package/commands/EntityCreateCommand.js +4 -4
- package/commands/EntityCreateCommand.js.map +1 -1
- package/commands/InitCommand.js +15 -5
- package/commands/InitCommand.js.map +1 -1
- package/commands/MigrationCreateCommand.js +6 -6
- package/commands/MigrationCreateCommand.js.map +1 -1
- package/commands/MigrationGenerateCommand.d.ts +11 -1
- package/commands/MigrationGenerateCommand.js +42 -10
- package/commands/MigrationGenerateCommand.js.map +1 -1
- package/commands/MigrationRevertCommand.js +2 -2
- package/commands/MigrationRevertCommand.js.map +1 -1
- package/commands/MigrationRunCommand.js +3 -3
- package/commands/MigrationRunCommand.js.map +1 -1
- package/commands/MigrationShowCommand.js +3 -3
- package/commands/MigrationShowCommand.js.map +1 -1
- package/commands/QueryCommand.js +5 -5
- 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 +3 -3
- 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 +48 -24
- package/connection/Connection.js.map +1 -1
- package/connection/ConnectionOptions.d.ts +3 -1
- package/connection/ConnectionOptions.js.map +1 -1
- package/connection/ConnectionOptionsReader.js +38 -33
- 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 +2 -1
- package/decorator/columns/ViewColumn.js +2 -2
- package/decorator/columns/ViewColumn.js.map +1 -1
- package/decorator/entity/ChildEntity.d.ts +1 -1
- package/decorator/entity/ChildEntity.js.map +1 -1
- package/decorator/entity/Entity.d.ts +2 -2
- package/decorator/entity/Entity.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/options/ViewColumnOptions.d.ts +9 -0
- package/decorator/options/ViewColumnOptions.js +4 -0
- package/decorator/options/ViewColumnOptions.js.map +1 -0
- 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 +6 -0
- package/driver/DriverFactory.js.map +1 -1
- package/driver/DriverUtils.d.ts +2 -2
- package/driver/DriverUtils.js +6 -2
- 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 +6 -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 +106 -19
- package/driver/aurora-data-api/AuroraDataApiQueryRunner.js.map +1 -1
- package/driver/aurora-data-api-pg/AuroraDataApiPostgresConnectionOptions.d.ts +27 -0
- package/driver/aurora-data-api-pg/AuroraDataApiPostgresConnectionOptions.js +4 -0
- package/driver/aurora-data-api-pg/AuroraDataApiPostgresConnectionOptions.js.map +1 -0
- 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 +51 -0
- package/driver/aurora-data-api-pg/AuroraDataApiPostgresQueryRunner.js +144 -0
- package/driver/aurora-data-api-pg/AuroraDataApiPostgresQueryRunner.js.map +1 -0
- 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 +6 -1
- package/driver/cockroachdb/CockroachDriver.js.map +1 -1
- package/driver/cockroachdb/CockroachQueryRunner.d.ts +2 -1
- package/driver/cockroachdb/CockroachQueryRunner.js +303 -75
- 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 +1 -1
- package/driver/expo/ExpoDriver.js.map +1 -1
- package/driver/mongodb/MongoDriver.d.ts +6 -1
- package/driver/mongodb/MongoDriver.js +6 -1
- package/driver/mongodb/MongoDriver.js.map +1 -1
- package/driver/mongodb/MongoQueryRunner.js.map +1 -1
- package/driver/mongodb/typings.d.ts +4 -1
- package/driver/mongodb/typings.js.map +1 -1
- package/driver/mysql/MysqlDriver.d.ts +7 -2
- package/driver/mysql/MysqlDriver.js +10 -3
- package/driver/mysql/MysqlDriver.js.map +1 -1
- package/driver/mysql/MysqlQueryRunner.d.ts +6 -1
- package/driver/mysql/MysqlQueryRunner.js +122 -25
- 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 +87 -20
- package/driver/oracle/OracleQueryRunner.js.map +1 -1
- package/driver/postgres/PostgresConnectionCredentialsOptions.d.ts +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 +19 -4
- package/driver/postgres/PostgresDriver.js +179 -109
- package/driver/postgres/PostgresDriver.js.map +1 -1
- package/driver/postgres/PostgresQueryRunner.d.ts +2 -1
- package/driver/postgres/PostgresQueryRunner.js +288 -68
- package/driver/postgres/PostgresQueryRunner.js.map +1 -1
- package/driver/react-native/ReactNativeDriver.d.ts +2 -1
- package/driver/react-native/ReactNativeDriver.js +2 -2
- package/driver/react-native/ReactNativeDriver.js.map +1 -1
- package/driver/sap/SapConnectionCredentialsOptions.d.ts +1 -1
- package/driver/sap/SapConnectionCredentialsOptions.js.map +1 -1
- package/driver/sap/SapDriver.d.ts +6 -1
- package/driver/sap/SapDriver.js +19 -9
- package/driver/sap/SapDriver.js.map +1 -1
- package/driver/sap/SapQueryRunner.d.ts +2 -1
- package/driver/sap/SapQueryRunner.js +91 -23
- 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 +24 -12
- package/driver/sqlite/SqliteDriver.js.map +1 -1
- package/driver/sqlite/SqliteQueryRunner.js +29 -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 +17 -3
- package/driver/sqlite-abstract/AbstractSqliteQueryRunner.js.map +1 -1
- package/driver/sqljs/SqljsDriver.d.ts +2 -1
- package/driver/sqljs/SqljsDriver.js +1 -2
- package/driver/sqljs/SqljsDriver.js.map +1 -1
- package/driver/sqljs/SqljsQueryRunner.js +5 -1
- 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 +91 -24
- 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 +42 -257
- package/entity-manager/EntityManager.js +10 -10
- package/entity-manager/EntityManager.js.map +1 -1
- package/entity-manager/MongoEntityManager.d.ts +46 -46
- 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 +2 -2
- package/find-options/FindOneOptions.js.map +1 -1
- package/find-options/FindOperator.d.ts +6 -3
- package/find-options/FindOperator.js +22 -45
- package/find-options/FindOperator.js.map +1 -1
- package/find-options/FindOptionsUtils.d.ts +2 -2
- package/find-options/FindOptionsUtils.js +1 -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/In.d.ts +1 -1
- package/find-options/operator/In.js.map +1 -1
- package/find-options/operator/Raw.d.ts +1 -1
- package/find-options/operator/Raw.js.map +1 -1
- package/index.d.ts +8 -11
- package/index.js +1 -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/LoggerOptions.d.ts +9 -0
- package/logger/LoggerOptions.js.map +1 -1
- package/metadata/ColumnMetadata.js +10 -11
- package/metadata/ColumnMetadata.js.map +1 -1
- package/metadata/EntityMetadata.d.ts +1 -5
- package/metadata/EntityMetadata.js +13 -14
- package/metadata/EntityMetadata.js.map +1 -1
- package/metadata/RelationMetadata.js +7 -7
- package/metadata/RelationMetadata.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 +8 -6
- package/metadata-builder/EntityMetadataBuilder.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/naming-strategy/DefaultNamingStrategy.d.ts +5 -0
- package/naming-strategy/DefaultNamingStrategy.js +2 -0
- package/naming-strategy/DefaultNamingStrategy.js.map +1 -1
- package/naming-strategy/NamingStrategyInterface.d.ts +11 -0
- package/naming-strategy/NamingStrategyInterface.js.map +1 -1
- package/package.json +72 -51
- package/persistence/EntityPersistExecutor.js +60 -42
- package/persistence/EntityPersistExecutor.js.map +1 -1
- package/persistence/SubjectChangedColumnsComputer.js +11 -7
- package/persistence/SubjectChangedColumnsComputer.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/subject-builder/ManyToManySubjectBuilder.js +2 -3
- package/persistence/subject-builder/ManyToManySubjectBuilder.js.map +1 -1
- package/persistence/subject-builder/OneToManySubjectBuilder.js +1 -1
- package/persistence/subject-builder/OneToManySubjectBuilder.js.map +1 -1
- package/persistence/subject-builder/OneToOneInverseSideSubjectBuilder.js +1 -1
- package/persistence/subject-builder/OneToOneInverseSideSubjectBuilder.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 +44 -43
- 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 +5 -0
- package/query-builder/DeleteQueryBuilder.js.map +1 -1
- package/query-builder/InsertQueryBuilder.d.ts +2 -3
- package/query-builder/InsertQueryBuilder.js +18 -4
- package/query-builder/InsertQueryBuilder.js.map +1 -1
- package/query-builder/QueryBuilder.d.ts +11 -15
- package/query-builder/QueryBuilder.js +84 -23
- package/query-builder/QueryBuilder.js.map +1 -1
- package/query-builder/QueryExpressionMap.d.ts +1 -1
- 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 +4 -4
- package/query-builder/SelectQueryBuilder.js +41 -5
- package/query-builder/SelectQueryBuilder.js.map +1 -1
- package/query-builder/SoftDeleteQueryBuilder.d.ts +2 -3
- package/query-builder/SoftDeleteQueryBuilder.js +2 -2
- package/query-builder/SoftDeleteQueryBuilder.js.map +1 -1
- package/query-builder/UpdateQueryBuilder.js +17 -3
- package/query-builder/UpdateQueryBuilder.js.map +1 -1
- package/query-builder/transformer/RawSqlResultsToEntityTransformer.js +1 -4
- 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/repository/AbstractRepository.js.map +1 -1
- package/repository/BaseEntity.d.ts +17 -1
- package/repository/BaseEntity.js +20 -2
- package/repository/BaseEntity.js.map +1 -1
- package/repository/MongoRepository.js.map +1 -1
- package/repository/Repository.d.ts +1 -1
- package/repository/Repository.js +2 -2
- package/repository/Repository.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/typeorm-class-transformer-shim.js +16 -2
- package/typeorm-model-shim.js +18 -0
- package/util/ApplyValueTransformers.js.map +1 -1
- package/util/DateUtils.js +1 -1
- 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.d.ts +4 -0
- package/util/OrmUtils.js +17 -2
- package/util/OrmUtils.js.map +1 -1
- package/util/StringUtils.js +3 -2
- package/util/StringUtils.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";
|
|
@@ -20,12 +19,11 @@ import { Query } from "../Query";
|
|
|
20
19
|
* Runs queries on a single postgres database connection.
|
|
21
20
|
*/
|
|
22
21
|
var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
23
|
-
|
|
22
|
+
__extends(PostgresQueryRunner, _super);
|
|
24
23
|
// -------------------------------------------------------------------------
|
|
25
24
|
// Constructor
|
|
26
25
|
// -------------------------------------------------------------------------
|
|
27
26
|
function PostgresQueryRunner(driver, mode) {
|
|
28
|
-
if (mode === void 0) { mode = "master"; }
|
|
29
27
|
var _this = _super.call(this) || this;
|
|
30
28
|
_this.driver = driver;
|
|
31
29
|
_this.connection = driver.connection;
|
|
@@ -48,19 +46,29 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
48
46
|
return this.databaseConnectionPromise;
|
|
49
47
|
if (this.mode === "slave" && this.driver.isReplicated) {
|
|
50
48
|
this.databaseConnectionPromise = this.driver.obtainSlaveConnection().then(function (_a) {
|
|
51
|
-
var _b =
|
|
49
|
+
var _b = __read(_a, 2), connection = _b[0], release = _b[1];
|
|
52
50
|
_this.driver.connectedQueryRunners.push(_this);
|
|
53
51
|
_this.databaseConnection = connection;
|
|
54
|
-
|
|
52
|
+
var onErrorCallback = function () { return _this.release(); };
|
|
53
|
+
_this.releaseCallback = function () {
|
|
54
|
+
_this.databaseConnection.removeListener("error", onErrorCallback);
|
|
55
|
+
release();
|
|
56
|
+
};
|
|
57
|
+
_this.databaseConnection.on("error", onErrorCallback);
|
|
55
58
|
return _this.databaseConnection;
|
|
56
59
|
});
|
|
57
60
|
}
|
|
58
61
|
else { // master
|
|
59
62
|
this.databaseConnectionPromise = this.driver.obtainMasterConnection().then(function (_a) {
|
|
60
|
-
var _b =
|
|
63
|
+
var _b = __read(_a, 2), connection = _b[0], release = _b[1];
|
|
61
64
|
_this.driver.connectedQueryRunners.push(_this);
|
|
62
65
|
_this.databaseConnection = connection;
|
|
63
|
-
|
|
66
|
+
var onErrorCallback = function () { return _this.release(); };
|
|
67
|
+
_this.releaseCallback = function () {
|
|
68
|
+
_this.databaseConnection.removeListener("error", onErrorCallback);
|
|
69
|
+
release();
|
|
70
|
+
};
|
|
71
|
+
_this.databaseConnection.on("error", onErrorCallback);
|
|
64
72
|
return _this.databaseConnection;
|
|
65
73
|
});
|
|
66
74
|
}
|
|
@@ -71,6 +79,9 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
71
79
|
* You cannot use query runner methods once its released.
|
|
72
80
|
*/
|
|
73
81
|
PostgresQueryRunner.prototype.release = function () {
|
|
82
|
+
if (this.isReleased) {
|
|
83
|
+
return Promise.resolve();
|
|
84
|
+
}
|
|
74
85
|
this.isReleased = true;
|
|
75
86
|
if (this.releaseCallback)
|
|
76
87
|
this.releaseCallback();
|
|
@@ -83,8 +94,8 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
83
94
|
* Starts transaction.
|
|
84
95
|
*/
|
|
85
96
|
PostgresQueryRunner.prototype.startTransaction = function (isolationLevel) {
|
|
86
|
-
return
|
|
87
|
-
return
|
|
97
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
98
|
+
return __generator(this, function (_a) {
|
|
88
99
|
switch (_a.label) {
|
|
89
100
|
case 0:
|
|
90
101
|
if (this.isTransactionActive)
|
|
@@ -108,8 +119,8 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
108
119
|
* Error will be thrown if transaction was not started.
|
|
109
120
|
*/
|
|
110
121
|
PostgresQueryRunner.prototype.commitTransaction = function () {
|
|
111
|
-
return
|
|
112
|
-
return
|
|
122
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
123
|
+
return __generator(this, function (_a) {
|
|
113
124
|
switch (_a.label) {
|
|
114
125
|
case 0:
|
|
115
126
|
if (!this.isTransactionActive)
|
|
@@ -128,8 +139,8 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
128
139
|
* Error will be thrown if transaction was not started.
|
|
129
140
|
*/
|
|
130
141
|
PostgresQueryRunner.prototype.rollbackTransaction = function () {
|
|
131
|
-
return
|
|
132
|
-
return
|
|
142
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
143
|
+
return __generator(this, function (_a) {
|
|
133
144
|
switch (_a.label) {
|
|
134
145
|
case 0:
|
|
135
146
|
if (!this.isTransactionActive)
|
|
@@ -150,10 +161,10 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
150
161
|
var _this = this;
|
|
151
162
|
if (this.isReleased)
|
|
152
163
|
throw new QueryRunnerAlreadyReleasedError();
|
|
153
|
-
return new Promise(function (ok, fail) { return
|
|
164
|
+
return new Promise(function (ok, fail) { return __awaiter(_this, void 0, void 0, function () {
|
|
154
165
|
var databaseConnection, queryStartTime_1, err_1;
|
|
155
166
|
var _this = this;
|
|
156
|
-
return
|
|
167
|
+
return __generator(this, function (_a) {
|
|
157
168
|
switch (_a.label) {
|
|
158
169
|
case 0:
|
|
159
170
|
_a.trys.push([0, 2, , 3]);
|
|
@@ -203,9 +214,9 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
203
214
|
var QueryStream = this.driver.loadStreamDependency();
|
|
204
215
|
if (this.isReleased)
|
|
205
216
|
throw new QueryRunnerAlreadyReleasedError();
|
|
206
|
-
return new Promise(function (ok, fail) { return
|
|
217
|
+
return new Promise(function (ok, fail) { return __awaiter(_this, void 0, void 0, function () {
|
|
207
218
|
var databaseConnection, stream, err_2;
|
|
208
|
-
return
|
|
219
|
+
return __generator(this, function (_a) {
|
|
209
220
|
switch (_a.label) {
|
|
210
221
|
case 0:
|
|
211
222
|
_a.trys.push([0, 2, , 3]);
|
|
@@ -233,8 +244,8 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
233
244
|
* Returns all available database names including system databases.
|
|
234
245
|
*/
|
|
235
246
|
PostgresQueryRunner.prototype.getDatabases = function () {
|
|
236
|
-
return
|
|
237
|
-
return
|
|
247
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
248
|
+
return __generator(this, function (_a) {
|
|
238
249
|
return [2 /*return*/, Promise.resolve([])];
|
|
239
250
|
});
|
|
240
251
|
});
|
|
@@ -244,8 +255,8 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
244
255
|
* If database parameter specified, returns schemas of that database.
|
|
245
256
|
*/
|
|
246
257
|
PostgresQueryRunner.prototype.getSchemas = function (database) {
|
|
247
|
-
return
|
|
248
|
-
return
|
|
258
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
259
|
+
return __generator(this, function (_a) {
|
|
249
260
|
return [2 /*return*/, Promise.resolve([])];
|
|
250
261
|
});
|
|
251
262
|
});
|
|
@@ -254,8 +265,8 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
254
265
|
* Checks if database with the given name exist.
|
|
255
266
|
*/
|
|
256
267
|
PostgresQueryRunner.prototype.hasDatabase = function (database) {
|
|
257
|
-
return
|
|
258
|
-
return
|
|
268
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
269
|
+
return __generator(this, function (_a) {
|
|
259
270
|
return [2 /*return*/, Promise.resolve(false)];
|
|
260
271
|
});
|
|
261
272
|
});
|
|
@@ -264,9 +275,9 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
264
275
|
* Checks if schema with the given name exist.
|
|
265
276
|
*/
|
|
266
277
|
PostgresQueryRunner.prototype.hasSchema = function (schema) {
|
|
267
|
-
return
|
|
278
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
268
279
|
var result;
|
|
269
|
-
return
|
|
280
|
+
return __generator(this, function (_a) {
|
|
270
281
|
switch (_a.label) {
|
|
271
282
|
case 0: return [4 /*yield*/, this.query("SELECT * FROM \"information_schema\".\"schemata\" WHERE \"schema_name\" = '" + schema + "'")];
|
|
272
283
|
case 1:
|
|
@@ -280,9 +291,9 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
280
291
|
* Checks if table with the given name exist in the database.
|
|
281
292
|
*/
|
|
282
293
|
PostgresQueryRunner.prototype.hasTable = function (tableOrName) {
|
|
283
|
-
return
|
|
294
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
284
295
|
var parsedTableName, sql, result;
|
|
285
|
-
return
|
|
296
|
+
return __generator(this, function (_a) {
|
|
286
297
|
switch (_a.label) {
|
|
287
298
|
case 0:
|
|
288
299
|
parsedTableName = this.parseTableName(tableOrName);
|
|
@@ -299,9 +310,9 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
299
310
|
* Checks if column with the given name exist in the given table.
|
|
300
311
|
*/
|
|
301
312
|
PostgresQueryRunner.prototype.hasColumn = function (tableOrName, columnName) {
|
|
302
|
-
return
|
|
313
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
303
314
|
var parsedTableName, sql, result;
|
|
304
|
-
return
|
|
315
|
+
return __generator(this, function (_a) {
|
|
305
316
|
switch (_a.label) {
|
|
306
317
|
case 0:
|
|
307
318
|
parsedTableName = this.parseTableName(tableOrName);
|
|
@@ -319,8 +330,8 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
319
330
|
* Postgres does not supports database creation inside a transaction block.
|
|
320
331
|
*/
|
|
321
332
|
PostgresQueryRunner.prototype.createDatabase = function (database, ifNotExist) {
|
|
322
|
-
return
|
|
323
|
-
return
|
|
333
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
334
|
+
return __generator(this, function (_a) {
|
|
324
335
|
switch (_a.label) {
|
|
325
336
|
case 0: return [4 /*yield*/, Promise.resolve()];
|
|
326
337
|
case 1:
|
|
@@ -335,8 +346,8 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
335
346
|
* Postgres does not supports database drop inside a transaction block.
|
|
336
347
|
*/
|
|
337
348
|
PostgresQueryRunner.prototype.dropDatabase = function (database, ifExist) {
|
|
338
|
-
return
|
|
339
|
-
return
|
|
349
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
350
|
+
return __generator(this, function (_a) {
|
|
340
351
|
return [2 /*return*/, Promise.resolve()];
|
|
341
352
|
});
|
|
342
353
|
});
|
|
@@ -345,9 +356,9 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
345
356
|
* Creates a new table schema.
|
|
346
357
|
*/
|
|
347
358
|
PostgresQueryRunner.prototype.createSchema = function (schema, ifNotExist) {
|
|
348
|
-
return
|
|
359
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
349
360
|
var up, down;
|
|
350
|
-
return
|
|
361
|
+
return __generator(this, function (_a) {
|
|
351
362
|
switch (_a.label) {
|
|
352
363
|
case 0:
|
|
353
364
|
up = ifNotExist ? "CREATE SCHEMA IF NOT EXISTS \"" + schema + "\"" : "CREATE SCHEMA \"" + schema + "\"";
|
|
@@ -364,9 +375,9 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
364
375
|
* Drops table schema.
|
|
365
376
|
*/
|
|
366
377
|
PostgresQueryRunner.prototype.dropSchema = function (schemaPath, ifExist, isCascade) {
|
|
367
|
-
return
|
|
378
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
368
379
|
var schema, up, down;
|
|
369
|
-
return
|
|
380
|
+
return __generator(this, function (_a) {
|
|
370
381
|
switch (_a.label) {
|
|
371
382
|
case 0:
|
|
372
383
|
schema = schemaPath.indexOf(".") === -1 ? schemaPath : schemaPath.split(".")[0];
|
|
@@ -387,10 +398,10 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
387
398
|
if (ifNotExist === void 0) { ifNotExist = false; }
|
|
388
399
|
if (createForeignKeys === void 0) { createForeignKeys = true; }
|
|
389
400
|
if (createIndices === void 0) { createIndices = true; }
|
|
390
|
-
return
|
|
401
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
391
402
|
var isTableExist, upQueries, downQueries;
|
|
392
403
|
var _this = this;
|
|
393
|
-
return
|
|
404
|
+
return __generator(this, function (_a) {
|
|
394
405
|
switch (_a.label) {
|
|
395
406
|
case 0:
|
|
396
407
|
if (!ifNotExist) return [3 /*break*/, 2];
|
|
@@ -406,9 +417,9 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
406
417
|
// if table have column with ENUM type, we must create this type in postgres.
|
|
407
418
|
return [4 /*yield*/, Promise.all(table.columns
|
|
408
419
|
.filter(function (column) { return column.type === "enum" || column.type === "simple-enum"; })
|
|
409
|
-
.map(function (column) { return
|
|
420
|
+
.map(function (column) { return __awaiter(_this, void 0, void 0, function () {
|
|
410
421
|
var hasEnum;
|
|
411
|
-
return
|
|
422
|
+
return __generator(this, function (_a) {
|
|
412
423
|
switch (_a.label) {
|
|
413
424
|
case 0: return [4 /*yield*/, this.hasEnumType(table, column)];
|
|
414
425
|
case 1:
|
|
@@ -454,10 +465,10 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
454
465
|
PostgresQueryRunner.prototype.dropTable = function (target, ifExist, dropForeignKeys, dropIndices) {
|
|
455
466
|
if (dropForeignKeys === void 0) { dropForeignKeys = true; }
|
|
456
467
|
if (dropIndices === void 0) { dropIndices = true; }
|
|
457
|
-
return
|
|
468
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
458
469
|
var isTableExist, createForeignKeys, tableName, table, upQueries, downQueries;
|
|
459
470
|
var _this = this;
|
|
460
|
-
return
|
|
471
|
+
return __generator(this, function (_a) {
|
|
461
472
|
switch (_a.label) {
|
|
462
473
|
case 0:
|
|
463
474
|
if (!ifExist) return [3 /*break*/, 2];
|
|
@@ -497,9 +508,9 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
497
508
|
* Creates a new view.
|
|
498
509
|
*/
|
|
499
510
|
PostgresQueryRunner.prototype.createView = function (view) {
|
|
500
|
-
return
|
|
511
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
501
512
|
var upQueries, downQueries, _a, _b, _c, _d;
|
|
502
|
-
return
|
|
513
|
+
return __generator(this, function (_e) {
|
|
503
514
|
switch (_e.label) {
|
|
504
515
|
case 0:
|
|
505
516
|
upQueries = [];
|
|
@@ -526,9 +537,9 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
526
537
|
* Drops the view.
|
|
527
538
|
*/
|
|
528
539
|
PostgresQueryRunner.prototype.dropView = function (target) {
|
|
529
|
-
return
|
|
540
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
530
541
|
var viewName, view, upQueries, downQueries, _a, _b, _c, _d;
|
|
531
|
-
return
|
|
542
|
+
return __generator(this, function (_e) {
|
|
532
543
|
switch (_e.label) {
|
|
533
544
|
case 0:
|
|
534
545
|
viewName = target instanceof View ? target.name : target;
|
|
@@ -559,23 +570,24 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
559
570
|
* Renames the given table.
|
|
560
571
|
*/
|
|
561
572
|
PostgresQueryRunner.prototype.renameTable = function (oldTableOrName, newTableName) {
|
|
562
|
-
return
|
|
563
|
-
var
|
|
573
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
574
|
+
var upQueries, downQueries, oldTable, _a, newTable, oldTableName, schemaName, columnNames, oldPkName, newPkName, enumColumns, enumColumns_1, enumColumns_1_1, column, oldEnumType, e_1_1;
|
|
575
|
+
var e_1, _b;
|
|
564
576
|
var _this = this;
|
|
565
|
-
return
|
|
577
|
+
return __generator(this, function (_c) {
|
|
566
578
|
switch (_c.label) {
|
|
567
579
|
case 0:
|
|
568
580
|
upQueries = [];
|
|
569
581
|
downQueries = [];
|
|
570
582
|
if (!(oldTableOrName instanceof Table)) return [3 /*break*/, 1];
|
|
571
|
-
|
|
583
|
+
_a = oldTableOrName;
|
|
572
584
|
return [3 /*break*/, 3];
|
|
573
585
|
case 1: return [4 /*yield*/, this.getCachedTable(oldTableOrName)];
|
|
574
586
|
case 2:
|
|
575
|
-
|
|
587
|
+
_a = _c.sent();
|
|
576
588
|
_c.label = 3;
|
|
577
589
|
case 3:
|
|
578
|
-
oldTable =
|
|
590
|
+
oldTable = _a;
|
|
579
591
|
newTable = oldTable.clone();
|
|
580
592
|
oldTableName = oldTable.name.indexOf(".") === -1 ? oldTable.name : oldTable.name.split(".")[1];
|
|
581
593
|
schemaName = oldTable.name.indexOf(".") === -1 ? undefined : oldTable.name.split(".")[0];
|
|
@@ -627,7 +639,7 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
627
639
|
_c.label = 4;
|
|
628
640
|
case 4:
|
|
629
641
|
_c.trys.push([4, 9, 10, 11]);
|
|
630
|
-
enumColumns_1 =
|
|
642
|
+
enumColumns_1 = __values(enumColumns), enumColumns_1_1 = enumColumns_1.next();
|
|
631
643
|
_c.label = 5;
|
|
632
644
|
case 5:
|
|
633
645
|
if (!!enumColumns_1_1.done) return [3 /*break*/, 8];
|
|
@@ -648,7 +660,7 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
648
660
|
return [3 /*break*/, 11];
|
|
649
661
|
case 10:
|
|
650
662
|
try {
|
|
651
|
-
if (enumColumns_1_1 && !enumColumns_1_1.done && (
|
|
663
|
+
if (enumColumns_1_1 && !enumColumns_1_1.done && (_b = enumColumns_1.return)) _b.call(enumColumns_1);
|
|
652
664
|
}
|
|
653
665
|
finally { if (e_1) throw e_1.error; }
|
|
654
666
|
return [7 /*endfinally*/];
|
|
@@ -664,9 +676,9 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
664
676
|
* Creates a new column from the column in the table.
|
|
665
677
|
*/
|
|
666
678
|
PostgresQueryRunner.prototype.addColumn = function (tableOrName, column) {
|
|
667
|
-
return
|
|
679
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
668
680
|
var table, _a, clonedTable, upQueries, downQueries, hasEnum, primaryColumns, pkName_1, columnNames_1, pkName, columnNames, columnIndex, uniqueConstraint;
|
|
669
|
-
return
|
|
681
|
+
return __generator(this, function (_b) {
|
|
670
682
|
switch (_b.label) {
|
|
671
683
|
case 0:
|
|
672
684
|
if (!(tableOrName instanceof Table)) return [3 /*break*/, 1];
|
|
@@ -738,14 +750,37 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
738
750
|
* Creates a new columns from the column in the table.
|
|
739
751
|
*/
|
|
740
752
|
PostgresQueryRunner.prototype.addColumns = function (tableOrName, columns) {
|
|
741
|
-
return
|
|
742
|
-
var
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
753
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
754
|
+
var columns_1, columns_1_1, column, e_2_1;
|
|
755
|
+
var e_2, _a;
|
|
756
|
+
return __generator(this, function (_b) {
|
|
757
|
+
switch (_b.label) {
|
|
758
|
+
case 0:
|
|
759
|
+
_b.trys.push([0, 5, 6, 7]);
|
|
760
|
+
columns_1 = __values(columns), columns_1_1 = columns_1.next();
|
|
761
|
+
_b.label = 1;
|
|
746
762
|
case 1:
|
|
747
|
-
|
|
748
|
-
|
|
763
|
+
if (!!columns_1_1.done) return [3 /*break*/, 4];
|
|
764
|
+
column = columns_1_1.value;
|
|
765
|
+
return [4 /*yield*/, this.addColumn(tableOrName, column)];
|
|
766
|
+
case 2:
|
|
767
|
+
_b.sent();
|
|
768
|
+
_b.label = 3;
|
|
769
|
+
case 3:
|
|
770
|
+
columns_1_1 = columns_1.next();
|
|
771
|
+
return [3 /*break*/, 1];
|
|
772
|
+
case 4: return [3 /*break*/, 7];
|
|
773
|
+
case 5:
|
|
774
|
+
e_2_1 = _b.sent();
|
|
775
|
+
e_2 = { error: e_2_1 };
|
|
776
|
+
return [3 /*break*/, 7];
|
|
777
|
+
case 6:
|
|
778
|
+
try {
|
|
779
|
+
if (columns_1_1 && !columns_1_1.done && (_a = columns_1.return)) _a.call(columns_1);
|
|
780
|
+
}
|
|
781
|
+
finally { if (e_2) throw e_2.error; }
|
|
782
|
+
return [7 /*endfinally*/];
|
|
783
|
+
case 7: return [2 /*return*/];
|
|
749
784
|
}
|
|
750
785
|
});
|
|
751
786
|
});
|
|
@@ -754,9 +789,9 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
754
789
|
* Renames column in the given table.
|
|
755
790
|
*/
|
|
756
791
|
PostgresQueryRunner.prototype.renameColumn = function (tableOrName, oldTableColumnOrName, newTableColumnOrName) {
|
|
757
|
-
return
|
|
792
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
758
793
|
var table, _a, oldColumn, newColumn;
|
|
759
|
-
return
|
|
794
|
+
return __generator(this, function (_b) {
|
|
760
795
|
switch (_b.label) {
|
|
761
796
|
case 0:
|
|
762
797
|
if (!(tableOrName instanceof Table)) return [3 /*break*/, 1];
|
|
@@ -787,10 +822,10 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
787
822
|
* Changes a column in the table.
|
|
788
823
|
*/
|
|
789
824
|
PostgresQueryRunner.prototype.changeColumn = function (tableOrName, oldTableColumnOrName, newColumn) {
|
|
790
|
-
return
|
|
825
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
791
826
|
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
827
|
var _this = this;
|
|
793
|
-
return
|
|
828
|
+
return __generator(this, function (_b) {
|
|
794
829
|
switch (_b.label) {
|
|
795
830
|
case 0:
|
|
796
831
|
if (!(tableOrName instanceof Table)) return [3 /*break*/, 1];
|
|
@@ -1053,14 +1088,37 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
1053
1088
|
* Changes a column in the table.
|
|
1054
1089
|
*/
|
|
1055
1090
|
PostgresQueryRunner.prototype.changeColumns = function (tableOrName, changedColumns) {
|
|
1056
|
-
return
|
|
1057
|
-
var
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1091
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1092
|
+
var changedColumns_1, changedColumns_1_1, _a, oldColumn, newColumn, e_3_1;
|
|
1093
|
+
var e_3, _b;
|
|
1094
|
+
return __generator(this, function (_c) {
|
|
1095
|
+
switch (_c.label) {
|
|
1096
|
+
case 0:
|
|
1097
|
+
_c.trys.push([0, 5, 6, 7]);
|
|
1098
|
+
changedColumns_1 = __values(changedColumns), changedColumns_1_1 = changedColumns_1.next();
|
|
1099
|
+
_c.label = 1;
|
|
1061
1100
|
case 1:
|
|
1062
|
-
|
|
1063
|
-
|
|
1101
|
+
if (!!changedColumns_1_1.done) return [3 /*break*/, 4];
|
|
1102
|
+
_a = changedColumns_1_1.value, oldColumn = _a.oldColumn, newColumn = _a.newColumn;
|
|
1103
|
+
return [4 /*yield*/, this.changeColumn(tableOrName, oldColumn, newColumn)];
|
|
1104
|
+
case 2:
|
|
1105
|
+
_c.sent();
|
|
1106
|
+
_c.label = 3;
|
|
1107
|
+
case 3:
|
|
1108
|
+
changedColumns_1_1 = changedColumns_1.next();
|
|
1109
|
+
return [3 /*break*/, 1];
|
|
1110
|
+
case 4: return [3 /*break*/, 7];
|
|
1111
|
+
case 5:
|
|
1112
|
+
e_3_1 = _c.sent();
|
|
1113
|
+
e_3 = { error: e_3_1 };
|
|
1114
|
+
return [3 /*break*/, 7];
|
|
1115
|
+
case 6:
|
|
1116
|
+
try {
|
|
1117
|
+
if (changedColumns_1_1 && !changedColumns_1_1.done && (_b = changedColumns_1.return)) _b.call(changedColumns_1);
|
|
1118
|
+
}
|
|
1119
|
+
finally { if (e_3) throw e_3.error; }
|
|
1120
|
+
return [7 /*endfinally*/];
|
|
1121
|
+
case 7: return [2 /*return*/];
|
|
1064
1122
|
}
|
|
1065
1123
|
});
|
|
1066
1124
|
});
|
|
@@ -1069,9 +1127,9 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
1069
1127
|
* Drops column in the table.
|
|
1070
1128
|
*/
|
|
1071
1129
|
PostgresQueryRunner.prototype.dropColumn = function (tableOrName, columnOrName) {
|
|
1072
|
-
return
|
|
1130
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1073
1131
|
var table, _a, column, clonedTable, upQueries, downQueries, pkName, columnNames, tableColumn, pkName_2, columnNames_2, columnIndex, columnCheck, columnUnique, hasEnum, enumType, escapedEnumName;
|
|
1074
|
-
return
|
|
1132
|
+
return __generator(this, function (_b) {
|
|
1075
1133
|
switch (_b.label) {
|
|
1076
1134
|
case 0:
|
|
1077
1135
|
if (!(tableOrName instanceof Table)) return [3 /*break*/, 1];
|
|
@@ -1151,14 +1209,37 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
1151
1209
|
* Drops the columns in the table.
|
|
1152
1210
|
*/
|
|
1153
1211
|
PostgresQueryRunner.prototype.dropColumns = function (tableOrName, columns) {
|
|
1154
|
-
return
|
|
1155
|
-
var
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1212
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1213
|
+
var columns_2, columns_2_1, column, e_4_1;
|
|
1214
|
+
var e_4, _a;
|
|
1215
|
+
return __generator(this, function (_b) {
|
|
1216
|
+
switch (_b.label) {
|
|
1217
|
+
case 0:
|
|
1218
|
+
_b.trys.push([0, 5, 6, 7]);
|
|
1219
|
+
columns_2 = __values(columns), columns_2_1 = columns_2.next();
|
|
1220
|
+
_b.label = 1;
|
|
1159
1221
|
case 1:
|
|
1160
|
-
|
|
1161
|
-
|
|
1222
|
+
if (!!columns_2_1.done) return [3 /*break*/, 4];
|
|
1223
|
+
column = columns_2_1.value;
|
|
1224
|
+
return [4 /*yield*/, this.dropColumn(tableOrName, column)];
|
|
1225
|
+
case 2:
|
|
1226
|
+
_b.sent();
|
|
1227
|
+
_b.label = 3;
|
|
1228
|
+
case 3:
|
|
1229
|
+
columns_2_1 = columns_2.next();
|
|
1230
|
+
return [3 /*break*/, 1];
|
|
1231
|
+
case 4: return [3 /*break*/, 7];
|
|
1232
|
+
case 5:
|
|
1233
|
+
e_4_1 = _b.sent();
|
|
1234
|
+
e_4 = { error: e_4_1 };
|
|
1235
|
+
return [3 /*break*/, 7];
|
|
1236
|
+
case 6:
|
|
1237
|
+
try {
|
|
1238
|
+
if (columns_2_1 && !columns_2_1.done && (_a = columns_2.return)) _a.call(columns_2);
|
|
1239
|
+
}
|
|
1240
|
+
finally { if (e_4) throw e_4.error; }
|
|
1241
|
+
return [7 /*endfinally*/];
|
|
1242
|
+
case 7: return [2 /*return*/];
|
|
1162
1243
|
}
|
|
1163
1244
|
});
|
|
1164
1245
|
});
|
|
@@ -1167,9 +1248,9 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
1167
1248
|
* Creates a new primary key.
|
|
1168
1249
|
*/
|
|
1169
1250
|
PostgresQueryRunner.prototype.createPrimaryKey = function (tableOrName, columnNames) {
|
|
1170
|
-
return
|
|
1251
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1171
1252
|
var table, _a, clonedTable, up, down;
|
|
1172
|
-
return
|
|
1253
|
+
return __generator(this, function (_b) {
|
|
1173
1254
|
switch (_b.label) {
|
|
1174
1255
|
case 0:
|
|
1175
1256
|
if (!(tableOrName instanceof Table)) return [3 /*break*/, 1];
|
|
@@ -1202,9 +1283,9 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
1202
1283
|
* Updates composite primary keys.
|
|
1203
1284
|
*/
|
|
1204
1285
|
PostgresQueryRunner.prototype.updatePrimaryKeys = function (tableOrName, columns) {
|
|
1205
|
-
return
|
|
1286
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1206
1287
|
var table, _a, clonedTable, columnNames, upQueries, downQueries, primaryColumns, pkName_3, columnNamesString_1, pkName, columnNamesString;
|
|
1207
|
-
return
|
|
1288
|
+
return __generator(this, function (_b) {
|
|
1208
1289
|
switch (_b.label) {
|
|
1209
1290
|
case 0:
|
|
1210
1291
|
if (!(tableOrName instanceof Table)) return [3 /*break*/, 1];
|
|
@@ -1248,9 +1329,9 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
1248
1329
|
* Drops a primary key.
|
|
1249
1330
|
*/
|
|
1250
1331
|
PostgresQueryRunner.prototype.dropPrimaryKey = function (tableOrName) {
|
|
1251
|
-
return
|
|
1332
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1252
1333
|
var table, _a, up, down;
|
|
1253
|
-
return
|
|
1334
|
+
return __generator(this, function (_b) {
|
|
1254
1335
|
switch (_b.label) {
|
|
1255
1336
|
case 0:
|
|
1256
1337
|
if (!(tableOrName instanceof Table)) return [3 /*break*/, 1];
|
|
@@ -1279,9 +1360,9 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
1279
1360
|
* Creates new unique constraint.
|
|
1280
1361
|
*/
|
|
1281
1362
|
PostgresQueryRunner.prototype.createUniqueConstraint = function (tableOrName, uniqueConstraint) {
|
|
1282
|
-
return
|
|
1363
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1283
1364
|
var table, _a, up, down;
|
|
1284
|
-
return
|
|
1365
|
+
return __generator(this, function (_b) {
|
|
1285
1366
|
switch (_b.label) {
|
|
1286
1367
|
case 0:
|
|
1287
1368
|
if (!(tableOrName instanceof Table)) return [3 /*break*/, 1];
|
|
@@ -1311,14 +1392,37 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
1311
1392
|
* Creates new unique constraints.
|
|
1312
1393
|
*/
|
|
1313
1394
|
PostgresQueryRunner.prototype.createUniqueConstraints = function (tableOrName, uniqueConstraints) {
|
|
1314
|
-
return
|
|
1315
|
-
var
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1395
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1396
|
+
var uniqueConstraints_1, uniqueConstraints_1_1, uniqueConstraint, e_5_1;
|
|
1397
|
+
var e_5, _a;
|
|
1398
|
+
return __generator(this, function (_b) {
|
|
1399
|
+
switch (_b.label) {
|
|
1400
|
+
case 0:
|
|
1401
|
+
_b.trys.push([0, 5, 6, 7]);
|
|
1402
|
+
uniqueConstraints_1 = __values(uniqueConstraints), uniqueConstraints_1_1 = uniqueConstraints_1.next();
|
|
1403
|
+
_b.label = 1;
|
|
1319
1404
|
case 1:
|
|
1320
|
-
|
|
1321
|
-
|
|
1405
|
+
if (!!uniqueConstraints_1_1.done) return [3 /*break*/, 4];
|
|
1406
|
+
uniqueConstraint = uniqueConstraints_1_1.value;
|
|
1407
|
+
return [4 /*yield*/, this.createUniqueConstraint(tableOrName, uniqueConstraint)];
|
|
1408
|
+
case 2:
|
|
1409
|
+
_b.sent();
|
|
1410
|
+
_b.label = 3;
|
|
1411
|
+
case 3:
|
|
1412
|
+
uniqueConstraints_1_1 = uniqueConstraints_1.next();
|
|
1413
|
+
return [3 /*break*/, 1];
|
|
1414
|
+
case 4: return [3 /*break*/, 7];
|
|
1415
|
+
case 5:
|
|
1416
|
+
e_5_1 = _b.sent();
|
|
1417
|
+
e_5 = { error: e_5_1 };
|
|
1418
|
+
return [3 /*break*/, 7];
|
|
1419
|
+
case 6:
|
|
1420
|
+
try {
|
|
1421
|
+
if (uniqueConstraints_1_1 && !uniqueConstraints_1_1.done && (_a = uniqueConstraints_1.return)) _a.call(uniqueConstraints_1);
|
|
1422
|
+
}
|
|
1423
|
+
finally { if (e_5) throw e_5.error; }
|
|
1424
|
+
return [7 /*endfinally*/];
|
|
1425
|
+
case 7: return [2 /*return*/];
|
|
1322
1426
|
}
|
|
1323
1427
|
});
|
|
1324
1428
|
});
|
|
@@ -1327,9 +1431,9 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
1327
1431
|
* Drops unique constraint.
|
|
1328
1432
|
*/
|
|
1329
1433
|
PostgresQueryRunner.prototype.dropUniqueConstraint = function (tableOrName, uniqueOrName) {
|
|
1330
|
-
return
|
|
1434
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1331
1435
|
var table, _a, uniqueConstraint, up, down;
|
|
1332
|
-
return
|
|
1436
|
+
return __generator(this, function (_b) {
|
|
1333
1437
|
switch (_b.label) {
|
|
1334
1438
|
case 0:
|
|
1335
1439
|
if (!(tableOrName instanceof Table)) return [3 /*break*/, 1];
|
|
@@ -1359,14 +1463,37 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
1359
1463
|
* Drops unique constraints.
|
|
1360
1464
|
*/
|
|
1361
1465
|
PostgresQueryRunner.prototype.dropUniqueConstraints = function (tableOrName, uniqueConstraints) {
|
|
1362
|
-
return
|
|
1363
|
-
var
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1466
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1467
|
+
var uniqueConstraints_2, uniqueConstraints_2_1, uniqueConstraint, e_6_1;
|
|
1468
|
+
var e_6, _a;
|
|
1469
|
+
return __generator(this, function (_b) {
|
|
1470
|
+
switch (_b.label) {
|
|
1471
|
+
case 0:
|
|
1472
|
+
_b.trys.push([0, 5, 6, 7]);
|
|
1473
|
+
uniqueConstraints_2 = __values(uniqueConstraints), uniqueConstraints_2_1 = uniqueConstraints_2.next();
|
|
1474
|
+
_b.label = 1;
|
|
1367
1475
|
case 1:
|
|
1368
|
-
|
|
1369
|
-
|
|
1476
|
+
if (!!uniqueConstraints_2_1.done) return [3 /*break*/, 4];
|
|
1477
|
+
uniqueConstraint = uniqueConstraints_2_1.value;
|
|
1478
|
+
return [4 /*yield*/, this.dropUniqueConstraint(tableOrName, uniqueConstraint)];
|
|
1479
|
+
case 2:
|
|
1480
|
+
_b.sent();
|
|
1481
|
+
_b.label = 3;
|
|
1482
|
+
case 3:
|
|
1483
|
+
uniqueConstraints_2_1 = uniqueConstraints_2.next();
|
|
1484
|
+
return [3 /*break*/, 1];
|
|
1485
|
+
case 4: return [3 /*break*/, 7];
|
|
1486
|
+
case 5:
|
|
1487
|
+
e_6_1 = _b.sent();
|
|
1488
|
+
e_6 = { error: e_6_1 };
|
|
1489
|
+
return [3 /*break*/, 7];
|
|
1490
|
+
case 6:
|
|
1491
|
+
try {
|
|
1492
|
+
if (uniqueConstraints_2_1 && !uniqueConstraints_2_1.done && (_a = uniqueConstraints_2.return)) _a.call(uniqueConstraints_2);
|
|
1493
|
+
}
|
|
1494
|
+
finally { if (e_6) throw e_6.error; }
|
|
1495
|
+
return [7 /*endfinally*/];
|
|
1496
|
+
case 7: return [2 /*return*/];
|
|
1370
1497
|
}
|
|
1371
1498
|
});
|
|
1372
1499
|
});
|
|
@@ -1375,9 +1502,9 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
1375
1502
|
* Creates new check constraint.
|
|
1376
1503
|
*/
|
|
1377
1504
|
PostgresQueryRunner.prototype.createCheckConstraint = function (tableOrName, checkConstraint) {
|
|
1378
|
-
return
|
|
1505
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1379
1506
|
var table, _a, up, down;
|
|
1380
|
-
return
|
|
1507
|
+
return __generator(this, function (_b) {
|
|
1381
1508
|
switch (_b.label) {
|
|
1382
1509
|
case 0:
|
|
1383
1510
|
if (!(tableOrName instanceof Table)) return [3 /*break*/, 1];
|
|
@@ -1407,10 +1534,10 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
1407
1534
|
* Creates new check constraints.
|
|
1408
1535
|
*/
|
|
1409
1536
|
PostgresQueryRunner.prototype.createCheckConstraints = function (tableOrName, checkConstraints) {
|
|
1410
|
-
return
|
|
1537
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1411
1538
|
var promises;
|
|
1412
1539
|
var _this = this;
|
|
1413
|
-
return
|
|
1540
|
+
return __generator(this, function (_a) {
|
|
1414
1541
|
switch (_a.label) {
|
|
1415
1542
|
case 0:
|
|
1416
1543
|
promises = checkConstraints.map(function (checkConstraint) { return _this.createCheckConstraint(tableOrName, checkConstraint); });
|
|
@@ -1426,9 +1553,9 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
1426
1553
|
* Drops check constraint.
|
|
1427
1554
|
*/
|
|
1428
1555
|
PostgresQueryRunner.prototype.dropCheckConstraint = function (tableOrName, checkOrName) {
|
|
1429
|
-
return
|
|
1556
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1430
1557
|
var table, _a, checkConstraint, up, down;
|
|
1431
|
-
return
|
|
1558
|
+
return __generator(this, function (_b) {
|
|
1432
1559
|
switch (_b.label) {
|
|
1433
1560
|
case 0:
|
|
1434
1561
|
if (!(tableOrName instanceof Table)) return [3 /*break*/, 1];
|
|
@@ -1458,10 +1585,10 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
1458
1585
|
* Drops check constraints.
|
|
1459
1586
|
*/
|
|
1460
1587
|
PostgresQueryRunner.prototype.dropCheckConstraints = function (tableOrName, checkConstraints) {
|
|
1461
|
-
return
|
|
1588
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1462
1589
|
var promises;
|
|
1463
1590
|
var _this = this;
|
|
1464
|
-
return
|
|
1591
|
+
return __generator(this, function (_a) {
|
|
1465
1592
|
switch (_a.label) {
|
|
1466
1593
|
case 0:
|
|
1467
1594
|
promises = checkConstraints.map(function (checkConstraint) { return _this.dropCheckConstraint(tableOrName, checkConstraint); });
|
|
@@ -1477,9 +1604,9 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
1477
1604
|
* Creates new exclusion constraint.
|
|
1478
1605
|
*/
|
|
1479
1606
|
PostgresQueryRunner.prototype.createExclusionConstraint = function (tableOrName, exclusionConstraint) {
|
|
1480
|
-
return
|
|
1607
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1481
1608
|
var table, _a, up, down;
|
|
1482
|
-
return
|
|
1609
|
+
return __generator(this, function (_b) {
|
|
1483
1610
|
switch (_b.label) {
|
|
1484
1611
|
case 0:
|
|
1485
1612
|
if (!(tableOrName instanceof Table)) return [3 /*break*/, 1];
|
|
@@ -1509,10 +1636,10 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
1509
1636
|
* Creates new exclusion constraints.
|
|
1510
1637
|
*/
|
|
1511
1638
|
PostgresQueryRunner.prototype.createExclusionConstraints = function (tableOrName, exclusionConstraints) {
|
|
1512
|
-
return
|
|
1639
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1513
1640
|
var promises;
|
|
1514
1641
|
var _this = this;
|
|
1515
|
-
return
|
|
1642
|
+
return __generator(this, function (_a) {
|
|
1516
1643
|
switch (_a.label) {
|
|
1517
1644
|
case 0:
|
|
1518
1645
|
promises = exclusionConstraints.map(function (exclusionConstraint) { return _this.createExclusionConstraint(tableOrName, exclusionConstraint); });
|
|
@@ -1528,9 +1655,9 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
1528
1655
|
* Drops exclusion constraint.
|
|
1529
1656
|
*/
|
|
1530
1657
|
PostgresQueryRunner.prototype.dropExclusionConstraint = function (tableOrName, exclusionOrName) {
|
|
1531
|
-
return
|
|
1658
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1532
1659
|
var table, _a, exclusionConstraint, up, down;
|
|
1533
|
-
return
|
|
1660
|
+
return __generator(this, function (_b) {
|
|
1534
1661
|
switch (_b.label) {
|
|
1535
1662
|
case 0:
|
|
1536
1663
|
if (!(tableOrName instanceof Table)) return [3 /*break*/, 1];
|
|
@@ -1560,10 +1687,10 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
1560
1687
|
* Drops exclusion constraints.
|
|
1561
1688
|
*/
|
|
1562
1689
|
PostgresQueryRunner.prototype.dropExclusionConstraints = function (tableOrName, exclusionConstraints) {
|
|
1563
|
-
return
|
|
1690
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1564
1691
|
var promises;
|
|
1565
1692
|
var _this = this;
|
|
1566
|
-
return
|
|
1693
|
+
return __generator(this, function (_a) {
|
|
1567
1694
|
switch (_a.label) {
|
|
1568
1695
|
case 0:
|
|
1569
1696
|
promises = exclusionConstraints.map(function (exclusionConstraint) { return _this.dropExclusionConstraint(tableOrName, exclusionConstraint); });
|
|
@@ -1579,9 +1706,9 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
1579
1706
|
* Creates a new foreign key.
|
|
1580
1707
|
*/
|
|
1581
1708
|
PostgresQueryRunner.prototype.createForeignKey = function (tableOrName, foreignKey) {
|
|
1582
|
-
return
|
|
1709
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1583
1710
|
var table, _a, up, down;
|
|
1584
|
-
return
|
|
1711
|
+
return __generator(this, function (_b) {
|
|
1585
1712
|
switch (_b.label) {
|
|
1586
1713
|
case 0:
|
|
1587
1714
|
if (!(tableOrName instanceof Table)) return [3 /*break*/, 1];
|
|
@@ -1611,14 +1738,37 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
1611
1738
|
* Creates a new foreign keys.
|
|
1612
1739
|
*/
|
|
1613
1740
|
PostgresQueryRunner.prototype.createForeignKeys = function (tableOrName, foreignKeys) {
|
|
1614
|
-
return
|
|
1615
|
-
var
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1741
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1742
|
+
var foreignKeys_1, foreignKeys_1_1, foreignKey, e_7_1;
|
|
1743
|
+
var e_7, _a;
|
|
1744
|
+
return __generator(this, function (_b) {
|
|
1745
|
+
switch (_b.label) {
|
|
1746
|
+
case 0:
|
|
1747
|
+
_b.trys.push([0, 5, 6, 7]);
|
|
1748
|
+
foreignKeys_1 = __values(foreignKeys), foreignKeys_1_1 = foreignKeys_1.next();
|
|
1749
|
+
_b.label = 1;
|
|
1619
1750
|
case 1:
|
|
1620
|
-
|
|
1621
|
-
|
|
1751
|
+
if (!!foreignKeys_1_1.done) return [3 /*break*/, 4];
|
|
1752
|
+
foreignKey = foreignKeys_1_1.value;
|
|
1753
|
+
return [4 /*yield*/, this.createForeignKey(tableOrName, foreignKey)];
|
|
1754
|
+
case 2:
|
|
1755
|
+
_b.sent();
|
|
1756
|
+
_b.label = 3;
|
|
1757
|
+
case 3:
|
|
1758
|
+
foreignKeys_1_1 = foreignKeys_1.next();
|
|
1759
|
+
return [3 /*break*/, 1];
|
|
1760
|
+
case 4: return [3 /*break*/, 7];
|
|
1761
|
+
case 5:
|
|
1762
|
+
e_7_1 = _b.sent();
|
|
1763
|
+
e_7 = { error: e_7_1 };
|
|
1764
|
+
return [3 /*break*/, 7];
|
|
1765
|
+
case 6:
|
|
1766
|
+
try {
|
|
1767
|
+
if (foreignKeys_1_1 && !foreignKeys_1_1.done && (_a = foreignKeys_1.return)) _a.call(foreignKeys_1);
|
|
1768
|
+
}
|
|
1769
|
+
finally { if (e_7) throw e_7.error; }
|
|
1770
|
+
return [7 /*endfinally*/];
|
|
1771
|
+
case 7: return [2 /*return*/];
|
|
1622
1772
|
}
|
|
1623
1773
|
});
|
|
1624
1774
|
});
|
|
@@ -1627,9 +1777,9 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
1627
1777
|
* Drops a foreign key from the table.
|
|
1628
1778
|
*/
|
|
1629
1779
|
PostgresQueryRunner.prototype.dropForeignKey = function (tableOrName, foreignKeyOrName) {
|
|
1630
|
-
return
|
|
1780
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1631
1781
|
var table, _a, foreignKey, up, down;
|
|
1632
|
-
return
|
|
1782
|
+
return __generator(this, function (_b) {
|
|
1633
1783
|
switch (_b.label) {
|
|
1634
1784
|
case 0:
|
|
1635
1785
|
if (!(tableOrName instanceof Table)) return [3 /*break*/, 1];
|
|
@@ -1659,14 +1809,37 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
1659
1809
|
* Drops a foreign keys from the table.
|
|
1660
1810
|
*/
|
|
1661
1811
|
PostgresQueryRunner.prototype.dropForeignKeys = function (tableOrName, foreignKeys) {
|
|
1662
|
-
return
|
|
1663
|
-
var
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1812
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1813
|
+
var foreignKeys_2, foreignKeys_2_1, foreignKey, e_8_1;
|
|
1814
|
+
var e_8, _a;
|
|
1815
|
+
return __generator(this, function (_b) {
|
|
1816
|
+
switch (_b.label) {
|
|
1817
|
+
case 0:
|
|
1818
|
+
_b.trys.push([0, 5, 6, 7]);
|
|
1819
|
+
foreignKeys_2 = __values(foreignKeys), foreignKeys_2_1 = foreignKeys_2.next();
|
|
1820
|
+
_b.label = 1;
|
|
1667
1821
|
case 1:
|
|
1668
|
-
|
|
1669
|
-
|
|
1822
|
+
if (!!foreignKeys_2_1.done) return [3 /*break*/, 4];
|
|
1823
|
+
foreignKey = foreignKeys_2_1.value;
|
|
1824
|
+
return [4 /*yield*/, this.dropForeignKey(tableOrName, foreignKey)];
|
|
1825
|
+
case 2:
|
|
1826
|
+
_b.sent();
|
|
1827
|
+
_b.label = 3;
|
|
1828
|
+
case 3:
|
|
1829
|
+
foreignKeys_2_1 = foreignKeys_2.next();
|
|
1830
|
+
return [3 /*break*/, 1];
|
|
1831
|
+
case 4: return [3 /*break*/, 7];
|
|
1832
|
+
case 5:
|
|
1833
|
+
e_8_1 = _b.sent();
|
|
1834
|
+
e_8 = { error: e_8_1 };
|
|
1835
|
+
return [3 /*break*/, 7];
|
|
1836
|
+
case 6:
|
|
1837
|
+
try {
|
|
1838
|
+
if (foreignKeys_2_1 && !foreignKeys_2_1.done && (_a = foreignKeys_2.return)) _a.call(foreignKeys_2);
|
|
1839
|
+
}
|
|
1840
|
+
finally { if (e_8) throw e_8.error; }
|
|
1841
|
+
return [7 /*endfinally*/];
|
|
1842
|
+
case 7: return [2 /*return*/];
|
|
1670
1843
|
}
|
|
1671
1844
|
});
|
|
1672
1845
|
});
|
|
@@ -1675,9 +1848,9 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
1675
1848
|
* Creates a new index.
|
|
1676
1849
|
*/
|
|
1677
1850
|
PostgresQueryRunner.prototype.createIndex = function (tableOrName, index) {
|
|
1678
|
-
return
|
|
1851
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1679
1852
|
var table, _a, up, down;
|
|
1680
|
-
return
|
|
1853
|
+
return __generator(this, function (_b) {
|
|
1681
1854
|
switch (_b.label) {
|
|
1682
1855
|
case 0:
|
|
1683
1856
|
if (!(tableOrName instanceof Table)) return [3 /*break*/, 1];
|
|
@@ -1707,14 +1880,37 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
1707
1880
|
* Creates a new indices
|
|
1708
1881
|
*/
|
|
1709
1882
|
PostgresQueryRunner.prototype.createIndices = function (tableOrName, indices) {
|
|
1710
|
-
return
|
|
1711
|
-
var
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1883
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1884
|
+
var indices_1, indices_1_1, index, e_9_1;
|
|
1885
|
+
var e_9, _a;
|
|
1886
|
+
return __generator(this, function (_b) {
|
|
1887
|
+
switch (_b.label) {
|
|
1888
|
+
case 0:
|
|
1889
|
+
_b.trys.push([0, 5, 6, 7]);
|
|
1890
|
+
indices_1 = __values(indices), indices_1_1 = indices_1.next();
|
|
1891
|
+
_b.label = 1;
|
|
1715
1892
|
case 1:
|
|
1716
|
-
|
|
1717
|
-
|
|
1893
|
+
if (!!indices_1_1.done) return [3 /*break*/, 4];
|
|
1894
|
+
index = indices_1_1.value;
|
|
1895
|
+
return [4 /*yield*/, this.createIndex(tableOrName, index)];
|
|
1896
|
+
case 2:
|
|
1897
|
+
_b.sent();
|
|
1898
|
+
_b.label = 3;
|
|
1899
|
+
case 3:
|
|
1900
|
+
indices_1_1 = indices_1.next();
|
|
1901
|
+
return [3 /*break*/, 1];
|
|
1902
|
+
case 4: return [3 /*break*/, 7];
|
|
1903
|
+
case 5:
|
|
1904
|
+
e_9_1 = _b.sent();
|
|
1905
|
+
e_9 = { error: e_9_1 };
|
|
1906
|
+
return [3 /*break*/, 7];
|
|
1907
|
+
case 6:
|
|
1908
|
+
try {
|
|
1909
|
+
if (indices_1_1 && !indices_1_1.done && (_a = indices_1.return)) _a.call(indices_1);
|
|
1910
|
+
}
|
|
1911
|
+
finally { if (e_9) throw e_9.error; }
|
|
1912
|
+
return [7 /*endfinally*/];
|
|
1913
|
+
case 7: return [2 /*return*/];
|
|
1718
1914
|
}
|
|
1719
1915
|
});
|
|
1720
1916
|
});
|
|
@@ -1723,9 +1919,9 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
1723
1919
|
* Drops an index from the table.
|
|
1724
1920
|
*/
|
|
1725
1921
|
PostgresQueryRunner.prototype.dropIndex = function (tableOrName, indexOrName) {
|
|
1726
|
-
return
|
|
1922
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1727
1923
|
var table, _a, index, up, down;
|
|
1728
|
-
return
|
|
1924
|
+
return __generator(this, function (_b) {
|
|
1729
1925
|
switch (_b.label) {
|
|
1730
1926
|
case 0:
|
|
1731
1927
|
if (!(tableOrName instanceof Table)) return [3 /*break*/, 1];
|
|
@@ -1755,14 +1951,37 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
1755
1951
|
* Drops an indices from the table.
|
|
1756
1952
|
*/
|
|
1757
1953
|
PostgresQueryRunner.prototype.dropIndices = function (tableOrName, indices) {
|
|
1758
|
-
return
|
|
1759
|
-
var
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1954
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1955
|
+
var indices_2, indices_2_1, index, e_10_1;
|
|
1956
|
+
var e_10, _a;
|
|
1957
|
+
return __generator(this, function (_b) {
|
|
1958
|
+
switch (_b.label) {
|
|
1959
|
+
case 0:
|
|
1960
|
+
_b.trys.push([0, 5, 6, 7]);
|
|
1961
|
+
indices_2 = __values(indices), indices_2_1 = indices_2.next();
|
|
1962
|
+
_b.label = 1;
|
|
1763
1963
|
case 1:
|
|
1764
|
-
|
|
1765
|
-
|
|
1964
|
+
if (!!indices_2_1.done) return [3 /*break*/, 4];
|
|
1965
|
+
index = indices_2_1.value;
|
|
1966
|
+
return [4 /*yield*/, this.dropIndex(tableOrName, index)];
|
|
1967
|
+
case 2:
|
|
1968
|
+
_b.sent();
|
|
1969
|
+
_b.label = 3;
|
|
1970
|
+
case 3:
|
|
1971
|
+
indices_2_1 = indices_2.next();
|
|
1972
|
+
return [3 /*break*/, 1];
|
|
1973
|
+
case 4: return [3 /*break*/, 7];
|
|
1974
|
+
case 5:
|
|
1975
|
+
e_10_1 = _b.sent();
|
|
1976
|
+
e_10 = { error: e_10_1 };
|
|
1977
|
+
return [3 /*break*/, 7];
|
|
1978
|
+
case 6:
|
|
1979
|
+
try {
|
|
1980
|
+
if (indices_2_1 && !indices_2_1.done && (_a = indices_2.return)) _a.call(indices_2);
|
|
1981
|
+
}
|
|
1982
|
+
finally { if (e_10) throw e_10.error; }
|
|
1983
|
+
return [7 /*endfinally*/];
|
|
1984
|
+
case 7: return [2 /*return*/];
|
|
1766
1985
|
}
|
|
1767
1986
|
});
|
|
1768
1987
|
});
|
|
@@ -1772,8 +1991,8 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
1772
1991
|
* Note: this operation uses SQL's TRUNCATE query which cannot be reverted in transactions.
|
|
1773
1992
|
*/
|
|
1774
1993
|
PostgresQueryRunner.prototype.clearTable = function (tableName) {
|
|
1775
|
-
return
|
|
1776
|
-
return
|
|
1994
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1995
|
+
return __generator(this, function (_a) {
|
|
1777
1996
|
switch (_a.label) {
|
|
1778
1997
|
case 0: return [4 /*yield*/, this.query("TRUNCATE TABLE " + this.escapePath(tableName))];
|
|
1779
1998
|
case 1:
|
|
@@ -1787,10 +2006,10 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
1787
2006
|
* Removes all tables from the currently connected database.
|
|
1788
2007
|
*/
|
|
1789
2008
|
PostgresQueryRunner.prototype.clearDatabase = function () {
|
|
1790
|
-
return
|
|
2009
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1791
2010
|
var schemas, schemaNamesString, selectViewDropsQuery, dropViewQueries, selectTableDropsQuery, dropTableQueries, error_1, rollbackError_1;
|
|
1792
2011
|
var _this = this;
|
|
1793
|
-
return
|
|
2012
|
+
return __generator(this, function (_a) {
|
|
1794
2013
|
switch (_a.label) {
|
|
1795
2014
|
case 0:
|
|
1796
2015
|
schemas = [];
|
|
@@ -1855,10 +2074,10 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
1855
2074
|
// Protected Methods
|
|
1856
2075
|
// -------------------------------------------------------------------------
|
|
1857
2076
|
PostgresQueryRunner.prototype.loadViews = function (viewNames) {
|
|
1858
|
-
return
|
|
2077
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1859
2078
|
var hasTable, currentSchemaQuery, currentSchema, viewsCondition, query, dbViews;
|
|
1860
2079
|
var _this = this;
|
|
1861
|
-
return
|
|
2080
|
+
return __generator(this, function (_a) {
|
|
1862
2081
|
switch (_a.label) {
|
|
1863
2082
|
case 0: return [4 /*yield*/, this.hasTable(this.getTypeormMetadataTableName())];
|
|
1864
2083
|
case 1:
|
|
@@ -1870,7 +2089,7 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
1870
2089
|
currentSchemaQuery = _a.sent();
|
|
1871
2090
|
currentSchema = currentSchemaQuery[0]["current_schema"];
|
|
1872
2091
|
viewsCondition = viewNames.map(function (viewName) {
|
|
1873
|
-
var _a =
|
|
2092
|
+
var _a = __read(viewName.split("."), 2), schema = _a[0], name = _a[1];
|
|
1874
2093
|
if (!name) {
|
|
1875
2094
|
name = schema;
|
|
1876
2095
|
schema = _this.driver.options.schema || currentSchema;
|
|
@@ -1897,10 +2116,10 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
1897
2116
|
* Loads all tables (with given names) from the database and creates a Table from them.
|
|
1898
2117
|
*/
|
|
1899
2118
|
PostgresQueryRunner.prototype.loadTables = function (tableNames) {
|
|
1900
|
-
return
|
|
2119
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1901
2120
|
var currentSchemaQuery, currentSchema, tablesCondition, tablesSql, columnsSql, constraintsCondition, constraintsSql, indicesSql, foreignKeysCondition, foreignKeysSql, _a, dbTables, dbColumns, dbConstraints, dbIndices, dbForeignKeys;
|
|
1902
2121
|
var _this = this;
|
|
1903
|
-
return
|
|
2122
|
+
return __generator(this, function (_b) {
|
|
1904
2123
|
switch (_b.label) {
|
|
1905
2124
|
case 0:
|
|
1906
2125
|
// if no tables given then no need to proceed
|
|
@@ -1911,7 +2130,7 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
1911
2130
|
currentSchemaQuery = _b.sent();
|
|
1912
2131
|
currentSchema = currentSchemaQuery[0]["current_schema"];
|
|
1913
2132
|
tablesCondition = tableNames.map(function (tableName) {
|
|
1914
|
-
var _a =
|
|
2133
|
+
var _a = __read(tableName.split("."), 2), schema = _a[0], name = _a[1];
|
|
1915
2134
|
if (!name) {
|
|
1916
2135
|
name = schema;
|
|
1917
2136
|
schema = _this.driver.options.schema || currentSchema;
|
|
@@ -1921,7 +2140,7 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
1921
2140
|
tablesSql = "SELECT * FROM \"information_schema\".\"tables\" WHERE " + tablesCondition;
|
|
1922
2141
|
columnsSql = "SELECT *, ('\"' || \"udt_schema\" || '\".\"' || \"udt_name\" || '\"')::\"regtype\" AS \"regtype\" FROM \"information_schema\".\"columns\" WHERE " + tablesCondition;
|
|
1923
2142
|
constraintsCondition = tableNames.map(function (tableName) {
|
|
1924
|
-
var _a =
|
|
2143
|
+
var _a = __read(tableName.split("."), 2), schema = _a[0], name = _a[1];
|
|
1925
2144
|
if (!name) {
|
|
1926
2145
|
name = schema;
|
|
1927
2146
|
schema = _this.driver.options.schema || currentSchema;
|
|
@@ -1948,7 +2167,7 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
1948
2167
|
"LEFT JOIN \"pg_constraint\" \"cnst\" ON \"cnst\".\"conname\" = \"i\".\"relname\" " +
|
|
1949
2168
|
("WHERE \"t\".\"relkind\" = 'r' AND \"cnst\".\"contype\" IS NULL AND (" + constraintsCondition + ")");
|
|
1950
2169
|
foreignKeysCondition = tableNames.map(function (tableName) {
|
|
1951
|
-
var _a =
|
|
2170
|
+
var _a = __read(tableName.split("."), 2), schema = _a[0], name = _a[1];
|
|
1952
2171
|
if (!name) {
|
|
1953
2172
|
name = schema;
|
|
1954
2173
|
schema = _this.driver.options.schema || currentSchema;
|
|
@@ -1981,29 +2200,30 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
1981
2200
|
this.query(foreignKeysSql),
|
|
1982
2201
|
])];
|
|
1983
2202
|
case 2:
|
|
1984
|
-
_a =
|
|
2203
|
+
_a = __read.apply(void 0, [_b.sent(), 5]), dbTables = _a[0], dbColumns = _a[1], dbConstraints = _a[2], dbIndices = _a[3], dbForeignKeys = _a[4];
|
|
1985
2204
|
// if tables were not found in the db, no need to proceed
|
|
1986
2205
|
if (!dbTables.length)
|
|
1987
2206
|
return [2 /*return*/, []];
|
|
1988
2207
|
// create tables for loaded tables
|
|
1989
|
-
return [2 /*return*/, Promise.all(dbTables.map(function (dbTable) { return
|
|
1990
|
-
var table, schema, tableFullName, _a, tableUniqueConstraints, tableCheckConstraints, tableExclusionConstraints, tableForeignKeyConstraints, tableIndexConstraints;
|
|
2208
|
+
return [2 /*return*/, Promise.all(dbTables.map(function (dbTable) { return __awaiter(_this, void 0, void 0, function () {
|
|
2209
|
+
var table, getSchemaFromKey, schema, tableFullName, _a, tableUniqueConstraints, tableCheckConstraints, tableExclusionConstraints, tableForeignKeyConstraints, tableIndexConstraints;
|
|
1991
2210
|
var _this = this;
|
|
1992
|
-
return
|
|
2211
|
+
return __generator(this, function (_b) {
|
|
1993
2212
|
switch (_b.label) {
|
|
1994
2213
|
case 0:
|
|
1995
2214
|
table = new Table();
|
|
1996
|
-
|
|
2215
|
+
getSchemaFromKey = function (dbObject, key) { return dbObject[key] === currentSchema && !_this.driver.options.schema ? undefined : dbObject[key]; };
|
|
2216
|
+
schema = getSchemaFromKey(dbTable, "table_schema");
|
|
1997
2217
|
table.name = this.driver.buildTableName(dbTable["table_name"], schema);
|
|
1998
2218
|
tableFullName = this.driver.buildTableName(dbTable["table_name"], dbTable["table_schema"]);
|
|
1999
2219
|
// create columns from the loaded columns
|
|
2000
2220
|
_a = table;
|
|
2001
2221
|
return [4 /*yield*/, Promise.all(dbColumns
|
|
2002
2222
|
.filter(function (dbColumn) { return _this.driver.buildTableName(dbColumn["table_name"], dbColumn["table_schema"]) === tableFullName; })
|
|
2003
|
-
.map(function (dbColumn) { return
|
|
2223
|
+
.map(function (dbColumn) { return __awaiter(_this, void 0, void 0, function () {
|
|
2004
2224
|
var columnConstraints, tableColumn, type, sql, results, geometryColumnSql, results, geographyColumnSql, results, length_1, uniqueConstraint, isConstraintComposite;
|
|
2005
2225
|
var _this = this;
|
|
2006
|
-
return
|
|
2226
|
+
return __generator(this, function (_a) {
|
|
2007
2227
|
switch (_a.label) {
|
|
2008
2228
|
case 0:
|
|
2009
2229
|
columnConstraints = dbConstraints.filter(function (dbConstraint) {
|
|
@@ -2053,7 +2273,7 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
2053
2273
|
_a.label = 2;
|
|
2054
2274
|
case 2:
|
|
2055
2275
|
if (!(tableColumn.type === "geometry")) return [3 /*break*/, 4];
|
|
2056
|
-
geometryColumnSql = "SELECT * FROM (\n SELECT\n \"f_table_schema\" \"table_schema\",\n \"f_table_name\" \"table_name\",\n \"f_geometry_column\" \"column_name\",\n \"srid\",\n \"type\"\n FROM \"geometry_columns\"\n ) AS _\n WHERE (" + tablesCondition + ") AND \"column_name\" = '" + tableColumn.name + "' AND \"table_name\" = '" +
|
|
2276
|
+
geometryColumnSql = "SELECT * FROM (\n SELECT\n \"f_table_schema\" \"table_schema\",\n \"f_table_name\" \"table_name\",\n \"f_geometry_column\" \"column_name\",\n \"srid\",\n \"type\"\n FROM \"geometry_columns\"\n ) AS _\n WHERE (" + tablesCondition + ") AND \"column_name\" = '" + tableColumn.name + "' AND \"table_name\" = '" + dbTable["table_name"] + "'";
|
|
2057
2277
|
return [4 /*yield*/, this.query(geometryColumnSql)];
|
|
2058
2278
|
case 3:
|
|
2059
2279
|
results = _a.sent();
|
|
@@ -2062,7 +2282,7 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
2062
2282
|
_a.label = 4;
|
|
2063
2283
|
case 4:
|
|
2064
2284
|
if (!(tableColumn.type === "geography")) return [3 /*break*/, 6];
|
|
2065
|
-
geographyColumnSql = "SELECT * FROM (\n SELECT\n \"f_table_schema\" \"table_schema\",\n \"f_table_name\" \"table_name\",\n \"f_geography_column\" \"column_name\",\n \"srid\",\n \"type\"\n FROM \"geography_columns\"\n ) AS _\n WHERE (" + tablesCondition + ") AND \"column_name\" = '" + tableColumn.name + "' AND \"table_name\" = '" +
|
|
2285
|
+
geographyColumnSql = "SELECT * FROM (\n SELECT\n \"f_table_schema\" \"table_schema\",\n \"f_table_name\" \"table_name\",\n \"f_geography_column\" \"column_name\",\n \"srid\",\n \"type\"\n FROM \"geography_columns\"\n ) AS _\n WHERE (" + tablesCondition + ") AND \"column_name\" = '" + tableColumn.name + "' AND \"table_name\" = '" + dbTable["table_name"] + "'";
|
|
2066
2286
|
return [4 /*yield*/, this.query(geographyColumnSql)];
|
|
2067
2287
|
case 5:
|
|
2068
2288
|
results = _a.sent();
|
|
@@ -2148,7 +2368,7 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
2148
2368
|
table.foreignKeys = tableForeignKeyConstraints.map(function (dbForeignKey) {
|
|
2149
2369
|
var foreignKeys = dbForeignKeys.filter(function (dbFk) { return dbFk["constraint_name"] === dbForeignKey["constraint_name"]; });
|
|
2150
2370
|
// if referenced table located in currently used schema, we don't need to concat schema name to table name.
|
|
2151
|
-
var schema = dbForeignKey
|
|
2371
|
+
var schema = getSchemaFromKey(dbForeignKey, "referenced_table_schema");
|
|
2152
2372
|
var referencedTableName = _this.driver.buildTableName(dbForeignKey["referenced_table_name"], schema);
|
|
2153
2373
|
return new TableForeignKey({
|
|
2154
2374
|
name: dbForeignKey["constraint_name"],
|
|
@@ -2269,9 +2489,9 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
2269
2489
|
}
|
|
2270
2490
|
};
|
|
2271
2491
|
PostgresQueryRunner.prototype.insertViewDefinitionSql = function (view) {
|
|
2272
|
-
return
|
|
2492
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
2273
2493
|
var currentSchemaQuery, currentSchema, splittedName, schema, name, expression, _a, query, parameters;
|
|
2274
|
-
return
|
|
2494
|
+
return __generator(this, function (_b) {
|
|
2275
2495
|
switch (_b.label) {
|
|
2276
2496
|
case 0: return [4 /*yield*/, this.query("SELECT * FROM current_schema()")];
|
|
2277
2497
|
case 1:
|
|
@@ -2285,7 +2505,7 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
2285
2505
|
name = splittedName[1];
|
|
2286
2506
|
}
|
|
2287
2507
|
expression = typeof view.expression === "string" ? view.expression.trim() : view.expression(this.connection).getQuery();
|
|
2288
|
-
_a =
|
|
2508
|
+
_a = __read(this.connection.createQueryBuilder()
|
|
2289
2509
|
.insert()
|
|
2290
2510
|
.into(this.getTypeormMetadataTableName())
|
|
2291
2511
|
.values({ type: "VIEW", schema: schema, name: name, value: expression })
|
|
@@ -2305,9 +2525,9 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
2305
2525
|
* Builds remove view sql.
|
|
2306
2526
|
*/
|
|
2307
2527
|
PostgresQueryRunner.prototype.deleteViewDefinitionSql = function (viewOrPath) {
|
|
2308
|
-
return
|
|
2528
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
2309
2529
|
var currentSchemaQuery, currentSchema, viewName, splittedName, schema, name, qb, _a, query, parameters;
|
|
2310
|
-
return
|
|
2530
|
+
return __generator(this, function (_b) {
|
|
2311
2531
|
switch (_b.label) {
|
|
2312
2532
|
case 0: return [4 /*yield*/, this.query("SELECT * FROM current_schema()")];
|
|
2313
2533
|
case 1:
|
|
@@ -2322,7 +2542,7 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
2322
2542
|
name = splittedName[1];
|
|
2323
2543
|
}
|
|
2324
2544
|
qb = this.connection.createQueryBuilder();
|
|
2325
|
-
_a =
|
|
2545
|
+
_a = __read(qb.delete()
|
|
2326
2546
|
.from(this.getTypeormMetadataTableName())
|
|
2327
2547
|
.where(qb.escape("type") + " = 'VIEW'")
|
|
2328
2548
|
.andWhere(qb.escape("schema") + " = :schema", { schema: schema })
|
|
@@ -2344,10 +2564,10 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
2344
2564
|
* Drops ENUM type from given schemas.
|
|
2345
2565
|
*/
|
|
2346
2566
|
PostgresQueryRunner.prototype.dropEnumTypes = function (schemaNames) {
|
|
2347
|
-
return
|
|
2567
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
2348
2568
|
var selectDropsQuery, dropQueries;
|
|
2349
2569
|
var _this = this;
|
|
2350
|
-
return
|
|
2570
|
+
return __generator(this, function (_a) {
|
|
2351
2571
|
switch (_a.label) {
|
|
2352
2572
|
case 0:
|
|
2353
2573
|
selectDropsQuery = "SELECT 'DROP TYPE IF EXISTS \"' || n.nspname || '\".\"' || t.typname || '\" CASCADE;' as \"query\" FROM \"pg_type\" \"t\" " +
|
|
@@ -2369,9 +2589,9 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
2369
2589
|
* Checks if enum with the given name exist in the database.
|
|
2370
2590
|
*/
|
|
2371
2591
|
PostgresQueryRunner.prototype.hasEnumType = function (table, column) {
|
|
2372
|
-
return
|
|
2592
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
2373
2593
|
var schema, enumName, sql, result;
|
|
2374
|
-
return
|
|
2594
|
+
return __generator(this, function (_a) {
|
|
2375
2595
|
switch (_a.label) {
|
|
2376
2596
|
case 0:
|
|
2377
2597
|
schema = this.parseTableName(table).schema;
|
|
@@ -2544,15 +2764,15 @@ var PostgresQueryRunner = /** @class */ (function (_super) {
|
|
|
2544
2764
|
}).join(".");
|
|
2545
2765
|
};
|
|
2546
2766
|
PostgresQueryRunner.prototype.getEnumTypeName = function (table, column) {
|
|
2547
|
-
return
|
|
2767
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
2548
2768
|
var currentSchemaQuery, currentSchema, _a, schema, name, result;
|
|
2549
|
-
return
|
|
2769
|
+
return __generator(this, function (_b) {
|
|
2550
2770
|
switch (_b.label) {
|
|
2551
2771
|
case 0: return [4 /*yield*/, this.query("SELECT * FROM current_schema()")];
|
|
2552
2772
|
case 1:
|
|
2553
2773
|
currentSchemaQuery = _b.sent();
|
|
2554
2774
|
currentSchema = currentSchemaQuery[0]["current_schema"];
|
|
2555
|
-
_a =
|
|
2775
|
+
_a = __read(table.name.split("."), 2), schema = _a[0], name = _a[1];
|
|
2556
2776
|
if (!name) {
|
|
2557
2777
|
name = schema;
|
|
2558
2778
|
schema = this.driver.options.schema || currentSchema;
|