typeorm 0.2.38-dev.e9366b3 → 0.2.39-dev.1197f88
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 +61 -60
- package/browser/connection/ConnectionMetadataBuilder.js +4 -4
- package/browser/connection/ConnectionMetadataBuilder.js.map +1 -1
- package/browser/connection/ConnectionOptionsReader.js +2 -1
- package/browser/connection/ConnectionOptionsReader.js.map +1 -1
- package/browser/connection/options-reader/ConnectionOptionsYmlReader.js +1 -1
- package/browser/connection/options-reader/ConnectionOptionsYmlReader.js.map +1 -1
- package/browser/decorator/entity-view/ViewEntity.js +1 -0
- package/browser/decorator/entity-view/ViewEntity.js.map +1 -1
- package/browser/decorator/options/ViewEntityOptions.d.ts +5 -0
- package/browser/decorator/options/ViewEntityOptions.js.map +1 -1
- package/browser/decorator/transaction/Transaction.js +3 -3
- package/browser/decorator/transaction/Transaction.js.map +1 -1
- package/browser/driver/DriverUtils.js +1 -1
- package/browser/driver/DriverUtils.js.map +1 -1
- package/browser/driver/aurora-data-api/AuroraDataApiConnectionOptions.d.ts +5 -0
- package/browser/driver/aurora-data-api/AuroraDataApiConnectionOptions.js.map +1 -1
- package/browser/driver/aurora-data-api/AuroraDataApiDriver.js +6 -5
- package/browser/driver/aurora-data-api/AuroraDataApiDriver.js.map +1 -1
- package/browser/driver/aurora-data-api/AuroraDataApiQueryRunner.js +19 -48
- package/browser/driver/aurora-data-api/AuroraDataApiQueryRunner.js.map +1 -1
- package/browser/driver/aurora-data-api-pg/AuroraDataApiPostgresConnectionOptions.d.ts +5 -0
- package/browser/driver/aurora-data-api-pg/AuroraDataApiPostgresConnectionOptions.js.map +1 -1
- package/browser/driver/aurora-data-api-pg/AuroraDataApiPostgresDriver.js +2 -1
- package/browser/driver/aurora-data-api-pg/AuroraDataApiPostgresDriver.js.map +1 -1
- package/browser/driver/aurora-data-api-pg/AuroraDataApiPostgresQueryRunner.js +17 -46
- package/browser/driver/aurora-data-api-pg/AuroraDataApiPostgresQueryRunner.js.map +1 -1
- package/browser/driver/better-sqlite3/BetterSqlite3ConnectionOptions.d.ts +5 -0
- package/browser/driver/better-sqlite3/BetterSqlite3ConnectionOptions.js.map +1 -1
- package/browser/driver/better-sqlite3/BetterSqlite3Driver.js +4 -3
- package/browser/driver/better-sqlite3/BetterSqlite3Driver.js.map +1 -1
- package/browser/driver/cockroachdb/CockroachConnectionOptions.d.ts +10 -0
- package/browser/driver/cockroachdb/CockroachConnectionOptions.js.map +1 -1
- package/browser/driver/cockroachdb/CockroachDriver.js +28 -18
- package/browser/driver/cockroachdb/CockroachDriver.js.map +1 -1
- package/browser/driver/cockroachdb/CockroachQueryRunner.js +108 -145
- package/browser/driver/cockroachdb/CockroachQueryRunner.js.map +1 -1
- package/browser/driver/cordova/CordovaConnectionOptions.d.ts +5 -0
- package/browser/driver/cordova/CordovaConnectionOptions.js.map +1 -1
- package/browser/driver/cordova/CordovaDriver.d.ts +1 -1
- package/browser/driver/cordova/CordovaDriver.js +27 -19
- package/browser/driver/cordova/CordovaDriver.js.map +1 -1
- package/browser/driver/cordova/CordovaQueryRunner.js +50 -43
- package/browser/driver/cordova/CordovaQueryRunner.js.map +1 -1
- package/browser/driver/expo/ExpoQueryRunner.js +12 -43
- package/browser/driver/expo/ExpoQueryRunner.js.map +1 -1
- package/browser/driver/mongodb/MongoConnectionOptions.d.ts +5 -0
- package/browser/driver/mongodb/MongoConnectionOptions.js.map +1 -1
- package/browser/driver/mongodb/MongoDriver.js +2 -1
- package/browser/driver/mongodb/MongoDriver.js.map +1 -1
- package/browser/driver/mysql/MysqlConnectionOptions.d.ts +6 -0
- package/browser/driver/mysql/MysqlConnectionOptions.js.map +1 -1
- package/browser/driver/mysql/MysqlDriver.js +4 -2
- package/browser/driver/mysql/MysqlDriver.js.map +1 -1
- package/browser/driver/mysql/MysqlQueryRunner.js +24 -54
- package/browser/driver/mysql/MysqlQueryRunner.js.map +1 -1
- package/browser/driver/nativescript/NativescriptQueryRunner.js +45 -37
- package/browser/driver/nativescript/NativescriptQueryRunner.js.map +1 -1
- package/browser/driver/oracle/OracleConnectionOptions.d.ts +5 -0
- package/browser/driver/oracle/OracleConnectionOptions.js.map +1 -1
- package/browser/driver/oracle/OracleDriver.js +5 -4
- package/browser/driver/oracle/OracleDriver.js.map +1 -1
- package/browser/driver/oracle/OracleQueryRunner.js +20 -48
- package/browser/driver/oracle/OracleQueryRunner.js.map +1 -1
- package/browser/driver/postgres/PostgresConnectionOptions.d.ts +10 -0
- package/browser/driver/postgres/PostgresConnectionOptions.js.map +1 -1
- package/browser/driver/postgres/PostgresDriver.d.ts +2 -2
- package/browser/driver/postgres/PostgresDriver.js +37 -45
- package/browser/driver/postgres/PostgresDriver.js.map +1 -1
- package/browser/driver/postgres/PostgresQueryRunner.js +28 -66
- package/browser/driver/postgres/PostgresQueryRunner.js.map +1 -1
- package/browser/driver/react-native/ReactNativeConnectionOptions.d.ts +5 -0
- package/browser/driver/react-native/ReactNativeConnectionOptions.js.map +1 -1
- package/browser/driver/react-native/ReactNativeDriver.js +2 -1
- package/browser/driver/react-native/ReactNativeDriver.js.map +1 -1
- package/browser/driver/sap/SapConnectionOptions.d.ts +16 -6
- package/browser/driver/sap/SapConnectionOptions.js.map +1 -1
- package/browser/driver/sap/SapDriver.js +6 -3
- package/browser/driver/sap/SapDriver.js.map +1 -1
- package/browser/driver/sap/SapQueryRunner.js +30 -78
- package/browser/driver/sap/SapQueryRunner.js.map +1 -1
- package/browser/driver/sqlite/SqliteConnectionOptions.d.ts +5 -0
- package/browser/driver/sqlite/SqliteConnectionOptions.js.map +1 -1
- package/browser/driver/sqlite/SqliteDriver.js +4 -3
- package/browser/driver/sqlite/SqliteDriver.js.map +1 -1
- package/browser/driver/sqlite/SqliteQueryRunner.js +16 -8
- package/browser/driver/sqlite/SqliteQueryRunner.js.map +1 -1
- package/browser/driver/sqlite-abstract/AbstractSqliteQueryRunner.js +19 -49
- package/browser/driver/sqlite-abstract/AbstractSqliteQueryRunner.js.map +1 -1
- package/browser/driver/sqljs/SqljsConnectionOptions.d.ts +5 -0
- package/browser/driver/sqljs/SqljsConnectionOptions.js.map +1 -1
- package/browser/driver/sqljs/SqljsDriver.js +9 -24
- package/browser/driver/sqljs/SqljsDriver.js.map +1 -1
- package/browser/driver/sqljs/SqljsQueryRunner.js +9 -10
- package/browser/driver/sqljs/SqljsQueryRunner.js.map +1 -1
- package/browser/driver/sqlserver/SqlServerConnectionOptions.d.ts +5 -0
- package/browser/driver/sqlserver/SqlServerConnectionOptions.js.map +1 -1
- package/browser/driver/sqlserver/SqlServerDriver.js +7 -6
- package/browser/driver/sqlserver/SqlServerDriver.js.map +1 -1
- package/browser/driver/sqlserver/SqlServerQueryRunner.js +84 -116
- package/browser/driver/sqlserver/SqlServerQueryRunner.js.map +1 -1
- package/browser/entity-manager/MongoEntityManager.js +8 -13
- package/browser/entity-manager/MongoEntityManager.js.map +1 -1
- package/browser/find-options/FindOptionsUtils.js +1 -1
- package/browser/find-options/FindOptionsUtils.js.map +1 -1
- package/browser/metadata/ColumnMetadata.js +4 -4
- package/browser/metadata/ColumnMetadata.js.map +1 -1
- package/browser/metadata/EmbeddedMetadata.js +1 -1
- package/browser/metadata/EmbeddedMetadata.js.map +1 -1
- package/browser/metadata/EntityMetadata.d.ts +5 -0
- package/browser/metadata/EntityMetadata.js +2 -1
- package/browser/metadata/EntityMetadata.js.map +1 -1
- package/browser/metadata/RelationMetadata.js +4 -4
- package/browser/metadata/RelationMetadata.js.map +1 -1
- package/browser/metadata-args/TableMetadataArgs.d.ts +4 -0
- package/browser/metadata-args/TableMetadataArgs.js.map +1 -1
- package/browser/metadata-builder/EntityMetadataBuilder.js +5 -5
- package/browser/metadata-builder/EntityMetadataBuilder.js.map +1 -1
- package/browser/metadata-builder/JunctionEntityMetadataBuilder.js +1 -1
- package/browser/metadata-builder/JunctionEntityMetadataBuilder.js.map +1 -1
- package/browser/migration/MigrationExecutor.d.ts +1 -1
- package/browser/migration/MigrationExecutor.js +6 -14
- package/browser/migration/MigrationExecutor.js.map +1 -1
- package/browser/naming-strategy/DefaultNamingStrategy.js +5 -5
- package/browser/naming-strategy/DefaultNamingStrategy.js.map +1 -1
- package/browser/persistence/Subject.js +1 -1
- package/browser/persistence/Subject.js.map +1 -1
- package/browser/persistence/SubjectDatabaseEntityLoader.js +1 -1
- package/browser/persistence/SubjectDatabaseEntityLoader.js.map +1 -1
- package/browser/persistence/SubjectExecutor.js +4 -4
- package/browser/persistence/SubjectExecutor.js.map +1 -1
- package/browser/persistence/SubjectTopoligicalSorter.js +5 -5
- package/browser/persistence/SubjectTopoligicalSorter.js.map +1 -1
- package/browser/persistence/tree/ClosureSubjectExecutor.js +4 -4
- package/browser/persistence/tree/ClosureSubjectExecutor.js.map +1 -1
- package/browser/query-builder/DeleteQueryBuilder.js +3 -10
- package/browser/query-builder/DeleteQueryBuilder.js.map +1 -1
- package/browser/query-builder/InsertQueryBuilder.js +4 -6
- package/browser/query-builder/InsertQueryBuilder.js.map +1 -1
- package/browser/query-builder/QueryBuilder.js +9 -9
- package/browser/query-builder/QueryBuilder.js.map +1 -1
- package/browser/query-builder/RelationLoader.js +2 -2
- package/browser/query-builder/RelationLoader.js.map +1 -1
- package/browser/query-builder/RelationRemover.js +6 -6
- package/browser/query-builder/RelationRemover.js.map +1 -1
- package/browser/query-builder/SelectQueryBuilder.js +14 -14
- package/browser/query-builder/SelectQueryBuilder.js.map +1 -1
- package/browser/query-builder/SoftDeleteQueryBuilder.js +3 -10
- package/browser/query-builder/SoftDeleteQueryBuilder.js.map +1 -1
- package/browser/query-builder/UpdateQueryBuilder.js +5 -12
- package/browser/query-builder/UpdateQueryBuilder.js.map +1 -1
- package/browser/query-builder/relation-id/RelationIdLoader.js +1 -1
- package/browser/query-builder/relation-id/RelationIdLoader.js.map +1 -1
- package/browser/query-builder/transformer/RawSqlResultsToEntityTransformer.js +4 -10
- package/browser/query-builder/transformer/RawSqlResultsToEntityTransformer.js.map +1 -1
- package/browser/query-runner/BaseQueryRunner.d.ts +2 -1
- package/browser/query-runner/BaseQueryRunner.js +49 -27
- package/browser/query-runner/BaseQueryRunner.js.map +1 -1
- package/browser/query-runner/QueryLock.js +1 -1
- package/browser/query-runner/QueryLock.js.map +1 -1
- package/browser/repository/BaseEntity.js +1 -1
- package/browser/repository/BaseEntity.js.map +1 -1
- package/browser/repository/Repository.js +1 -1
- package/browser/repository/Repository.js.map +1 -1
- package/browser/repository/TreeRepository.js +2 -2
- package/browser/repository/TreeRepository.js.map +1 -1
- package/browser/schema-builder/RdbmsSchemaBuilder.d.ts +2 -0
- package/browser/schema-builder/RdbmsSchemaBuilder.js +248 -190
- package/browser/schema-builder/RdbmsSchemaBuilder.js.map +1 -1
- package/browser/schema-builder/table/TableCheck.js +1 -1
- package/browser/schema-builder/table/TableCheck.js.map +1 -1
- package/browser/schema-builder/table/TableForeignKey.js +2 -2
- package/browser/schema-builder/table/TableForeignKey.js.map +1 -1
- package/browser/schema-builder/table/TableIndex.js +1 -1
- package/browser/schema-builder/table/TableIndex.js.map +1 -1
- package/browser/schema-builder/table/TableUnique.js +1 -1
- package/browser/schema-builder/table/TableUnique.js.map +1 -1
- package/browser/schema-builder/util/ViewUtils.d.ts +7 -0
- package/browser/schema-builder/util/ViewUtils.js +25 -0
- package/browser/schema-builder/util/ViewUtils.js.map +1 -0
- package/browser/subscriber/Broadcaster.d.ts +23 -2
- package/browser/subscriber/Broadcaster.js +35 -2
- package/browser/subscriber/Broadcaster.js.map +1 -1
- package/browser/subscriber/BroadcasterResult.d.ts +4 -0
- package/browser/subscriber/BroadcasterResult.js +19 -0
- package/browser/subscriber/BroadcasterResult.js.map +1 -1
- package/browser/util/StringUtils.js +1 -1
- package/browser/util/StringUtils.js.map +1 -1
- package/cache/DbQueryResultCache.js +12 -12
- package/cache/RedisQueryResultCache.js +12 -12
- package/cli.js +1 -6
- package/cli.js.map +1 -1
- package/commands/CacheClearCommand.js +4 -4
- package/commands/CacheClearCommand.js.map +1 -1
- package/commands/CommandUtils.js +10 -10
- package/commands/CommandUtils.js.map +1 -1
- package/commands/EntityCreateCommand.js +3 -3
- package/commands/EntityCreateCommand.js.map +1 -1
- package/commands/InitCommand.js +5 -5
- package/commands/InitCommand.js.map +1 -1
- package/commands/MigrationCreateCommand.js +5 -5
- package/commands/MigrationCreateCommand.js.map +1 -1
- package/commands/MigrationGenerateCommand.js +7 -7
- package/commands/MigrationGenerateCommand.js.map +1 -1
- package/commands/MigrationRevertCommand.js +4 -4
- package/commands/MigrationRevertCommand.js.map +1 -1
- package/commands/MigrationRunCommand.js +5 -5
- package/commands/MigrationRunCommand.js.map +1 -1
- package/commands/MigrationShowCommand.js +5 -5
- package/commands/MigrationShowCommand.js.map +1 -1
- package/commands/QueryCommand.js +4 -4
- package/commands/QueryCommand.js.map +1 -1
- package/commands/SchemaDropCommand.js +4 -4
- package/commands/SchemaDropCommand.js.map +1 -1
- package/commands/SchemaLogCommand.js +7 -7
- package/commands/SchemaLogCommand.js.map +1 -1
- package/commands/SchemaSyncCommand.js +5 -5
- package/commands/SchemaSyncCommand.js.map +1 -1
- package/commands/SubscriberCreateCommand.js +3 -3
- package/commands/SubscriberCreateCommand.js.map +1 -1
- package/commands/VersionCommand.js +3 -3
- package/commands/VersionCommand.js.map +1 -1
- package/connection/Connection.js +19 -19
- package/connection/Connection.js.map +1 -1
- package/connection/ConnectionMetadataBuilder.js +11 -11
- package/connection/ConnectionMetadataBuilder.js.map +1 -1
- package/connection/ConnectionOptionsReader.js +11 -10
- package/connection/ConnectionOptionsReader.js.map +1 -1
- package/connection/options-reader/ConnectionOptionsEnvReader.js +2 -2
- package/connection/options-reader/ConnectionOptionsXmlReader.js +3 -3
- package/connection/options-reader/ConnectionOptionsXmlReader.js.map +1 -1
- package/connection/options-reader/ConnectionOptionsYmlReader.js +4 -4
- package/connection/options-reader/ConnectionOptionsYmlReader.js.map +1 -1
- package/decorator/Check.js +1 -1
- package/decorator/Check.js.map +1 -1
- package/decorator/EntityRepository.js +1 -1
- package/decorator/EntityRepository.js.map +1 -1
- package/decorator/Exclusion.js +1 -1
- package/decorator/Exclusion.js.map +1 -1
- package/decorator/Generated.js +1 -1
- package/decorator/Generated.js.map +1 -1
- package/decorator/Index.js +1 -1
- package/decorator/Index.js.map +1 -1
- package/decorator/Unique.js +1 -1
- package/decorator/Unique.js.map +1 -1
- package/decorator/columns/Column.js +4 -4
- package/decorator/columns/Column.js.map +1 -1
- package/decorator/columns/CreateDateColumn.js +1 -1
- package/decorator/columns/CreateDateColumn.js.map +1 -1
- package/decorator/columns/DeleteDateColumn.js +1 -1
- package/decorator/columns/DeleteDateColumn.js.map +1 -1
- package/decorator/columns/ObjectIdColumn.js +1 -1
- package/decorator/columns/ObjectIdColumn.js.map +1 -1
- package/decorator/columns/PrimaryColumn.js +2 -2
- package/decorator/columns/PrimaryColumn.js.map +1 -1
- package/decorator/columns/PrimaryGeneratedColumn.js +2 -2
- package/decorator/columns/PrimaryGeneratedColumn.js.map +1 -1
- package/decorator/columns/UpdateDateColumn.js +1 -1
- package/decorator/columns/UpdateDateColumn.js.map +1 -1
- package/decorator/columns/VersionColumn.js +1 -1
- package/decorator/columns/VersionColumn.js.map +1 -1
- package/decorator/columns/ViewColumn.js +1 -1
- package/decorator/columns/ViewColumn.js.map +1 -1
- package/decorator/entity/ChildEntity.js +2 -2
- package/decorator/entity/ChildEntity.js.map +1 -1
- package/decorator/entity/Entity.js +1 -1
- package/decorator/entity/Entity.js.map +1 -1
- package/decorator/entity/TableInheritance.js +1 -1
- package/decorator/entity/TableInheritance.js.map +1 -1
- package/decorator/entity-view/ViewEntity.js +2 -1
- package/decorator/entity-view/ViewEntity.js.map +1 -1
- package/decorator/listeners/AfterInsert.js +1 -1
- package/decorator/listeners/AfterInsert.js.map +1 -1
- package/decorator/listeners/AfterLoad.js +1 -1
- package/decorator/listeners/AfterLoad.js.map +1 -1
- package/decorator/listeners/AfterRemove.js +1 -1
- package/decorator/listeners/AfterRemove.js.map +1 -1
- package/decorator/listeners/AfterUpdate.js +1 -1
- package/decorator/listeners/AfterUpdate.js.map +1 -1
- package/decorator/listeners/BeforeInsert.js +1 -1
- package/decorator/listeners/BeforeInsert.js.map +1 -1
- package/decorator/listeners/BeforeRemove.js +1 -1
- package/decorator/listeners/BeforeRemove.js.map +1 -1
- package/decorator/listeners/BeforeUpdate.js +1 -1
- package/decorator/listeners/BeforeUpdate.js.map +1 -1
- package/decorator/listeners/EventSubscriber.js +1 -1
- package/decorator/listeners/EventSubscriber.js.map +1 -1
- package/decorator/options/ViewEntityOptions.d.ts +5 -0
- package/decorator/options/ViewEntityOptions.js.map +1 -1
- package/decorator/relations/JoinColumn.js +1 -1
- package/decorator/relations/JoinColumn.js.map +1 -1
- package/decorator/relations/JoinTable.js +1 -1
- package/decorator/relations/JoinTable.js.map +1 -1
- package/decorator/relations/ManyToMany.js +1 -1
- package/decorator/relations/ManyToMany.js.map +1 -1
- package/decorator/relations/ManyToOne.js +1 -1
- package/decorator/relations/ManyToOne.js.map +1 -1
- package/decorator/relations/OneToMany.js +1 -1
- package/decorator/relations/OneToMany.js.map +1 -1
- package/decorator/relations/OneToOne.js +1 -1
- package/decorator/relations/OneToOne.js.map +1 -1
- package/decorator/relations/RelationCount.js +1 -1
- package/decorator/relations/RelationCount.js.map +1 -1
- package/decorator/relations/RelationId.js +1 -1
- package/decorator/relations/RelationId.js.map +1 -1
- package/decorator/transaction/Transaction.js +7 -7
- package/decorator/transaction/Transaction.js.map +1 -1
- package/decorator/transaction/TransactionManager.js +1 -1
- package/decorator/transaction/TransactionManager.js.map +1 -1
- package/decorator/transaction/TransactionRepository.js +1 -1
- package/decorator/transaction/TransactionRepository.js.map +1 -1
- package/decorator/tree/Tree.js +1 -1
- package/decorator/tree/Tree.js.map +1 -1
- package/decorator/tree/TreeChildren.js +1 -1
- package/decorator/tree/TreeChildren.js.map +1 -1
- package/decorator/tree/TreeLevelColumn.js +1 -1
- package/decorator/tree/TreeLevelColumn.js.map +1 -1
- package/decorator/tree/TreeParent.js +1 -1
- package/decorator/tree/TreeParent.js.map +1 -1
- package/driver/DriverUtils.js +9 -9
- package/driver/DriverUtils.js.map +1 -1
- package/driver/aurora-data-api/AuroraDataApiConnection.js +1 -1
- package/driver/aurora-data-api/AuroraDataApiConnection.js.map +1 -1
- package/driver/aurora-data-api/AuroraDataApiConnectionOptions.d.ts +5 -0
- package/driver/aurora-data-api/AuroraDataApiConnectionOptions.js.map +1 -1
- package/driver/aurora-data-api/AuroraDataApiDriver.js +12 -11
- package/driver/aurora-data-api/AuroraDataApiDriver.js.map +1 -1
- package/driver/aurora-data-api/AuroraDataApiQueryRunner.js +146 -175
- package/driver/aurora-data-api/AuroraDataApiQueryRunner.js.map +1 -1
- package/driver/aurora-data-api-pg/AuroraDataApiPostgresConnectionOptions.d.ts +5 -0
- package/driver/aurora-data-api-pg/AuroraDataApiPostgresConnectionOptions.js.map +1 -1
- package/driver/aurora-data-api-pg/AuroraDataApiPostgresDriver.js +10 -9
- package/driver/aurora-data-api-pg/AuroraDataApiPostgresDriver.js.map +1 -1
- package/driver/aurora-data-api-pg/AuroraDataApiPostgresQueryRunner.js +29 -58
- package/driver/aurora-data-api-pg/AuroraDataApiPostgresQueryRunner.js.map +1 -1
- package/driver/better-sqlite3/BetterSqlite3ConnectionOptions.d.ts +5 -0
- package/driver/better-sqlite3/BetterSqlite3ConnectionOptions.js.map +1 -1
- package/driver/better-sqlite3/BetterSqlite3Driver.js +12 -11
- package/driver/better-sqlite3/BetterSqlite3Driver.js.map +1 -1
- package/driver/better-sqlite3/BetterSqlite3QueryRunner.js +5 -5
- package/driver/better-sqlite3/BetterSqlite3QueryRunner.js.map +1 -1
- package/driver/capacitor/CapacitorDriver.js +7 -7
- package/driver/capacitor/CapacitorDriver.js.map +1 -1
- package/driver/capacitor/CapacitorQueryRunner.js +5 -5
- package/driver/capacitor/CapacitorQueryRunner.js.map +1 -1
- package/driver/cockroachdb/CockroachConnectionOptions.d.ts +10 -0
- package/driver/cockroachdb/CockroachConnectionOptions.js.map +1 -1
- package/driver/cockroachdb/CockroachDriver.js +38 -28
- package/driver/cockroachdb/CockroachDriver.js.map +1 -1
- package/driver/cockroachdb/CockroachQueryRunner.js +240 -277
- package/driver/cockroachdb/CockroachQueryRunner.js.map +1 -1
- package/driver/cordova/CordovaConnectionOptions.d.ts +5 -0
- package/driver/cordova/CordovaConnectionOptions.js.map +1 -1
- package/driver/cordova/CordovaDriver.d.ts +1 -1
- package/driver/cordova/CordovaDriver.js +30 -22
- package/driver/cordova/CordovaDriver.js.map +1 -1
- package/driver/cordova/CordovaQueryRunner.js +61 -54
- package/driver/cordova/CordovaQueryRunner.js.map +1 -1
- package/driver/expo/ExpoDriver.js +3 -3
- package/driver/expo/ExpoDriver.js.map +1 -1
- package/driver/expo/ExpoQueryRunner.js +23 -54
- package/driver/expo/ExpoQueryRunner.js.map +1 -1
- package/driver/mongodb/MongoConnectionOptions.d.ts +5 -0
- package/driver/mongodb/MongoConnectionOptions.js.map +1 -1
- package/driver/mongodb/MongoDriver.js +4 -3
- package/driver/mongodb/MongoDriver.js.map +1 -1
- package/driver/mongodb/MongoQueryRunner.js +178 -178
- package/driver/mysql/MysqlConnectionOptions.d.ts +6 -0
- package/driver/mysql/MysqlConnectionOptions.js.map +1 -1
- package/driver/mysql/MysqlDriver.js +9 -7
- package/driver/mysql/MysqlDriver.js.map +1 -1
- package/driver/mysql/MysqlQueryRunner.js +152 -182
- package/driver/mysql/MysqlQueryRunner.js.map +1 -1
- package/driver/nativescript/NativescriptDriver.js +3 -3
- package/driver/nativescript/NativescriptDriver.js.map +1 -1
- package/driver/nativescript/NativescriptQueryRunner.js +48 -40
- package/driver/nativescript/NativescriptQueryRunner.js.map +1 -1
- package/driver/oracle/OracleConnectionOptions.d.ts +5 -0
- package/driver/oracle/OracleConnectionOptions.js.map +1 -1
- package/driver/oracle/OracleDriver.js +13 -12
- package/driver/oracle/OracleDriver.js.map +1 -1
- package/driver/oracle/OracleQueryRunner.js +143 -171
- package/driver/oracle/OracleQueryRunner.js.map +1 -1
- package/driver/postgres/PostgresConnectionOptions.d.ts +10 -0
- package/driver/postgres/PostgresConnectionOptions.js.map +1 -1
- package/driver/postgres/PostgresDriver.d.ts +2 -2
- package/driver/postgres/PostgresDriver.js +52 -60
- package/driver/postgres/PostgresDriver.js.map +1 -1
- package/driver/postgres/PostgresQueryRunner.js +175 -213
- package/driver/postgres/PostgresQueryRunner.js.map +1 -1
- package/driver/react-native/ReactNativeConnectionOptions.d.ts +5 -0
- package/driver/react-native/ReactNativeConnectionOptions.js.map +1 -1
- package/driver/react-native/ReactNativeDriver.js +5 -4
- package/driver/react-native/ReactNativeDriver.js.map +1 -1
- package/driver/react-native/ReactNativeQueryRunner.js +3 -3
- package/driver/react-native/ReactNativeQueryRunner.js.map +1 -1
- package/driver/sap/SapConnectionOptions.d.ts +16 -6
- package/driver/sap/SapConnectionOptions.js.map +1 -1
- package/driver/sap/SapDriver.js +11 -8
- package/driver/sap/SapDriver.js.map +1 -1
- package/driver/sap/SapQueryRunner.js +159 -207
- package/driver/sap/SapQueryRunner.js.map +1 -1
- package/driver/sqlite/SqliteConnectionOptions.d.ts +5 -0
- package/driver/sqlite/SqliteConnectionOptions.js.map +1 -1
- package/driver/sqlite/SqliteDriver.js +12 -11
- package/driver/sqlite/SqliteDriver.js.map +1 -1
- package/driver/sqlite/SqliteQueryRunner.js +21 -13
- package/driver/sqlite/SqliteQueryRunner.js.map +1 -1
- package/driver/sqlite-abstract/AbstractSqliteDriver.js +4 -4
- package/driver/sqlite-abstract/AbstractSqliteQueryRunner.js +138 -168
- package/driver/sqlite-abstract/AbstractSqliteQueryRunner.js.map +1 -1
- package/driver/sqljs/SqljsConnectionOptions.d.ts +5 -0
- package/driver/sqljs/SqljsConnectionOptions.js.map +1 -1
- package/driver/sqljs/SqljsDriver.js +22 -37
- package/driver/sqljs/SqljsDriver.js.map +1 -1
- package/driver/sqljs/SqljsQueryRunner.js +17 -18
- package/driver/sqljs/SqljsQueryRunner.js.map +1 -1
- package/driver/sqlserver/SqlServerConnectionOptions.d.ts +5 -0
- package/driver/sqlserver/SqlServerConnectionOptions.js.map +1 -1
- package/driver/sqlserver/SqlServerDriver.js +13 -12
- package/driver/sqlserver/SqlServerDriver.js.map +1 -1
- package/driver/sqlserver/SqlServerQueryRunner.js +220 -252
- package/driver/sqlserver/SqlServerQueryRunner.js.map +1 -1
- package/entity-manager/EntityManager.js +30 -30
- package/entity-manager/EntityManager.js.map +1 -1
- package/entity-manager/MongoEntityManager.js +23 -28
- package/entity-manager/MongoEntityManager.js.map +1 -1
- package/entity-manager/SqljsEntityManager.js +5 -5
- package/entity-manager/SqljsEntityManager.js.map +1 -1
- package/entity-schema/EntitySchemaTransformer.js +1 -1
- package/entity-schema/EntitySchemaTransformer.js.map +1 -1
- package/error/AlreadyHasActiveConnectionError.js +1 -1
- package/error/AlreadyHasActiveConnectionError.js.map +1 -1
- package/error/CannotAttachTreeChildrenEntityError.js +1 -1
- package/error/CannotAttachTreeChildrenEntityError.js.map +1 -1
- package/error/CannotConnectAlreadyConnectedError.js +1 -1
- package/error/CannotConnectAlreadyConnectedError.js.map +1 -1
- package/error/CannotCreateEntityIdMapError.js +1 -1
- package/error/CannotCreateEntityIdMapError.js.map +1 -1
- package/error/CannotDetermineEntityError.js +1 -1
- package/error/CannotDetermineEntityError.js.map +1 -1
- package/error/CannotExecuteNotConnectedError.js +1 -1
- package/error/CannotExecuteNotConnectedError.js.map +1 -1
- package/error/CannotGetEntityManagerNotConnectedError.js +1 -1
- package/error/CannotGetEntityManagerNotConnectedError.js.map +1 -1
- package/error/CannotReflectMethodParameterTypeError.js +1 -1
- package/error/CannotReflectMethodParameterTypeError.js.map +1 -1
- package/error/CircularRelationsError.js +1 -1
- package/error/CircularRelationsError.js.map +1 -1
- package/error/ColumnTypeUndefinedError.js +1 -1
- package/error/ColumnTypeUndefinedError.js.map +1 -1
- package/error/ConnectionIsNotSetError.js +1 -1
- package/error/ConnectionIsNotSetError.js.map +1 -1
- package/error/ConnectionNotFoundError.js +1 -1
- package/error/ConnectionNotFoundError.js.map +1 -1
- package/error/CustomRepositoryCannotInheritRepositoryError.js +1 -1
- package/error/CustomRepositoryCannotInheritRepositoryError.js.map +1 -1
- package/error/CustomRepositoryDoesNotHaveEntityError.js +1 -1
- package/error/CustomRepositoryDoesNotHaveEntityError.js.map +1 -1
- package/error/CustomRepositoryNotFoundError.js +1 -1
- package/error/CustomRepositoryNotFoundError.js.map +1 -1
- package/error/DataTypeNotSupportedError.js +1 -1
- package/error/DataTypeNotSupportedError.js.map +1 -1
- package/error/DriverOptionNotSetError.js +1 -1
- package/error/DriverOptionNotSetError.js.map +1 -1
- package/error/DriverPackageNotInstalledError.js +1 -1
- package/error/DriverPackageNotInstalledError.js.map +1 -1
- package/error/EntityColumnNotFound.js +1 -1
- package/error/EntityColumnNotFound.js.map +1 -1
- package/error/EntityMetadataNotFoundError.js +1 -1
- package/error/EntityMetadataNotFoundError.js.map +1 -1
- package/error/EntityNotFoundError.js +1 -1
- package/error/EntityNotFoundError.js.map +1 -1
- package/error/FindRelationsNotFoundError.js +1 -1
- package/error/FindRelationsNotFoundError.js.map +1 -1
- package/error/InitializedRelationError.js +1 -1
- package/error/InitializedRelationError.js.map +1 -1
- package/error/InsertValuesMissingError.js +1 -1
- package/error/InsertValuesMissingError.js.map +1 -1
- package/error/LimitOnUpdateNotSupportedError.js +1 -1
- package/error/LimitOnUpdateNotSupportedError.js.map +1 -1
- package/error/LockNotSupportedOnGivenDriverError.js +1 -1
- package/error/LockNotSupportedOnGivenDriverError.js.map +1 -1
- package/error/MetadataAlreadyExistsError.js +1 -1
- package/error/MetadataAlreadyExistsError.js.map +1 -1
- package/error/MetadataWithSuchNameAlreadyExistsError.js +1 -1
- package/error/MetadataWithSuchNameAlreadyExistsError.js.map +1 -1
- package/error/MissingDeleteDateColumnError.js +1 -1
- package/error/MissingDeleteDateColumnError.js.map +1 -1
- package/error/MissingDriverError.js +1 -1
- package/error/MissingDriverError.js.map +1 -1
- package/error/MissingJoinColumnError.js +1 -1
- package/error/MissingJoinColumnError.js.map +1 -1
- package/error/MissingJoinTableError.js +1 -1
- package/error/MissingJoinTableError.js.map +1 -1
- package/error/MissingPrimaryColumnError.js +1 -1
- package/error/MissingPrimaryColumnError.js.map +1 -1
- package/error/MustBeEntityError.js +1 -1
- package/error/MustBeEntityError.js.map +1 -1
- package/error/NamingStrategyNotFoundError.js +1 -1
- package/error/NamingStrategyNotFoundError.js.map +1 -1
- package/error/NestedSetMultipleRootError.js +1 -1
- package/error/NestedSetMultipleRootError.js.map +1 -1
- package/error/NoConnectionForRepositoryError.js +1 -1
- package/error/NoConnectionForRepositoryError.js.map +1 -1
- package/error/NoConnectionOptionError.js +1 -1
- package/error/NoConnectionOptionError.js.map +1 -1
- package/error/NoNeedToReleaseEntityManagerError.js +1 -1
- package/error/NoNeedToReleaseEntityManagerError.js.map +1 -1
- package/error/NoVersionOrUpdateDateColumnError.js +1 -1
- package/error/NoVersionOrUpdateDateColumnError.js.map +1 -1
- package/error/OffsetWithoutLimitNotSupportedError.js +1 -1
- package/error/OffsetWithoutLimitNotSupportedError.js.map +1 -1
- package/error/OptimisticLockCanNotBeUsedError.js +1 -1
- package/error/OptimisticLockCanNotBeUsedError.js.map +1 -1
- package/error/OptimisticLockVersionMismatchError.js +1 -1
- package/error/OptimisticLockVersionMismatchError.js.map +1 -1
- package/error/PersistedEntityNotFoundError.js +1 -1
- package/error/PersistedEntityNotFoundError.js.map +1 -1
- package/error/PessimisticLockTransactionRequiredError.js +1 -1
- package/error/PessimisticLockTransactionRequiredError.js.map +1 -1
- package/error/PrimaryColumnCannotBeNullableError.js +1 -1
- package/error/PrimaryColumnCannotBeNullableError.js.map +1 -1
- package/error/QueryFailedError.js +3 -3
- package/error/QueryFailedError.js.map +1 -1
- package/error/QueryRunnerAlreadyReleasedError.js +1 -1
- package/error/QueryRunnerAlreadyReleasedError.js.map +1 -1
- package/error/QueryRunnerProviderAlreadyReleasedError.js +1 -1
- package/error/QueryRunnerProviderAlreadyReleasedError.js.map +1 -1
- package/error/RepositoryNotFoundError.js +1 -1
- package/error/RepositoryNotFoundError.js.map +1 -1
- package/error/RepositoryNotTreeError.js +1 -1
- package/error/RepositoryNotTreeError.js.map +1 -1
- package/error/ReturningStatementNotSupportedError.js +1 -1
- package/error/ReturningStatementNotSupportedError.js.map +1 -1
- package/error/SubjectRemovedAndUpdatedError.js +1 -1
- package/error/SubjectRemovedAndUpdatedError.js.map +1 -1
- package/error/SubjectWithoutIdentifierError.js +1 -1
- package/error/SubjectWithoutIdentifierError.js.map +1 -1
- package/error/TransactionAlreadyStartedError.js +1 -1
- package/error/TransactionAlreadyStartedError.js.map +1 -1
- package/error/TransactionNotStartedError.js +1 -1
- package/error/TransactionNotStartedError.js.map +1 -1
- package/error/TreeRepositoryNotSupportedError.js +1 -1
- package/error/TreeRepositoryNotSupportedError.js.map +1 -1
- package/error/TypeORMError.js +1 -1
- package/error/TypeORMError.js.map +1 -1
- package/error/UpdateValuesMissingError.js +1 -1
- package/error/UpdateValuesMissingError.js.map +1 -1
- package/error/UsingJoinColumnIsNotAllowedError.js +1 -1
- package/error/UsingJoinColumnIsNotAllowedError.js.map +1 -1
- package/error/UsingJoinColumnOnlyOnOneSideAllowedError.js +1 -1
- package/error/UsingJoinColumnOnlyOnOneSideAllowedError.js.map +1 -1
- package/error/UsingJoinTableIsNotAllowedError.js +1 -1
- package/error/UsingJoinTableIsNotAllowedError.js.map +1 -1
- package/error/UsingJoinTableOnlyOnOneSideAllowedError.js +1 -1
- package/error/UsingJoinTableOnlyOnOneSideAllowedError.js.map +1 -1
- package/error/index.js +62 -62
- package/error/index.js.map +1 -1
- package/find-options/FindOptionsUtils.js +4 -4
- package/find-options/FindOptionsUtils.js.map +1 -1
- package/globals.js +7 -7
- package/globals.js.map +1 -1
- package/index.js +102 -102
- package/index.js.map +1 -1
- package/logger/DebugLogger.js +9 -9
- package/logger/DebugLogger.js.map +1 -1
- package/logger/FileLogger.js +1 -1
- package/logger/FileLogger.js.map +1 -1
- package/metadata/ColumnMetadata.js +4 -4
- package/metadata/ColumnMetadata.js.map +1 -1
- package/metadata/EmbeddedMetadata.js +1 -1
- package/metadata/EmbeddedMetadata.js.map +1 -1
- package/metadata/EntityMetadata.d.ts +5 -0
- package/metadata/EntityMetadata.js +3 -2
- package/metadata/EntityMetadata.js.map +1 -1
- package/metadata/RelationMetadata.js +4 -4
- package/metadata/RelationMetadata.js.map +1 -1
- package/metadata-args/TableMetadataArgs.d.ts +4 -0
- package/metadata-args/TableMetadataArgs.js.map +1 -1
- package/metadata-builder/EntityMetadataBuilder.js +5 -5
- package/metadata-builder/EntityMetadataBuilder.js.map +1 -1
- package/metadata-builder/JunctionEntityMetadataBuilder.js +1 -1
- package/metadata-builder/JunctionEntityMetadataBuilder.js.map +1 -1
- package/migration/MigrationExecutor.d.ts +1 -1
- package/migration/MigrationExecutor.js +39 -47
- package/migration/MigrationExecutor.js.map +1 -1
- package/naming-strategy/DefaultNamingStrategy.js +10 -10
- package/naming-strategy/DefaultNamingStrategy.js.map +1 -1
- package/package.json +1 -1
- package/persistence/EntityPersistExecutor.js +5 -5
- package/persistence/EntityPersistExecutor.js.map +1 -1
- package/persistence/Subject.js +1 -1
- package/persistence/Subject.js.map +1 -1
- package/persistence/SubjectDatabaseEntityLoader.js +6 -6
- package/persistence/SubjectDatabaseEntityLoader.js.map +1 -1
- package/persistence/SubjectExecutor.js +33 -33
- package/persistence/SubjectExecutor.js.map +1 -1
- package/persistence/SubjectTopoligicalSorter.js +5 -5
- package/persistence/SubjectTopoligicalSorter.js.map +1 -1
- package/persistence/subject-builder/CascadesSubjectBuilder.js +1 -1
- package/persistence/subject-builder/CascadesSubjectBuilder.js.map +1 -1
- package/persistence/tree/ClosureSubjectExecutor.js +13 -13
- package/persistence/tree/ClosureSubjectExecutor.js.map +1 -1
- package/persistence/tree/MaterializedPathSubjectExecutor.js +5 -5
- package/persistence/tree/MaterializedPathSubjectExecutor.js.map +1 -1
- package/persistence/tree/NestedSetSubjectExecutor.js +14 -14
- package/persistence/tree/NestedSetSubjectExecutor.js.map +1 -1
- package/platform/PlatformTools.js +8 -8
- package/platform/PlatformTools.js.map +1 -1
- package/query-builder/DeleteQueryBuilder.js +7 -14
- package/query-builder/DeleteQueryBuilder.js.map +1 -1
- package/query-builder/InsertQueryBuilder.js +9 -11
- package/query-builder/InsertQueryBuilder.js.map +1 -1
- package/query-builder/JoinAttribute.js +1 -1
- package/query-builder/JoinAttribute.js.map +1 -1
- package/query-builder/QueryBuilder.js +37 -37
- package/query-builder/QueryBuilder.js.map +1 -1
- package/query-builder/QueryBuilderUtils.js +1 -1
- package/query-builder/QueryBuilderUtils.js.map +1 -1
- package/query-builder/QueryExpressionMap.js +3 -3
- package/query-builder/QueryExpressionMap.js.map +1 -1
- package/query-builder/RelationLoader.js +2 -2
- package/query-builder/RelationLoader.js.map +1 -1
- package/query-builder/RelationQueryBuilder.js +13 -13
- package/query-builder/RelationQueryBuilder.js.map +1 -1
- package/query-builder/RelationRemover.js +12 -12
- package/query-builder/RelationRemover.js.map +1 -1
- package/query-builder/RelationUpdater.js +2 -2
- package/query-builder/ReturningResultsEntityUpdator.js +6 -6
- package/query-builder/SelectQueryBuilder.js +43 -43
- package/query-builder/SelectQueryBuilder.js.map +1 -1
- package/query-builder/SoftDeleteQueryBuilder.js +7 -14
- package/query-builder/SoftDeleteQueryBuilder.js.map +1 -1
- package/query-builder/UpdateQueryBuilder.js +10 -17
- package/query-builder/UpdateQueryBuilder.js.map +1 -1
- package/query-builder/relation-count/RelationCountAttribute.js +2 -2
- package/query-builder/relation-count/RelationCountAttribute.js.map +1 -1
- package/query-builder/relation-count/RelationCountLoader.js +4 -4
- package/query-builder/relation-id/RelationIdAttribute.js +1 -1
- package/query-builder/relation-id/RelationIdAttribute.js.map +1 -1
- package/query-builder/relation-id/RelationIdLoader.js +5 -5
- package/query-builder/relation-id/RelationIdLoader.js.map +1 -1
- package/query-builder/transformer/PlainObjectToDatabaseEntityTransformer.js +3 -3
- package/query-builder/transformer/PlainObjectToDatabaseEntityTransformer.js.map +1 -1
- package/query-builder/transformer/RawSqlResultsToEntityTransformer.js +4 -10
- package/query-builder/transformer/RawSqlResultsToEntityTransformer.js.map +1 -1
- package/query-runner/BaseQueryRunner.d.ts +2 -1
- package/query-runner/BaseQueryRunner.js +70 -48
- package/query-runner/BaseQueryRunner.js.map +1 -1
- package/query-runner/QueryLock.js +3 -3
- package/query-runner/QueryLock.js.map +1 -1
- package/repository/AbstractRepository.js +1 -1
- package/repository/AbstractRepository.js.map +1 -1
- package/repository/BaseEntity.js +4 -4
- package/repository/BaseEntity.js.map +1 -1
- package/repository/MongoRepository.js +1 -1
- package/repository/MongoRepository.js.map +1 -1
- package/repository/Repository.js +1 -1
- package/repository/Repository.js.map +1 -1
- package/repository/TreeRepository.js +7 -7
- package/repository/TreeRepository.js.map +1 -1
- package/schema-builder/MongoSchemaBuilder.js +2 -2
- package/schema-builder/RdbmsSchemaBuilder.d.ts +2 -0
- package/schema-builder/RdbmsSchemaBuilder.js +335 -277
- package/schema-builder/RdbmsSchemaBuilder.js.map +1 -1
- package/schema-builder/table/Table.js +1 -1
- package/schema-builder/table/Table.js.map +1 -1
- package/schema-builder/table/TableCheck.js +1 -1
- package/schema-builder/table/TableCheck.js.map +1 -1
- package/schema-builder/table/TableForeignKey.js +2 -2
- package/schema-builder/table/TableForeignKey.js.map +1 -1
- package/schema-builder/table/TableIndex.js +1 -1
- package/schema-builder/table/TableIndex.js.map +1 -1
- package/schema-builder/table/TableUnique.js +1 -1
- package/schema-builder/table/TableUnique.js.map +1 -1
- package/schema-builder/util/ViewUtils.d.ts +7 -0
- package/schema-builder/util/ViewUtils.js +28 -0
- package/schema-builder/util/ViewUtils.js.map +1 -0
- package/subscriber/Broadcaster.d.ts +23 -2
- package/subscriber/Broadcaster.js +35 -2
- package/subscriber/Broadcaster.js.map +1 -1
- package/subscriber/BroadcasterResult.d.ts +4 -0
- package/subscriber/BroadcasterResult.js +19 -0
- package/subscriber/BroadcasterResult.js.map +1 -1
- package/util/DateUtils.js +1 -1
- package/util/DateUtils.js.map +1 -1
- package/util/DirectoryExportedClassesLoader.js +1 -1
- package/util/DirectoryExportedClassesLoader.js.map +1 -1
- package/util/ObjectUtils.js +2 -2
- package/util/ObjectUtils.js.map +1 -1
- package/util/OrmUtils.js +2 -2
- package/util/OrmUtils.js.map +1 -1
- package/util/StringUtils.js +3 -3
- package/util/StringUtils.js.map +1 -1
|
@@ -19,13 +19,12 @@ var BaseQueryRunner_1 = require("../../query-runner/BaseQueryRunner");
|
|
|
19
19
|
var OrmUtils_1 = require("../../util/OrmUtils");
|
|
20
20
|
var TableCheck_1 = require("../../schema-builder/table/TableCheck");
|
|
21
21
|
var TableExclusion_1 = require("../../schema-builder/table/TableExclusion");
|
|
22
|
-
var BroadcasterResult_1 = require("../../subscriber/BroadcasterResult");
|
|
23
22
|
var error_1 = require("../../error");
|
|
24
23
|
/**
|
|
25
24
|
* Runs queries on a single postgres database connection.
|
|
26
25
|
*/
|
|
27
26
|
var CockroachQueryRunner = /** @class */ (function (_super) {
|
|
28
|
-
tslib_1.__extends(CockroachQueryRunner, _super);
|
|
27
|
+
(0, tslib_1.__extends)(CockroachQueryRunner, _super);
|
|
29
28
|
// -------------------------------------------------------------------------
|
|
30
29
|
// Constructor
|
|
31
30
|
// -------------------------------------------------------------------------
|
|
@@ -60,7 +59,7 @@ var CockroachQueryRunner = /** @class */ (function (_super) {
|
|
|
60
59
|
return this.databaseConnectionPromise;
|
|
61
60
|
if (this.mode === "slave" && this.driver.isReplicated) {
|
|
62
61
|
this.databaseConnectionPromise = this.driver.obtainSlaveConnection().then(function (_a) {
|
|
63
|
-
var _b = tslib_1.__read(_a, 2), connection = _b[0], release = _b[1];
|
|
62
|
+
var _b = (0, tslib_1.__read)(_a, 2), connection = _b[0], release = _b[1];
|
|
64
63
|
_this.driver.connectedQueryRunners.push(_this);
|
|
65
64
|
_this.databaseConnection = connection;
|
|
66
65
|
_this.releaseCallback = release;
|
|
@@ -69,7 +68,7 @@ var CockroachQueryRunner = /** @class */ (function (_super) {
|
|
|
69
68
|
}
|
|
70
69
|
else { // master
|
|
71
70
|
this.databaseConnectionPromise = this.driver.obtainMasterConnection().then(function (_a) {
|
|
72
|
-
var _b = tslib_1.__read(_a, 2), connection = _b[0], release = _b[1];
|
|
71
|
+
var _b = (0, tslib_1.__read)(_a, 2), connection = _b[0], release = _b[1];
|
|
73
72
|
_this.driver.connectedQueryRunners.push(_this);
|
|
74
73
|
_this.databaseConnection = connection;
|
|
75
74
|
_this.releaseCallback = release;
|
|
@@ -95,43 +94,33 @@ var CockroachQueryRunner = /** @class */ (function (_super) {
|
|
|
95
94
|
* Starts transaction.
|
|
96
95
|
*/
|
|
97
96
|
CockroachQueryRunner.prototype.startTransaction = function (isolationLevel) {
|
|
98
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
99
|
-
|
|
100
|
-
return tslib_1.__generator(this, function (_a) {
|
|
97
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
98
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
101
99
|
switch (_a.label) {
|
|
102
100
|
case 0:
|
|
103
101
|
if (this.isTransactionActive)
|
|
104
102
|
throw new TransactionAlreadyStartedError_1.TransactionAlreadyStartedError();
|
|
105
|
-
|
|
106
|
-
this.broadcaster.broadcastBeforeTransactionStartEvent(beforeBroadcastResult);
|
|
107
|
-
if (!(beforeBroadcastResult.promises.length > 0)) return [3 /*break*/, 2];
|
|
108
|
-
return [4 /*yield*/, Promise.all(beforeBroadcastResult.promises)];
|
|
103
|
+
return [4 /*yield*/, this.broadcaster.broadcast('BeforeTransactionStart')];
|
|
109
104
|
case 1:
|
|
110
105
|
_a.sent();
|
|
111
|
-
_a.label = 2;
|
|
112
|
-
case 2:
|
|
113
106
|
this.isTransactionActive = true;
|
|
114
107
|
return [4 /*yield*/, this.query("START TRANSACTION")];
|
|
115
|
-
case
|
|
108
|
+
case 2:
|
|
116
109
|
_a.sent();
|
|
117
110
|
return [4 /*yield*/, this.query("SAVEPOINT cockroach_restart")];
|
|
118
|
-
case
|
|
111
|
+
case 3:
|
|
119
112
|
_a.sent();
|
|
120
|
-
if (!isolationLevel) return [3 /*break*/,
|
|
113
|
+
if (!isolationLevel) return [3 /*break*/, 5];
|
|
121
114
|
return [4 /*yield*/, this.query("SET TRANSACTION ISOLATION LEVEL " + isolationLevel)];
|
|
122
|
-
case
|
|
115
|
+
case 4:
|
|
123
116
|
_a.sent();
|
|
124
|
-
_a.label =
|
|
125
|
-
case
|
|
117
|
+
_a.label = 5;
|
|
118
|
+
case 5:
|
|
126
119
|
this.storeQueries = true;
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
if (!(afterBroadcastResult.promises.length > 0)) return [3 /*break*/, 8];
|
|
130
|
-
return [4 /*yield*/, Promise.all(afterBroadcastResult.promises)];
|
|
131
|
-
case 7:
|
|
120
|
+
return [4 /*yield*/, this.broadcaster.broadcast('AfterTransactionStart')];
|
|
121
|
+
case 6:
|
|
132
122
|
_a.sent();
|
|
133
|
-
|
|
134
|
-
case 8: return [2 /*return*/];
|
|
123
|
+
return [2 /*return*/];
|
|
135
124
|
}
|
|
136
125
|
});
|
|
137
126
|
});
|
|
@@ -141,81 +130,71 @@ var CockroachQueryRunner = /** @class */ (function (_super) {
|
|
|
141
130
|
* Error will be thrown if transaction was not started.
|
|
142
131
|
*/
|
|
143
132
|
CockroachQueryRunner.prototype.commitTransaction = function () {
|
|
144
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
145
|
-
var
|
|
133
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
134
|
+
var e_1, _a, _b, q, e_2_1;
|
|
146
135
|
var e_2, _c;
|
|
147
|
-
return tslib_1.__generator(this, function (_d) {
|
|
136
|
+
return (0, tslib_1.__generator)(this, function (_d) {
|
|
148
137
|
switch (_d.label) {
|
|
149
138
|
case 0:
|
|
150
139
|
if (!this.isTransactionActive)
|
|
151
140
|
throw new TransactionNotStartedError_1.TransactionNotStartedError();
|
|
152
|
-
|
|
153
|
-
this.broadcaster.broadcastBeforeTransactionCommitEvent(beforeBroadcastResult);
|
|
154
|
-
if (!(beforeBroadcastResult.promises.length > 0)) return [3 /*break*/, 2];
|
|
155
|
-
return [4 /*yield*/, Promise.all(beforeBroadcastResult.promises)];
|
|
141
|
+
return [4 /*yield*/, this.broadcaster.broadcast('BeforeTransactionCommit')];
|
|
156
142
|
case 1:
|
|
157
143
|
_d.sent();
|
|
144
|
+
this.storeQueries = false;
|
|
158
145
|
_d.label = 2;
|
|
159
146
|
case 2:
|
|
160
|
-
|
|
161
|
-
_d.label = 3;
|
|
162
|
-
case 3:
|
|
163
|
-
_d.trys.push([3, 6, , 18]);
|
|
147
|
+
_d.trys.push([2, 5, , 17]);
|
|
164
148
|
return [4 /*yield*/, this.query("RELEASE SAVEPOINT cockroach_restart")];
|
|
165
|
-
case
|
|
149
|
+
case 3:
|
|
166
150
|
_d.sent();
|
|
167
151
|
return [4 /*yield*/, this.query("COMMIT")];
|
|
168
|
-
case
|
|
152
|
+
case 4:
|
|
169
153
|
_d.sent();
|
|
170
154
|
this.queries = [];
|
|
171
155
|
this.isTransactionActive = false;
|
|
172
|
-
return [3 /*break*/,
|
|
173
|
-
case
|
|
156
|
+
return [3 /*break*/, 17];
|
|
157
|
+
case 5:
|
|
174
158
|
e_1 = _d.sent();
|
|
175
|
-
if (!(e_1.code === "40001")) return [3 /*break*/,
|
|
159
|
+
if (!(e_1.code === "40001")) return [3 /*break*/, 16];
|
|
176
160
|
return [4 /*yield*/, this.query("ROLLBACK TO SAVEPOINT cockroach_restart")];
|
|
177
|
-
case
|
|
161
|
+
case 6:
|
|
178
162
|
_d.sent();
|
|
163
|
+
_d.label = 7;
|
|
164
|
+
case 7:
|
|
165
|
+
_d.trys.push([7, 12, 13, 14]);
|
|
166
|
+
_a = (0, tslib_1.__values)(this.queries), _b = _a.next();
|
|
179
167
|
_d.label = 8;
|
|
180
168
|
case 8:
|
|
181
|
-
|
|
182
|
-
_a = tslib_1.__values(this.queries), _b = _a.next();
|
|
183
|
-
_d.label = 9;
|
|
184
|
-
case 9:
|
|
185
|
-
if (!!_b.done) return [3 /*break*/, 12];
|
|
169
|
+
if (!!_b.done) return [3 /*break*/, 11];
|
|
186
170
|
q = _b.value;
|
|
187
171
|
return [4 /*yield*/, this.query(q.query, q.parameters)];
|
|
188
|
-
case
|
|
172
|
+
case 9:
|
|
189
173
|
_d.sent();
|
|
190
|
-
_d.label =
|
|
191
|
-
case
|
|
174
|
+
_d.label = 10;
|
|
175
|
+
case 10:
|
|
192
176
|
_b = _a.next();
|
|
193
|
-
return [3 /*break*/,
|
|
194
|
-
case
|
|
195
|
-
case
|
|
177
|
+
return [3 /*break*/, 8];
|
|
178
|
+
case 11: return [3 /*break*/, 14];
|
|
179
|
+
case 12:
|
|
196
180
|
e_2_1 = _d.sent();
|
|
197
181
|
e_2 = { error: e_2_1 };
|
|
198
|
-
return [3 /*break*/,
|
|
199
|
-
case
|
|
182
|
+
return [3 /*break*/, 14];
|
|
183
|
+
case 13:
|
|
200
184
|
try {
|
|
201
185
|
if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
|
|
202
186
|
}
|
|
203
187
|
finally { if (e_2) throw e_2.error; }
|
|
204
188
|
return [7 /*endfinally*/];
|
|
205
|
-
case
|
|
206
|
-
case
|
|
189
|
+
case 14: return [4 /*yield*/, this.commitTransaction()];
|
|
190
|
+
case 15:
|
|
207
191
|
_d.sent();
|
|
208
|
-
_d.label =
|
|
209
|
-
case
|
|
192
|
+
_d.label = 16;
|
|
193
|
+
case 16: return [3 /*break*/, 17];
|
|
194
|
+
case 17: return [4 /*yield*/, this.broadcaster.broadcast('AfterTransactionCommit')];
|
|
210
195
|
case 18:
|
|
211
|
-
afterBroadcastResult = new BroadcasterResult_1.BroadcasterResult();
|
|
212
|
-
this.broadcaster.broadcastAfterTransactionCommitEvent(afterBroadcastResult);
|
|
213
|
-
if (!(afterBroadcastResult.promises.length > 0)) return [3 /*break*/, 20];
|
|
214
|
-
return [4 /*yield*/, Promise.all(afterBroadcastResult.promises)];
|
|
215
|
-
case 19:
|
|
216
196
|
_d.sent();
|
|
217
|
-
|
|
218
|
-
case 20: return [2 /*return*/];
|
|
197
|
+
return [2 /*return*/];
|
|
219
198
|
}
|
|
220
199
|
});
|
|
221
200
|
});
|
|
@@ -225,35 +204,25 @@ var CockroachQueryRunner = /** @class */ (function (_super) {
|
|
|
225
204
|
* Error will be thrown if transaction was not started.
|
|
226
205
|
*/
|
|
227
206
|
CockroachQueryRunner.prototype.rollbackTransaction = function () {
|
|
228
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
229
|
-
|
|
230
|
-
return tslib_1.__generator(this, function (_a) {
|
|
207
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
208
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
231
209
|
switch (_a.label) {
|
|
232
210
|
case 0:
|
|
233
211
|
if (!this.isTransactionActive)
|
|
234
212
|
throw new TransactionNotStartedError_1.TransactionNotStartedError();
|
|
235
|
-
|
|
236
|
-
this.broadcaster.broadcastBeforeTransactionRollbackEvent(beforeBroadcastResult);
|
|
237
|
-
if (!(beforeBroadcastResult.promises.length > 0)) return [3 /*break*/, 2];
|
|
238
|
-
return [4 /*yield*/, Promise.all(beforeBroadcastResult.promises)];
|
|
213
|
+
return [4 /*yield*/, this.broadcaster.broadcast('BeforeTransactionRollback')];
|
|
239
214
|
case 1:
|
|
240
215
|
_a.sent();
|
|
241
|
-
_a.label = 2;
|
|
242
|
-
case 2:
|
|
243
216
|
this.storeQueries = false;
|
|
244
217
|
return [4 /*yield*/, this.query("ROLLBACK")];
|
|
245
|
-
case
|
|
218
|
+
case 2:
|
|
246
219
|
_a.sent();
|
|
247
220
|
this.queries = [];
|
|
248
221
|
this.isTransactionActive = false;
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
if (!(afterBroadcastResult.promises.length > 0)) return [3 /*break*/, 5];
|
|
252
|
-
return [4 /*yield*/, Promise.all(afterBroadcastResult.promises)];
|
|
253
|
-
case 4:
|
|
222
|
+
return [4 /*yield*/, this.broadcaster.broadcast('AfterTransactionRollback')];
|
|
223
|
+
case 3:
|
|
254
224
|
_a.sent();
|
|
255
|
-
|
|
256
|
-
case 5: return [2 /*return*/];
|
|
225
|
+
return [2 /*return*/];
|
|
257
226
|
}
|
|
258
227
|
});
|
|
259
228
|
});
|
|
@@ -262,110 +231,104 @@ var CockroachQueryRunner = /** @class */ (function (_super) {
|
|
|
262
231
|
* Executes a given SQL query.
|
|
263
232
|
*/
|
|
264
233
|
CockroachQueryRunner.prototype.query = function (query, parameters, useStructuredResult) {
|
|
265
|
-
var _this = this;
|
|
266
234
|
if (useStructuredResult === void 0) { useStructuredResult = false; }
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
var databaseConnection, queryStartTime_1, err_1;
|
|
271
|
-
var _this = this;
|
|
272
|
-
return tslib_1.__generator(this, function (_a) {
|
|
235
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
236
|
+
var databaseConnection, queryStartTime, raw, maxQueryExecutionTime, queryEndTime, queryExecutionTime, result, err_1;
|
|
237
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
273
238
|
switch (_a.label) {
|
|
274
239
|
case 0:
|
|
275
|
-
|
|
240
|
+
if (this.isReleased)
|
|
241
|
+
throw new QueryRunnerAlreadyReleasedError_1.QueryRunnerAlreadyReleasedError();
|
|
276
242
|
return [4 /*yield*/, this.connect()];
|
|
277
243
|
case 1:
|
|
278
244
|
databaseConnection = _a.sent();
|
|
279
245
|
this.driver.connection.logger.logQuery(query, parameters, this);
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
var maxQueryExecutionTime = _this.driver.options.maxQueryExecutionTime;
|
|
286
|
-
var queryEndTime = +new Date();
|
|
287
|
-
var queryExecutionTime = queryEndTime - queryStartTime_1;
|
|
288
|
-
if (maxQueryExecutionTime && queryExecutionTime > maxQueryExecutionTime)
|
|
289
|
-
_this.driver.connection.logger.logQuerySlow(queryExecutionTime, query, parameters, _this);
|
|
290
|
-
if (err) {
|
|
291
|
-
if (err.code !== "40001")
|
|
292
|
-
_this.driver.connection.logger.logQueryError(err, query, parameters, _this);
|
|
293
|
-
fail(new QueryFailedError_1.QueryFailedError(query, parameters, err));
|
|
294
|
-
}
|
|
295
|
-
else {
|
|
296
|
-
var result = new QueryResult_1.QueryResult();
|
|
297
|
-
if (raw.hasOwnProperty('rowCount')) {
|
|
298
|
-
result.affected = raw.rowCount;
|
|
299
|
-
}
|
|
300
|
-
if (raw.hasOwnProperty('rows')) {
|
|
301
|
-
result.records = raw.rows;
|
|
302
|
-
}
|
|
303
|
-
switch (raw.command) {
|
|
304
|
-
case "DELETE":
|
|
305
|
-
// for DELETE query additionally return number of affected rows
|
|
306
|
-
result.raw = [raw.rows, raw.rowCount];
|
|
307
|
-
break;
|
|
308
|
-
default:
|
|
309
|
-
result.raw = raw.rows;
|
|
310
|
-
}
|
|
311
|
-
if (useStructuredResult) {
|
|
312
|
-
ok(result);
|
|
313
|
-
}
|
|
314
|
-
else {
|
|
315
|
-
ok(result.raw);
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
});
|
|
319
|
-
return [3 /*break*/, 3];
|
|
246
|
+
queryStartTime = +new Date();
|
|
247
|
+
if (this.isTransactionActive && this.storeQueries) {
|
|
248
|
+
this.queries.push({ query: query, parameters: parameters });
|
|
249
|
+
}
|
|
250
|
+
_a.label = 2;
|
|
320
251
|
case 2:
|
|
252
|
+
_a.trys.push([2, 4, , 5]);
|
|
253
|
+
return [4 /*yield*/, new Promise(function (ok, fail) {
|
|
254
|
+
databaseConnection.query(query, parameters, function (err, raw) { return err ? fail(err) : ok(raw); });
|
|
255
|
+
})];
|
|
256
|
+
case 3:
|
|
257
|
+
raw = _a.sent();
|
|
258
|
+
maxQueryExecutionTime = this.driver.options.maxQueryExecutionTime;
|
|
259
|
+
queryEndTime = +new Date();
|
|
260
|
+
queryExecutionTime = queryEndTime - queryStartTime;
|
|
261
|
+
if (maxQueryExecutionTime && queryExecutionTime > maxQueryExecutionTime) {
|
|
262
|
+
this.driver.connection.logger.logQuerySlow(queryExecutionTime, query, parameters, this);
|
|
263
|
+
}
|
|
264
|
+
result = new QueryResult_1.QueryResult();
|
|
265
|
+
if (raw.hasOwnProperty('rowCount')) {
|
|
266
|
+
result.affected = raw.rowCount;
|
|
267
|
+
}
|
|
268
|
+
if (raw.hasOwnProperty('rows')) {
|
|
269
|
+
result.records = raw.rows;
|
|
270
|
+
}
|
|
271
|
+
switch (raw.command) {
|
|
272
|
+
case "DELETE":
|
|
273
|
+
// for DELETE query additionally return number of affected rows
|
|
274
|
+
result.raw = [raw.rows, raw.rowCount];
|
|
275
|
+
break;
|
|
276
|
+
default:
|
|
277
|
+
result.raw = raw.rows;
|
|
278
|
+
}
|
|
279
|
+
if (useStructuredResult) {
|
|
280
|
+
return [2 /*return*/, result];
|
|
281
|
+
}
|
|
282
|
+
else {
|
|
283
|
+
return [2 /*return*/, result.raw];
|
|
284
|
+
}
|
|
285
|
+
return [3 /*break*/, 5];
|
|
286
|
+
case 4:
|
|
321
287
|
err_1 = _a.sent();
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
288
|
+
if (err_1.code !== "40001") {
|
|
289
|
+
this.driver.connection.logger.logQueryError(err_1, query, parameters, this);
|
|
290
|
+
}
|
|
291
|
+
throw new QueryFailedError_1.QueryFailedError(query, parameters, err_1);
|
|
292
|
+
case 5: return [2 /*return*/];
|
|
325
293
|
}
|
|
326
294
|
});
|
|
327
|
-
});
|
|
295
|
+
});
|
|
328
296
|
};
|
|
329
297
|
/**
|
|
330
298
|
* Returns raw data stream.
|
|
331
299
|
*/
|
|
332
300
|
CockroachQueryRunner.prototype.stream = function (query, parameters, onEnd, onError) {
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
throw new QueryRunnerAlreadyReleasedError_1.QueryRunnerAlreadyReleasedError();
|
|
337
|
-
return new Promise(function (ok, fail) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
338
|
-
var databaseConnection, stream, err_2;
|
|
339
|
-
return tslib_1.__generator(this, function (_a) {
|
|
301
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
302
|
+
var QueryStream, databaseConnection, stream;
|
|
303
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
340
304
|
switch (_a.label) {
|
|
341
305
|
case 0:
|
|
342
|
-
|
|
306
|
+
QueryStream = this.driver.loadStreamDependency();
|
|
307
|
+
if (this.isReleased) {
|
|
308
|
+
throw new QueryRunnerAlreadyReleasedError_1.QueryRunnerAlreadyReleasedError();
|
|
309
|
+
}
|
|
343
310
|
return [4 /*yield*/, this.connect()];
|
|
344
311
|
case 1:
|
|
345
312
|
databaseConnection = _a.sent();
|
|
346
313
|
this.driver.connection.logger.logQuery(query, parameters, this);
|
|
347
314
|
stream = databaseConnection.query(new QueryStream(query, parameters));
|
|
348
|
-
if (onEnd)
|
|
315
|
+
if (onEnd) {
|
|
349
316
|
stream.on("end", onEnd);
|
|
350
|
-
|
|
317
|
+
}
|
|
318
|
+
if (onError) {
|
|
351
319
|
stream.on("error", onError);
|
|
352
|
-
|
|
353
|
-
return [
|
|
354
|
-
case 2:
|
|
355
|
-
err_2 = _a.sent();
|
|
356
|
-
fail(err_2);
|
|
357
|
-
return [3 /*break*/, 3];
|
|
358
|
-
case 3: return [2 /*return*/];
|
|
320
|
+
}
|
|
321
|
+
return [2 /*return*/, stream];
|
|
359
322
|
}
|
|
360
323
|
});
|
|
361
|
-
});
|
|
324
|
+
});
|
|
362
325
|
};
|
|
363
326
|
/**
|
|
364
327
|
* Returns all available database names including system databases.
|
|
365
328
|
*/
|
|
366
329
|
CockroachQueryRunner.prototype.getDatabases = function () {
|
|
367
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
368
|
-
return tslib_1.__generator(this, function (_a) {
|
|
330
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
331
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
369
332
|
return [2 /*return*/, Promise.resolve([])];
|
|
370
333
|
});
|
|
371
334
|
});
|
|
@@ -375,8 +338,8 @@ var CockroachQueryRunner = /** @class */ (function (_super) {
|
|
|
375
338
|
* If database parameter specified, returns schemas of that database.
|
|
376
339
|
*/
|
|
377
340
|
CockroachQueryRunner.prototype.getSchemas = function (database) {
|
|
378
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
379
|
-
return tslib_1.__generator(this, function (_a) {
|
|
341
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
342
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
380
343
|
return [2 /*return*/, Promise.resolve([])];
|
|
381
344
|
});
|
|
382
345
|
});
|
|
@@ -385,9 +348,9 @@ var CockroachQueryRunner = /** @class */ (function (_super) {
|
|
|
385
348
|
* Checks if database with the given name exist.
|
|
386
349
|
*/
|
|
387
350
|
CockroachQueryRunner.prototype.hasDatabase = function (database) {
|
|
388
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
351
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
389
352
|
var result;
|
|
390
|
-
return tslib_1.__generator(this, function (_a) {
|
|
353
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
391
354
|
switch (_a.label) {
|
|
392
355
|
case 0: return [4 /*yield*/, this.query("SELECT * FROM \"pg_database\" WHERE \"datname\" = '" + database + "'")];
|
|
393
356
|
case 1:
|
|
@@ -401,9 +364,9 @@ var CockroachQueryRunner = /** @class */ (function (_super) {
|
|
|
401
364
|
* Loads currently using database
|
|
402
365
|
*/
|
|
403
366
|
CockroachQueryRunner.prototype.getCurrentDatabase = function () {
|
|
404
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
367
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
405
368
|
var query;
|
|
406
|
-
return tslib_1.__generator(this, function (_a) {
|
|
369
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
407
370
|
switch (_a.label) {
|
|
408
371
|
case 0: return [4 /*yield*/, this.query("SELECT * FROM current_database()")];
|
|
409
372
|
case 1:
|
|
@@ -417,9 +380,9 @@ var CockroachQueryRunner = /** @class */ (function (_super) {
|
|
|
417
380
|
* Checks if schema with the given name exist.
|
|
418
381
|
*/
|
|
419
382
|
CockroachQueryRunner.prototype.hasSchema = function (schema) {
|
|
420
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
383
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
421
384
|
var result;
|
|
422
|
-
return tslib_1.__generator(this, function (_a) {
|
|
385
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
423
386
|
switch (_a.label) {
|
|
424
387
|
case 0: return [4 /*yield*/, this.query("SELECT * FROM \"information_schema\".\"schemata\" WHERE \"schema_name\" = '" + schema + "'")];
|
|
425
388
|
case 1:
|
|
@@ -433,9 +396,9 @@ var CockroachQueryRunner = /** @class */ (function (_super) {
|
|
|
433
396
|
* Loads currently using database schema
|
|
434
397
|
*/
|
|
435
398
|
CockroachQueryRunner.prototype.getCurrentSchema = function () {
|
|
436
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
399
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
437
400
|
var query;
|
|
438
|
-
return tslib_1.__generator(this, function (_a) {
|
|
401
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
439
402
|
switch (_a.label) {
|
|
440
403
|
case 0: return [4 /*yield*/, this.query("SELECT * FROM current_schema()")];
|
|
441
404
|
case 1:
|
|
@@ -449,9 +412,9 @@ var CockroachQueryRunner = /** @class */ (function (_super) {
|
|
|
449
412
|
* Checks if table with the given name exist in the database.
|
|
450
413
|
*/
|
|
451
414
|
CockroachQueryRunner.prototype.hasTable = function (tableOrName) {
|
|
452
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
415
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
453
416
|
var parsedTableName, _a, sql, result;
|
|
454
|
-
return tslib_1.__generator(this, function (_b) {
|
|
417
|
+
return (0, tslib_1.__generator)(this, function (_b) {
|
|
455
418
|
switch (_b.label) {
|
|
456
419
|
case 0:
|
|
457
420
|
parsedTableName = this.driver.parseTableName(tableOrName);
|
|
@@ -475,9 +438,9 @@ var CockroachQueryRunner = /** @class */ (function (_super) {
|
|
|
475
438
|
* Checks if column with the given name exist in the given table.
|
|
476
439
|
*/
|
|
477
440
|
CockroachQueryRunner.prototype.hasColumn = function (tableOrName, columnName) {
|
|
478
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
441
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
479
442
|
var parsedTableName, _a, sql, result;
|
|
480
|
-
return tslib_1.__generator(this, function (_b) {
|
|
443
|
+
return (0, tslib_1.__generator)(this, function (_b) {
|
|
481
444
|
switch (_b.label) {
|
|
482
445
|
case 0:
|
|
483
446
|
parsedTableName = this.driver.parseTableName(tableOrName);
|
|
@@ -501,9 +464,9 @@ var CockroachQueryRunner = /** @class */ (function (_super) {
|
|
|
501
464
|
* Creates a new database.
|
|
502
465
|
*/
|
|
503
466
|
CockroachQueryRunner.prototype.createDatabase = function (database, ifNotExist) {
|
|
504
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
467
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
505
468
|
var up, down;
|
|
506
|
-
return tslib_1.__generator(this, function (_a) {
|
|
469
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
507
470
|
switch (_a.label) {
|
|
508
471
|
case 0:
|
|
509
472
|
up = "CREATE DATABASE " + (ifNotExist ? "IF NOT EXISTS " : "") + " \"" + database + "\"";
|
|
@@ -520,9 +483,9 @@ var CockroachQueryRunner = /** @class */ (function (_super) {
|
|
|
520
483
|
* Drops database.
|
|
521
484
|
*/
|
|
522
485
|
CockroachQueryRunner.prototype.dropDatabase = function (database, ifExist) {
|
|
523
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
486
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
524
487
|
var up, down;
|
|
525
|
-
return tslib_1.__generator(this, function (_a) {
|
|
488
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
526
489
|
switch (_a.label) {
|
|
527
490
|
case 0:
|
|
528
491
|
up = "DROP DATABASE " + (ifExist ? "IF EXISTS " : "") + " \"" + database + "\"";
|
|
@@ -539,9 +502,9 @@ var CockroachQueryRunner = /** @class */ (function (_super) {
|
|
|
539
502
|
* Creates a new table schema.
|
|
540
503
|
*/
|
|
541
504
|
CockroachQueryRunner.prototype.createSchema = function (schemaPath, ifNotExist) {
|
|
542
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
505
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
543
506
|
var schema, up, down;
|
|
544
|
-
return tslib_1.__generator(this, function (_a) {
|
|
507
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
545
508
|
switch (_a.label) {
|
|
546
509
|
case 0:
|
|
547
510
|
schema = schemaPath.indexOf(".") === -1 ? schemaPath : schemaPath.split(".")[1];
|
|
@@ -559,9 +522,9 @@ var CockroachQueryRunner = /** @class */ (function (_super) {
|
|
|
559
522
|
* Drops table schema.
|
|
560
523
|
*/
|
|
561
524
|
CockroachQueryRunner.prototype.dropSchema = function (schemaPath, ifExist, isCascade) {
|
|
562
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
525
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
563
526
|
var schema, up, down;
|
|
564
|
-
return tslib_1.__generator(this, function (_a) {
|
|
527
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
565
528
|
switch (_a.label) {
|
|
566
529
|
case 0:
|
|
567
530
|
schema = schemaPath.indexOf(".") === -1 ? schemaPath : schemaPath.split(".")[1];
|
|
@@ -582,10 +545,10 @@ var CockroachQueryRunner = /** @class */ (function (_super) {
|
|
|
582
545
|
if (ifNotExist === void 0) { ifNotExist = false; }
|
|
583
546
|
if (createForeignKeys === void 0) { createForeignKeys = true; }
|
|
584
547
|
if (createIndices === void 0) { createIndices = true; }
|
|
585
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
548
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
586
549
|
var isTableExist, upQueries, downQueries;
|
|
587
550
|
var _this = this;
|
|
588
|
-
return tslib_1.__generator(this, function (_a) {
|
|
551
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
589
552
|
switch (_a.label) {
|
|
590
553
|
case 0:
|
|
591
554
|
if (!ifNotExist) return [3 /*break*/, 2];
|
|
@@ -635,10 +598,10 @@ var CockroachQueryRunner = /** @class */ (function (_super) {
|
|
|
635
598
|
CockroachQueryRunner.prototype.dropTable = function (target, ifExist, dropForeignKeys, dropIndices) {
|
|
636
599
|
if (dropForeignKeys === void 0) { dropForeignKeys = true; }
|
|
637
600
|
if (dropIndices === void 0) { dropIndices = true; }
|
|
638
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
601
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
639
602
|
var isTableExist, createForeignKeys, tablePath, table, upQueries, downQueries;
|
|
640
603
|
var _this = this;
|
|
641
|
-
return tslib_1.__generator(this, function (_a) {
|
|
604
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
642
605
|
switch (_a.label) {
|
|
643
606
|
case 0:
|
|
644
607
|
if (!ifExist) return [3 /*break*/, 2];
|
|
@@ -685,9 +648,9 @@ var CockroachQueryRunner = /** @class */ (function (_super) {
|
|
|
685
648
|
* Creates a new view.
|
|
686
649
|
*/
|
|
687
650
|
CockroachQueryRunner.prototype.createView = function (view) {
|
|
688
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
651
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
689
652
|
var upQueries, downQueries, _a, _b, _c, _d;
|
|
690
|
-
return tslib_1.__generator(this, function (_e) {
|
|
653
|
+
return (0, tslib_1.__generator)(this, function (_e) {
|
|
691
654
|
switch (_e.label) {
|
|
692
655
|
case 0:
|
|
693
656
|
upQueries = [];
|
|
@@ -714,9 +677,9 @@ var CockroachQueryRunner = /** @class */ (function (_super) {
|
|
|
714
677
|
* Drops the view.
|
|
715
678
|
*/
|
|
716
679
|
CockroachQueryRunner.prototype.dropView = function (target) {
|
|
717
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
680
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
718
681
|
var viewName, view, upQueries, downQueries, _a, _b, _c, _d;
|
|
719
|
-
return tslib_1.__generator(this, function (_e) {
|
|
682
|
+
return (0, tslib_1.__generator)(this, function (_e) {
|
|
720
683
|
switch (_e.label) {
|
|
721
684
|
case 0:
|
|
722
685
|
viewName = target instanceof View_1.View ? target.name : target;
|
|
@@ -747,10 +710,10 @@ var CockroachQueryRunner = /** @class */ (function (_super) {
|
|
|
747
710
|
* Renames the given table.
|
|
748
711
|
*/
|
|
749
712
|
CockroachQueryRunner.prototype.renameTable = function (oldTableOrName, newTableName) {
|
|
750
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
713
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
751
714
|
var upQueries, downQueries, oldTable, _a, newTable, _b, schemaName, oldTableName, columnNames, oldPkName, newPkName;
|
|
752
715
|
var _this = this;
|
|
753
|
-
return tslib_1.__generator(this, function (_c) {
|
|
716
|
+
return (0, tslib_1.__generator)(this, function (_c) {
|
|
754
717
|
switch (_c.label) {
|
|
755
718
|
case 0:
|
|
756
719
|
upQueries = [];
|
|
@@ -822,9 +785,9 @@ var CockroachQueryRunner = /** @class */ (function (_super) {
|
|
|
822
785
|
* Creates a new column from the column in the table.
|
|
823
786
|
*/
|
|
824
787
|
CockroachQueryRunner.prototype.addColumn = function (tableOrName, column) {
|
|
825
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
788
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
826
789
|
var table, _a, clonedTable, upQueries, downQueries, primaryColumns, pkName_1, columnNames_1, pkName, columnNames, columnIndex, unique, uniqueConstraint;
|
|
827
|
-
return tslib_1.__generator(this, function (_b) {
|
|
790
|
+
return (0, tslib_1.__generator)(this, function (_b) {
|
|
828
791
|
switch (_b.label) {
|
|
829
792
|
case 0:
|
|
830
793
|
if (!(tableOrName instanceof Table_1.Table)) return [3 /*break*/, 1];
|
|
@@ -907,14 +870,14 @@ var CockroachQueryRunner = /** @class */ (function (_super) {
|
|
|
907
870
|
* Creates a new columns from the column in the table.
|
|
908
871
|
*/
|
|
909
872
|
CockroachQueryRunner.prototype.addColumns = function (tableOrName, columns) {
|
|
910
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
873
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
911
874
|
var columns_1, columns_1_1, column, e_3_1;
|
|
912
875
|
var e_3, _a;
|
|
913
|
-
return tslib_1.__generator(this, function (_b) {
|
|
876
|
+
return (0, tslib_1.__generator)(this, function (_b) {
|
|
914
877
|
switch (_b.label) {
|
|
915
878
|
case 0:
|
|
916
879
|
_b.trys.push([0, 5, 6, 7]);
|
|
917
|
-
columns_1 = tslib_1.__values(columns), columns_1_1 = columns_1.next();
|
|
880
|
+
columns_1 = (0, tslib_1.__values)(columns), columns_1_1 = columns_1.next();
|
|
918
881
|
_b.label = 1;
|
|
919
882
|
case 1:
|
|
920
883
|
if (!!columns_1_1.done) return [3 /*break*/, 4];
|
|
@@ -946,9 +909,9 @@ var CockroachQueryRunner = /** @class */ (function (_super) {
|
|
|
946
909
|
* Renames column in the given table.
|
|
947
910
|
*/
|
|
948
911
|
CockroachQueryRunner.prototype.renameColumn = function (tableOrName, oldTableColumnOrName, newTableColumnOrName) {
|
|
949
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
912
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
950
913
|
var table, _a, oldColumn, newColumn;
|
|
951
|
-
return tslib_1.__generator(this, function (_b) {
|
|
914
|
+
return (0, tslib_1.__generator)(this, function (_b) {
|
|
952
915
|
switch (_b.label) {
|
|
953
916
|
case 0:
|
|
954
917
|
if (!(tableOrName instanceof Table_1.Table)) return [3 /*break*/, 1];
|
|
@@ -979,10 +942,10 @@ var CockroachQueryRunner = /** @class */ (function (_super) {
|
|
|
979
942
|
* Changes a column in the table.
|
|
980
943
|
*/
|
|
981
944
|
CockroachQueryRunner.prototype.changeColumn = function (tableOrName, oldTableColumnOrName, newColumn) {
|
|
982
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
945
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
983
946
|
var table, _a, clonedTable, upQueries, downQueries, oldColumn, primaryColumns, columnNames, oldPkName, newPkName, oldTableColumn, primaryColumns, pkName, columnNames, column, pkName, columnNames, primaryColumn, column, pkName, columnNames, uniqueConstraint, uniqueConstraint;
|
|
984
947
|
var _this = this;
|
|
985
|
-
return tslib_1.__generator(this, function (_b) {
|
|
948
|
+
return (0, tslib_1.__generator)(this, function (_b) {
|
|
986
949
|
switch (_b.label) {
|
|
987
950
|
case 0:
|
|
988
951
|
if (!(tableOrName instanceof Table_1.Table)) return [3 /*break*/, 1];
|
|
@@ -1191,14 +1154,14 @@ var CockroachQueryRunner = /** @class */ (function (_super) {
|
|
|
1191
1154
|
* Changes a column in the table.
|
|
1192
1155
|
*/
|
|
1193
1156
|
CockroachQueryRunner.prototype.changeColumns = function (tableOrName, changedColumns) {
|
|
1194
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1157
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1195
1158
|
var changedColumns_1, changedColumns_1_1, _a, oldColumn, newColumn, e_4_1;
|
|
1196
1159
|
var e_4, _b;
|
|
1197
|
-
return tslib_1.__generator(this, function (_c) {
|
|
1160
|
+
return (0, tslib_1.__generator)(this, function (_c) {
|
|
1198
1161
|
switch (_c.label) {
|
|
1199
1162
|
case 0:
|
|
1200
1163
|
_c.trys.push([0, 5, 6, 7]);
|
|
1201
|
-
changedColumns_1 = tslib_1.__values(changedColumns), changedColumns_1_1 = changedColumns_1.next();
|
|
1164
|
+
changedColumns_1 = (0, tslib_1.__values)(changedColumns), changedColumns_1_1 = changedColumns_1.next();
|
|
1202
1165
|
_c.label = 1;
|
|
1203
1166
|
case 1:
|
|
1204
1167
|
if (!!changedColumns_1_1.done) return [3 /*break*/, 4];
|
|
@@ -1230,9 +1193,9 @@ var CockroachQueryRunner = /** @class */ (function (_super) {
|
|
|
1230
1193
|
* Drops column in the table.
|
|
1231
1194
|
*/
|
|
1232
1195
|
CockroachQueryRunner.prototype.dropColumn = function (tableOrName, columnOrName) {
|
|
1233
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1196
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1234
1197
|
var table, _a, column, clonedTable, upQueries, downQueries, pkName, columnNames, tableColumn, pkName_2, columnNames_2, columnIndex, columnCheck, columnUnique;
|
|
1235
|
-
return tslib_1.__generator(this, function (_b) {
|
|
1198
|
+
return (0, tslib_1.__generator)(this, function (_b) {
|
|
1236
1199
|
switch (_b.label) {
|
|
1237
1200
|
case 0:
|
|
1238
1201
|
if (!(tableOrName instanceof Table_1.Table)) return [3 /*break*/, 1];
|
|
@@ -1305,14 +1268,14 @@ var CockroachQueryRunner = /** @class */ (function (_super) {
|
|
|
1305
1268
|
* Drops the columns in the table.
|
|
1306
1269
|
*/
|
|
1307
1270
|
CockroachQueryRunner.prototype.dropColumns = function (tableOrName, columns) {
|
|
1308
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1271
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1309
1272
|
var columns_2, columns_2_1, column, e_5_1;
|
|
1310
1273
|
var e_5, _a;
|
|
1311
|
-
return tslib_1.__generator(this, function (_b) {
|
|
1274
|
+
return (0, tslib_1.__generator)(this, function (_b) {
|
|
1312
1275
|
switch (_b.label) {
|
|
1313
1276
|
case 0:
|
|
1314
1277
|
_b.trys.push([0, 5, 6, 7]);
|
|
1315
|
-
columns_2 = tslib_1.__values(columns), columns_2_1 = columns_2.next();
|
|
1278
|
+
columns_2 = (0, tslib_1.__values)(columns), columns_2_1 = columns_2.next();
|
|
1316
1279
|
_b.label = 1;
|
|
1317
1280
|
case 1:
|
|
1318
1281
|
if (!!columns_2_1.done) return [3 /*break*/, 4];
|
|
@@ -1344,9 +1307,9 @@ var CockroachQueryRunner = /** @class */ (function (_super) {
|
|
|
1344
1307
|
* Creates a new primary key.
|
|
1345
1308
|
*/
|
|
1346
1309
|
CockroachQueryRunner.prototype.createPrimaryKey = function (tableOrName, columnNames) {
|
|
1347
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1310
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1348
1311
|
var table, _a, clonedTable, up, down;
|
|
1349
|
-
return tslib_1.__generator(this, function (_b) {
|
|
1312
|
+
return (0, tslib_1.__generator)(this, function (_b) {
|
|
1350
1313
|
switch (_b.label) {
|
|
1351
1314
|
case 0:
|
|
1352
1315
|
if (!(tableOrName instanceof Table_1.Table)) return [3 /*break*/, 1];
|
|
@@ -1379,9 +1342,9 @@ var CockroachQueryRunner = /** @class */ (function (_super) {
|
|
|
1379
1342
|
* Updates composite primary keys.
|
|
1380
1343
|
*/
|
|
1381
1344
|
CockroachQueryRunner.prototype.updatePrimaryKeys = function (tableOrName, columns) {
|
|
1382
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1345
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1383
1346
|
var table, _a, clonedTable, columnNames, upQueries, downQueries, primaryColumns, pkName_3, columnNamesString_1, pkName, columnNamesString;
|
|
1384
|
-
return tslib_1.__generator(this, function (_b) {
|
|
1347
|
+
return (0, tslib_1.__generator)(this, function (_b) {
|
|
1385
1348
|
switch (_b.label) {
|
|
1386
1349
|
case 0:
|
|
1387
1350
|
if (!(tableOrName instanceof Table_1.Table)) return [3 /*break*/, 1];
|
|
@@ -1425,9 +1388,9 @@ var CockroachQueryRunner = /** @class */ (function (_super) {
|
|
|
1425
1388
|
* Drops a primary key.
|
|
1426
1389
|
*/
|
|
1427
1390
|
CockroachQueryRunner.prototype.dropPrimaryKey = function (tableOrName) {
|
|
1428
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1391
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1429
1392
|
var table, _a, up, down;
|
|
1430
|
-
return tslib_1.__generator(this, function (_b) {
|
|
1393
|
+
return (0, tslib_1.__generator)(this, function (_b) {
|
|
1431
1394
|
switch (_b.label) {
|
|
1432
1395
|
case 0:
|
|
1433
1396
|
if (!(tableOrName instanceof Table_1.Table)) return [3 /*break*/, 1];
|
|
@@ -1456,9 +1419,9 @@ var CockroachQueryRunner = /** @class */ (function (_super) {
|
|
|
1456
1419
|
* Creates new unique constraint.
|
|
1457
1420
|
*/
|
|
1458
1421
|
CockroachQueryRunner.prototype.createUniqueConstraint = function (tableOrName, uniqueConstraint) {
|
|
1459
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1422
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1460
1423
|
var table, _a, up, down;
|
|
1461
|
-
return tslib_1.__generator(this, function (_b) {
|
|
1424
|
+
return (0, tslib_1.__generator)(this, function (_b) {
|
|
1462
1425
|
switch (_b.label) {
|
|
1463
1426
|
case 0:
|
|
1464
1427
|
if (!(tableOrName instanceof Table_1.Table)) return [3 /*break*/, 1];
|
|
@@ -1488,14 +1451,14 @@ var CockroachQueryRunner = /** @class */ (function (_super) {
|
|
|
1488
1451
|
* Creates new unique constraints.
|
|
1489
1452
|
*/
|
|
1490
1453
|
CockroachQueryRunner.prototype.createUniqueConstraints = function (tableOrName, uniqueConstraints) {
|
|
1491
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1454
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1492
1455
|
var uniqueConstraints_1, uniqueConstraints_1_1, uniqueConstraint, e_6_1;
|
|
1493
1456
|
var e_6, _a;
|
|
1494
|
-
return tslib_1.__generator(this, function (_b) {
|
|
1457
|
+
return (0, tslib_1.__generator)(this, function (_b) {
|
|
1495
1458
|
switch (_b.label) {
|
|
1496
1459
|
case 0:
|
|
1497
1460
|
_b.trys.push([0, 5, 6, 7]);
|
|
1498
|
-
uniqueConstraints_1 = tslib_1.__values(uniqueConstraints), uniqueConstraints_1_1 = uniqueConstraints_1.next();
|
|
1461
|
+
uniqueConstraints_1 = (0, tslib_1.__values)(uniqueConstraints), uniqueConstraints_1_1 = uniqueConstraints_1.next();
|
|
1499
1462
|
_b.label = 1;
|
|
1500
1463
|
case 1:
|
|
1501
1464
|
if (!!uniqueConstraints_1_1.done) return [3 /*break*/, 4];
|
|
@@ -1527,9 +1490,9 @@ var CockroachQueryRunner = /** @class */ (function (_super) {
|
|
|
1527
1490
|
* Drops unique constraint.
|
|
1528
1491
|
*/
|
|
1529
1492
|
CockroachQueryRunner.prototype.dropUniqueConstraint = function (tableOrName, uniqueOrName) {
|
|
1530
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1493
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1531
1494
|
var table, _a, uniqueConstraint, up, down;
|
|
1532
|
-
return tslib_1.__generator(this, function (_b) {
|
|
1495
|
+
return (0, tslib_1.__generator)(this, function (_b) {
|
|
1533
1496
|
switch (_b.label) {
|
|
1534
1497
|
case 0:
|
|
1535
1498
|
if (!(tableOrName instanceof Table_1.Table)) return [3 /*break*/, 1];
|
|
@@ -1559,14 +1522,14 @@ var CockroachQueryRunner = /** @class */ (function (_super) {
|
|
|
1559
1522
|
* Drops unique constraints.
|
|
1560
1523
|
*/
|
|
1561
1524
|
CockroachQueryRunner.prototype.dropUniqueConstraints = function (tableOrName, uniqueConstraints) {
|
|
1562
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1525
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1563
1526
|
var uniqueConstraints_2, uniqueConstraints_2_1, uniqueConstraint, e_7_1;
|
|
1564
1527
|
var e_7, _a;
|
|
1565
|
-
return tslib_1.__generator(this, function (_b) {
|
|
1528
|
+
return (0, tslib_1.__generator)(this, function (_b) {
|
|
1566
1529
|
switch (_b.label) {
|
|
1567
1530
|
case 0:
|
|
1568
1531
|
_b.trys.push([0, 5, 6, 7]);
|
|
1569
|
-
uniqueConstraints_2 = tslib_1.__values(uniqueConstraints), uniqueConstraints_2_1 = uniqueConstraints_2.next();
|
|
1532
|
+
uniqueConstraints_2 = (0, tslib_1.__values)(uniqueConstraints), uniqueConstraints_2_1 = uniqueConstraints_2.next();
|
|
1570
1533
|
_b.label = 1;
|
|
1571
1534
|
case 1:
|
|
1572
1535
|
if (!!uniqueConstraints_2_1.done) return [3 /*break*/, 4];
|
|
@@ -1598,9 +1561,9 @@ var CockroachQueryRunner = /** @class */ (function (_super) {
|
|
|
1598
1561
|
* Creates new check constraint.
|
|
1599
1562
|
*/
|
|
1600
1563
|
CockroachQueryRunner.prototype.createCheckConstraint = function (tableOrName, checkConstraint) {
|
|
1601
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1564
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1602
1565
|
var table, _a, up, down;
|
|
1603
|
-
return tslib_1.__generator(this, function (_b) {
|
|
1566
|
+
return (0, tslib_1.__generator)(this, function (_b) {
|
|
1604
1567
|
switch (_b.label) {
|
|
1605
1568
|
case 0:
|
|
1606
1569
|
if (!(tableOrName instanceof Table_1.Table)) return [3 /*break*/, 1];
|
|
@@ -1630,10 +1593,10 @@ var CockroachQueryRunner = /** @class */ (function (_super) {
|
|
|
1630
1593
|
* Creates new check constraints.
|
|
1631
1594
|
*/
|
|
1632
1595
|
CockroachQueryRunner.prototype.createCheckConstraints = function (tableOrName, checkConstraints) {
|
|
1633
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1596
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1634
1597
|
var promises;
|
|
1635
1598
|
var _this = this;
|
|
1636
|
-
return tslib_1.__generator(this, function (_a) {
|
|
1599
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
1637
1600
|
switch (_a.label) {
|
|
1638
1601
|
case 0:
|
|
1639
1602
|
promises = checkConstraints.map(function (checkConstraint) { return _this.createCheckConstraint(tableOrName, checkConstraint); });
|
|
@@ -1649,9 +1612,9 @@ var CockroachQueryRunner = /** @class */ (function (_super) {
|
|
|
1649
1612
|
* Drops check constraint.
|
|
1650
1613
|
*/
|
|
1651
1614
|
CockroachQueryRunner.prototype.dropCheckConstraint = function (tableOrName, checkOrName) {
|
|
1652
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1615
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1653
1616
|
var table, _a, checkConstraint, up, down;
|
|
1654
|
-
return tslib_1.__generator(this, function (_b) {
|
|
1617
|
+
return (0, tslib_1.__generator)(this, function (_b) {
|
|
1655
1618
|
switch (_b.label) {
|
|
1656
1619
|
case 0:
|
|
1657
1620
|
if (!(tableOrName instanceof Table_1.Table)) return [3 /*break*/, 1];
|
|
@@ -1681,10 +1644,10 @@ var CockroachQueryRunner = /** @class */ (function (_super) {
|
|
|
1681
1644
|
* Drops check constraints.
|
|
1682
1645
|
*/
|
|
1683
1646
|
CockroachQueryRunner.prototype.dropCheckConstraints = function (tableOrName, checkConstraints) {
|
|
1684
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1647
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1685
1648
|
var promises;
|
|
1686
1649
|
var _this = this;
|
|
1687
|
-
return tslib_1.__generator(this, function (_a) {
|
|
1650
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
1688
1651
|
switch (_a.label) {
|
|
1689
1652
|
case 0:
|
|
1690
1653
|
promises = checkConstraints.map(function (checkConstraint) { return _this.dropCheckConstraint(tableOrName, checkConstraint); });
|
|
@@ -1700,8 +1663,8 @@ var CockroachQueryRunner = /** @class */ (function (_super) {
|
|
|
1700
1663
|
* Creates new exclusion constraint.
|
|
1701
1664
|
*/
|
|
1702
1665
|
CockroachQueryRunner.prototype.createExclusionConstraint = function (tableOrName, exclusionConstraint) {
|
|
1703
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1704
|
-
return tslib_1.__generator(this, function (_a) {
|
|
1666
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1667
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
1705
1668
|
throw new error_1.TypeORMError("CockroachDB does not support exclusion constraints.");
|
|
1706
1669
|
});
|
|
1707
1670
|
});
|
|
@@ -1710,8 +1673,8 @@ var CockroachQueryRunner = /** @class */ (function (_super) {
|
|
|
1710
1673
|
* Creates new exclusion constraints.
|
|
1711
1674
|
*/
|
|
1712
1675
|
CockroachQueryRunner.prototype.createExclusionConstraints = function (tableOrName, exclusionConstraints) {
|
|
1713
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1714
|
-
return tslib_1.__generator(this, function (_a) {
|
|
1676
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1677
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
1715
1678
|
throw new error_1.TypeORMError("CockroachDB does not support exclusion constraints.");
|
|
1716
1679
|
});
|
|
1717
1680
|
});
|
|
@@ -1720,8 +1683,8 @@ var CockroachQueryRunner = /** @class */ (function (_super) {
|
|
|
1720
1683
|
* Drops exclusion constraint.
|
|
1721
1684
|
*/
|
|
1722
1685
|
CockroachQueryRunner.prototype.dropExclusionConstraint = function (tableOrName, exclusionOrName) {
|
|
1723
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1724
|
-
return tslib_1.__generator(this, function (_a) {
|
|
1686
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1687
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
1725
1688
|
throw new error_1.TypeORMError("CockroachDB does not support exclusion constraints.");
|
|
1726
1689
|
});
|
|
1727
1690
|
});
|
|
@@ -1730,8 +1693,8 @@ var CockroachQueryRunner = /** @class */ (function (_super) {
|
|
|
1730
1693
|
* Drops exclusion constraints.
|
|
1731
1694
|
*/
|
|
1732
1695
|
CockroachQueryRunner.prototype.dropExclusionConstraints = function (tableOrName, exclusionConstraints) {
|
|
1733
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1734
|
-
return tslib_1.__generator(this, function (_a) {
|
|
1696
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1697
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
1735
1698
|
throw new error_1.TypeORMError("CockroachDB does not support exclusion constraints.");
|
|
1736
1699
|
});
|
|
1737
1700
|
});
|
|
@@ -1740,9 +1703,9 @@ var CockroachQueryRunner = /** @class */ (function (_super) {
|
|
|
1740
1703
|
* Creates a new foreign key.
|
|
1741
1704
|
*/
|
|
1742
1705
|
CockroachQueryRunner.prototype.createForeignKey = function (tableOrName, foreignKey) {
|
|
1743
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1706
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1744
1707
|
var table, _a, up, down;
|
|
1745
|
-
return tslib_1.__generator(this, function (_b) {
|
|
1708
|
+
return (0, tslib_1.__generator)(this, function (_b) {
|
|
1746
1709
|
switch (_b.label) {
|
|
1747
1710
|
case 0:
|
|
1748
1711
|
if (!(tableOrName instanceof Table_1.Table)) return [3 /*break*/, 1];
|
|
@@ -1772,14 +1735,14 @@ var CockroachQueryRunner = /** @class */ (function (_super) {
|
|
|
1772
1735
|
* Creates a new foreign keys.
|
|
1773
1736
|
*/
|
|
1774
1737
|
CockroachQueryRunner.prototype.createForeignKeys = function (tableOrName, foreignKeys) {
|
|
1775
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1738
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1776
1739
|
var foreignKeys_1, foreignKeys_1_1, foreignKey, e_8_1;
|
|
1777
1740
|
var e_8, _a;
|
|
1778
|
-
return tslib_1.__generator(this, function (_b) {
|
|
1741
|
+
return (0, tslib_1.__generator)(this, function (_b) {
|
|
1779
1742
|
switch (_b.label) {
|
|
1780
1743
|
case 0:
|
|
1781
1744
|
_b.trys.push([0, 5, 6, 7]);
|
|
1782
|
-
foreignKeys_1 = tslib_1.__values(foreignKeys), foreignKeys_1_1 = foreignKeys_1.next();
|
|
1745
|
+
foreignKeys_1 = (0, tslib_1.__values)(foreignKeys), foreignKeys_1_1 = foreignKeys_1.next();
|
|
1783
1746
|
_b.label = 1;
|
|
1784
1747
|
case 1:
|
|
1785
1748
|
if (!!foreignKeys_1_1.done) return [3 /*break*/, 4];
|
|
@@ -1811,9 +1774,9 @@ var CockroachQueryRunner = /** @class */ (function (_super) {
|
|
|
1811
1774
|
* Drops a foreign key from the table.
|
|
1812
1775
|
*/
|
|
1813
1776
|
CockroachQueryRunner.prototype.dropForeignKey = function (tableOrName, foreignKeyOrName) {
|
|
1814
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1777
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1815
1778
|
var table, _a, foreignKey, up, down;
|
|
1816
|
-
return tslib_1.__generator(this, function (_b) {
|
|
1779
|
+
return (0, tslib_1.__generator)(this, function (_b) {
|
|
1817
1780
|
switch (_b.label) {
|
|
1818
1781
|
case 0:
|
|
1819
1782
|
if (!(tableOrName instanceof Table_1.Table)) return [3 /*break*/, 1];
|
|
@@ -1843,14 +1806,14 @@ var CockroachQueryRunner = /** @class */ (function (_super) {
|
|
|
1843
1806
|
* Drops a foreign keys from the table.
|
|
1844
1807
|
*/
|
|
1845
1808
|
CockroachQueryRunner.prototype.dropForeignKeys = function (tableOrName, foreignKeys) {
|
|
1846
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1809
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1847
1810
|
var foreignKeys_2, foreignKeys_2_1, foreignKey, e_9_1;
|
|
1848
1811
|
var e_9, _a;
|
|
1849
|
-
return tslib_1.__generator(this, function (_b) {
|
|
1812
|
+
return (0, tslib_1.__generator)(this, function (_b) {
|
|
1850
1813
|
switch (_b.label) {
|
|
1851
1814
|
case 0:
|
|
1852
1815
|
_b.trys.push([0, 5, 6, 7]);
|
|
1853
|
-
foreignKeys_2 = tslib_1.__values(foreignKeys), foreignKeys_2_1 = foreignKeys_2.next();
|
|
1816
|
+
foreignKeys_2 = (0, tslib_1.__values)(foreignKeys), foreignKeys_2_1 = foreignKeys_2.next();
|
|
1854
1817
|
_b.label = 1;
|
|
1855
1818
|
case 1:
|
|
1856
1819
|
if (!!foreignKeys_2_1.done) return [3 /*break*/, 4];
|
|
@@ -1882,9 +1845,9 @@ var CockroachQueryRunner = /** @class */ (function (_super) {
|
|
|
1882
1845
|
* Creates a new index.
|
|
1883
1846
|
*/
|
|
1884
1847
|
CockroachQueryRunner.prototype.createIndex = function (tableOrName, index) {
|
|
1885
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1848
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1886
1849
|
var table, _a, unique, up, down, up, down;
|
|
1887
|
-
return tslib_1.__generator(this, function (_b) {
|
|
1850
|
+
return (0, tslib_1.__generator)(this, function (_b) {
|
|
1888
1851
|
switch (_b.label) {
|
|
1889
1852
|
case 0:
|
|
1890
1853
|
if (!(tableOrName instanceof Table_1.Table)) return [3 /*break*/, 1];
|
|
@@ -1928,14 +1891,14 @@ var CockroachQueryRunner = /** @class */ (function (_super) {
|
|
|
1928
1891
|
* Creates a new indices
|
|
1929
1892
|
*/
|
|
1930
1893
|
CockroachQueryRunner.prototype.createIndices = function (tableOrName, indices) {
|
|
1931
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1894
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1932
1895
|
var indices_1, indices_1_1, index, e_10_1;
|
|
1933
1896
|
var e_10, _a;
|
|
1934
|
-
return tslib_1.__generator(this, function (_b) {
|
|
1897
|
+
return (0, tslib_1.__generator)(this, function (_b) {
|
|
1935
1898
|
switch (_b.label) {
|
|
1936
1899
|
case 0:
|
|
1937
1900
|
_b.trys.push([0, 5, 6, 7]);
|
|
1938
|
-
indices_1 = tslib_1.__values(indices), indices_1_1 = indices_1.next();
|
|
1901
|
+
indices_1 = (0, tslib_1.__values)(indices), indices_1_1 = indices_1.next();
|
|
1939
1902
|
_b.label = 1;
|
|
1940
1903
|
case 1:
|
|
1941
1904
|
if (!!indices_1_1.done) return [3 /*break*/, 4];
|
|
@@ -1967,9 +1930,9 @@ var CockroachQueryRunner = /** @class */ (function (_super) {
|
|
|
1967
1930
|
* Drops an index from the table.
|
|
1968
1931
|
*/
|
|
1969
1932
|
CockroachQueryRunner.prototype.dropIndex = function (tableOrName, indexOrName) {
|
|
1970
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1933
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1971
1934
|
var table, _a, index, up, down;
|
|
1972
|
-
return tslib_1.__generator(this, function (_b) {
|
|
1935
|
+
return (0, tslib_1.__generator)(this, function (_b) {
|
|
1973
1936
|
switch (_b.label) {
|
|
1974
1937
|
case 0:
|
|
1975
1938
|
if (!(tableOrName instanceof Table_1.Table)) return [3 /*break*/, 1];
|
|
@@ -1999,14 +1962,14 @@ var CockroachQueryRunner = /** @class */ (function (_super) {
|
|
|
1999
1962
|
* Drops an indices from the table.
|
|
2000
1963
|
*/
|
|
2001
1964
|
CockroachQueryRunner.prototype.dropIndices = function (tableOrName, indices) {
|
|
2002
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1965
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
2003
1966
|
var indices_2, indices_2_1, index, e_11_1;
|
|
2004
1967
|
var e_11, _a;
|
|
2005
|
-
return tslib_1.__generator(this, function (_b) {
|
|
1968
|
+
return (0, tslib_1.__generator)(this, function (_b) {
|
|
2006
1969
|
switch (_b.label) {
|
|
2007
1970
|
case 0:
|
|
2008
1971
|
_b.trys.push([0, 5, 6, 7]);
|
|
2009
|
-
indices_2 = tslib_1.__values(indices), indices_2_1 = indices_2.next();
|
|
1972
|
+
indices_2 = (0, tslib_1.__values)(indices), indices_2_1 = indices_2.next();
|
|
2010
1973
|
_b.label = 1;
|
|
2011
1974
|
case 1:
|
|
2012
1975
|
if (!!indices_2_1.done) return [3 /*break*/, 4];
|
|
@@ -2039,8 +2002,8 @@ var CockroachQueryRunner = /** @class */ (function (_super) {
|
|
|
2039
2002
|
* Note: this operation uses SQL's TRUNCATE query which cannot be reverted in transactions.
|
|
2040
2003
|
*/
|
|
2041
2004
|
CockroachQueryRunner.prototype.clearTable = function (tableName) {
|
|
2042
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
2043
|
-
return tslib_1.__generator(this, function (_a) {
|
|
2005
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
2006
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
2044
2007
|
switch (_a.label) {
|
|
2045
2008
|
case 0: return [4 /*yield*/, this.query("TRUNCATE TABLE " + this.escapePath(tableName))];
|
|
2046
2009
|
case 1:
|
|
@@ -2054,10 +2017,10 @@ var CockroachQueryRunner = /** @class */ (function (_super) {
|
|
|
2054
2017
|
* Removes all tables from the currently connected database.
|
|
2055
2018
|
*/
|
|
2056
2019
|
CockroachQueryRunner.prototype.clearDatabase = function () {
|
|
2057
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
2020
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
2058
2021
|
var schemas, schemaNamesString, selectViewDropsQuery, dropViewQueries, selectDropsQuery, dropQueries, selectSequenceDropsQuery, sequenceDropQueries, error_2, rollbackError_1;
|
|
2059
2022
|
var _this = this;
|
|
2060
|
-
return tslib_1.__generator(this, function (_a) {
|
|
2023
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
2061
2024
|
switch (_a.label) {
|
|
2062
2025
|
case 0:
|
|
2063
2026
|
schemas = [];
|
|
@@ -2126,10 +2089,10 @@ var CockroachQueryRunner = /** @class */ (function (_super) {
|
|
|
2126
2089
|
// Protected Methods
|
|
2127
2090
|
// -------------------------------------------------------------------------
|
|
2128
2091
|
CockroachQueryRunner.prototype.loadViews = function (viewNames) {
|
|
2129
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
2092
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
2130
2093
|
var hasTable, currentDatabase, currentSchema, viewsCondition, query, dbViews;
|
|
2131
2094
|
var _this = this;
|
|
2132
|
-
return tslib_1.__generator(this, function (_a) {
|
|
2095
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
2133
2096
|
switch (_a.label) {
|
|
2134
2097
|
case 0: return [4 /*yield*/, this.hasTable(this.getTypeormMetadataTableName())];
|
|
2135
2098
|
case 1:
|
|
@@ -2172,10 +2135,10 @@ var CockroachQueryRunner = /** @class */ (function (_super) {
|
|
|
2172
2135
|
* Loads all tables (with given names) from the database and creates a Table from them.
|
|
2173
2136
|
*/
|
|
2174
2137
|
CockroachQueryRunner.prototype.loadTables = function (tableNames) {
|
|
2175
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
2138
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
2176
2139
|
var currentSchema, currentDatabase, dbTables, tablesSql, _a, _b, _c, _d, tablesCondition, tablesSql, _e, _f, _g, _h, columnsCondiiton, columnsSql, constraintsCondition, constraintsSql, indicesSql, foreignKeysCondition, foreignKeysSql, _j, dbColumns, dbConstraints, dbIndices, dbForeignKeys;
|
|
2177
2140
|
var _this = this;
|
|
2178
|
-
return tslib_1.__generator(this, function (_k) {
|
|
2141
|
+
return (0, tslib_1.__generator)(this, function (_k) {
|
|
2179
2142
|
switch (_k.label) {
|
|
2180
2143
|
case 0:
|
|
2181
2144
|
// if no tables given then no need to proceed
|
|
@@ -2196,7 +2159,7 @@ var CockroachQueryRunner = /** @class */ (function (_super) {
|
|
|
2196
2159
|
_d = [[]];
|
|
2197
2160
|
return [4 /*yield*/, this.query(tablesSql)];
|
|
2198
2161
|
case 3:
|
|
2199
|
-
_b.apply(_a, _c.concat([tslib_1.__spreadArray.apply(void 0, _d.concat([tslib_1.__read.apply(void 0, [_k.sent()])]))]));
|
|
2162
|
+
_b.apply(_a, _c.concat([tslib_1.__spreadArray.apply(void 0, _d.concat([tslib_1.__read.apply(void 0, [_k.sent()]), false]))]));
|
|
2200
2163
|
return [3 /*break*/, 6];
|
|
2201
2164
|
case 4:
|
|
2202
2165
|
tablesCondition = tableNames
|
|
@@ -2211,7 +2174,7 @@ var CockroachQueryRunner = /** @class */ (function (_super) {
|
|
|
2211
2174
|
_h = [[]];
|
|
2212
2175
|
return [4 /*yield*/, this.query(tablesSql)];
|
|
2213
2176
|
case 5:
|
|
2214
|
-
_f.apply(_e, _g.concat([tslib_1.__spreadArray.apply(void 0, _h.concat([tslib_1.__read.apply(void 0, [_k.sent()])]))]));
|
|
2177
|
+
_f.apply(_e, _g.concat([tslib_1.__spreadArray.apply(void 0, _h.concat([tslib_1.__read.apply(void 0, [_k.sent()]), false]))]));
|
|
2215
2178
|
_k.label = 6;
|
|
2216
2179
|
case 6:
|
|
2217
2180
|
if (dbTables.length === 0) {
|
|
@@ -2273,10 +2236,10 @@ var CockroachQueryRunner = /** @class */ (function (_super) {
|
|
|
2273
2236
|
case 7:
|
|
2274
2237
|
_j = tslib_1.__read.apply(void 0, [_k.sent(), 4]), dbColumns = _j[0], dbConstraints = _j[1], dbIndices = _j[2], dbForeignKeys = _j[3];
|
|
2275
2238
|
// create tables for loaded tables
|
|
2276
|
-
return [2 /*return*/, Promise.all(dbTables.map(function (dbTable) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
2239
|
+
return [2 /*return*/, Promise.all(dbTables.map(function (dbTable) { return (0, tslib_1.__awaiter)(_this, void 0, void 0, function () {
|
|
2277
2240
|
var table, getSchemaFromKey, schema, _a, tableUniqueConstraints, tableCheckConstraints, tableExclusionConstraints, tableForeignKeyConstraints, tableIndexConstraints;
|
|
2278
2241
|
var _this = this;
|
|
2279
|
-
return tslib_1.__generator(this, function (_b) {
|
|
2242
|
+
return (0, tslib_1.__generator)(this, function (_b) {
|
|
2280
2243
|
switch (_b.label) {
|
|
2281
2244
|
case 0:
|
|
2282
2245
|
table = new Table_1.Table();
|
|
@@ -2293,9 +2256,9 @@ var CockroachQueryRunner = /** @class */ (function (_super) {
|
|
|
2293
2256
|
_a = table;
|
|
2294
2257
|
return [4 /*yield*/, Promise.all(dbColumns
|
|
2295
2258
|
.filter(function (dbColumn) { return dbColumn["table_name"] === dbTable["table_name"] && dbColumn["table_schema"] === dbTable["table_schema"]; })
|
|
2296
|
-
.map(function (dbColumn) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
2259
|
+
.map(function (dbColumn) { return (0, tslib_1.__awaiter)(_this, void 0, void 0, function () {
|
|
2297
2260
|
var columnConstraints, tableColumn, type, length, uniqueConstraint, isConstraintComposite;
|
|
2298
|
-
return tslib_1.__generator(this, function (_a) {
|
|
2261
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
2299
2262
|
columnConstraints = dbConstraints.filter(function (dbConstraint) {
|
|
2300
2263
|
return (dbConstraint["table_name"] === dbColumn["table_name"] &&
|
|
2301
2264
|
dbConstraint["table_schema"] === dbColumn["table_schema"] &&
|
|
@@ -2531,9 +2494,9 @@ var CockroachQueryRunner = /** @class */ (function (_super) {
|
|
|
2531
2494
|
}
|
|
2532
2495
|
};
|
|
2533
2496
|
CockroachQueryRunner.prototype.insertViewDefinitionSql = function (view) {
|
|
2534
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
2497
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
2535
2498
|
var currentSchema, _a, schema, name, expression, _b, query, parameters;
|
|
2536
|
-
return tslib_1.__generator(this, function (_c) {
|
|
2499
|
+
return (0, tslib_1.__generator)(this, function (_c) {
|
|
2537
2500
|
switch (_c.label) {
|
|
2538
2501
|
case 0: return [4 /*yield*/, this.getCurrentSchema()];
|
|
2539
2502
|
case 1:
|
|
@@ -2543,7 +2506,7 @@ var CockroachQueryRunner = /** @class */ (function (_super) {
|
|
|
2543
2506
|
schema = currentSchema;
|
|
2544
2507
|
}
|
|
2545
2508
|
expression = typeof view.expression === "string" ? view.expression.trim() : view.expression(this.connection).getQuery();
|
|
2546
|
-
_b = tslib_1.__read(this.connection.createQueryBuilder()
|
|
2509
|
+
_b = (0, tslib_1.__read)(this.connection.createQueryBuilder()
|
|
2547
2510
|
.insert()
|
|
2548
2511
|
.into(this.getTypeormMetadataTableName())
|
|
2549
2512
|
.values({ type: "VIEW", schema: schema, name: name, value: expression })
|
|
@@ -2563,9 +2526,9 @@ var CockroachQueryRunner = /** @class */ (function (_super) {
|
|
|
2563
2526
|
* Builds remove view sql.
|
|
2564
2527
|
*/
|
|
2565
2528
|
CockroachQueryRunner.prototype.deleteViewDefinitionSql = function (viewOrPath) {
|
|
2566
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
2529
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
2567
2530
|
var currentSchema, _a, schema, name, qb, _b, query, parameters;
|
|
2568
|
-
return tslib_1.__generator(this, function (_c) {
|
|
2531
|
+
return (0, tslib_1.__generator)(this, function (_c) {
|
|
2569
2532
|
switch (_c.label) {
|
|
2570
2533
|
case 0: return [4 /*yield*/, this.getCurrentSchema()];
|
|
2571
2534
|
case 1:
|
|
@@ -2575,7 +2538,7 @@ var CockroachQueryRunner = /** @class */ (function (_super) {
|
|
|
2575
2538
|
schema = currentSchema;
|
|
2576
2539
|
}
|
|
2577
2540
|
qb = this.connection.createQueryBuilder();
|
|
2578
|
-
_b = tslib_1.__read(qb.delete()
|
|
2541
|
+
_b = (0, tslib_1.__read)(qb.delete()
|
|
2579
2542
|
.from(this.getTypeormMetadataTableName())
|
|
2580
2543
|
.where(qb.escape("type") + " = 'VIEW'")
|
|
2581
2544
|
.andWhere(qb.escape("schema") + " = :schema", { schema: schema })
|