typeorm 0.2.38 → 0.2.39-dev.2c861af
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 +60 -59
- 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 +5 -4
- package/browser/driver/cockroachdb/CockroachDriver.js.map +1 -1
- package/browser/driver/cockroachdb/CockroachQueryRunner.js +46 -77
- 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.js +2 -1
- package/browser/driver/cordova/CordovaDriver.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.js +6 -5
- package/browser/driver/postgres/PostgresDriver.js.map +1 -1
- package/browser/driver/postgres/PostgresQueryRunner.js +21 -51
- 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 +20 -50
- 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 +4 -2
- package/browser/driver/sqljs/SqljsDriver.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/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 +1 -1
- 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 +2 -2
- package/browser/query-builder/transformer/RawSqlResultsToEntityTransformer.js.map +1 -1
- package/browser/query-runner/BaseQueryRunner.js +2 -2
- 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.js +223 -148
- 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/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 +5 -5
- package/commands/SchemaLogCommand.js.map +1 -1
- package/commands/SchemaSyncCommand.js +4 -4
- 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 +15 -14
- package/driver/cockroachdb/CockroachDriver.js.map +1 -1
- package/driver/cockroachdb/CockroachQueryRunner.js +180 -211
- 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.js +5 -4
- package/driver/cordova/CordovaDriver.js.map +1 -1
- package/driver/cordova/CordovaQueryRunner.js +13 -13
- 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.js +24 -23
- package/driver/postgres/PostgresDriver.js.map +1 -1
- package/driver/postgres/PostgresQueryRunner.js +169 -199
- 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 +153 -183
- 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 +17 -15
- package/driver/sqljs/SqljsDriver.js.map +1 -1
- package/driver/sqljs/SqljsQueryRunner.js +9 -9
- 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.js +33 -33
- 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 -239
- 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 +31 -31
- 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 +2 -2
- package/query-builder/transformer/RawSqlResultsToEntityTransformer.js.map +1 -1
- package/query-runner/BaseQueryRunner.js +25 -25
- 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.js +311 -236
- 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 +2 -2
- package/util/StringUtils.js.map +1 -1
|
@@ -19,14 +19,13 @@ var Broadcaster_1 = require("../../subscriber/Broadcaster");
|
|
|
19
19
|
var OrmUtils_1 = require("../../util/OrmUtils");
|
|
20
20
|
var Query_1 = require("../Query");
|
|
21
21
|
var MssqlParameter_1 = require("./MssqlParameter");
|
|
22
|
-
var BroadcasterResult_1 = require("../../subscriber/BroadcasterResult");
|
|
23
22
|
var error_1 = require("../../error");
|
|
24
23
|
var QueryLock_1 = require("../../query-runner/QueryLock");
|
|
25
24
|
/**
|
|
26
25
|
* Runs queries on a single SQL Server database connection.
|
|
27
26
|
*/
|
|
28
27
|
var SqlServerQueryRunner = /** @class */ (function (_super) {
|
|
29
|
-
tslib_1.__extends(SqlServerQueryRunner, _super);
|
|
28
|
+
(0, tslib_1.__extends)(SqlServerQueryRunner, _super);
|
|
30
29
|
// -------------------------------------------------------------------------
|
|
31
30
|
// Constructor
|
|
32
31
|
// -------------------------------------------------------------------------
|
|
@@ -64,62 +63,53 @@ var SqlServerQueryRunner = /** @class */ (function (_super) {
|
|
|
64
63
|
* Starts transaction.
|
|
65
64
|
*/
|
|
66
65
|
SqlServerQueryRunner.prototype.startTransaction = function (isolationLevel) {
|
|
67
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
68
|
-
var beforeBroadcastResult;
|
|
66
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
69
67
|
var _this = this;
|
|
70
|
-
return tslib_1.__generator(this, function (_a) {
|
|
68
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
71
69
|
switch (_a.label) {
|
|
72
70
|
case 0:
|
|
73
71
|
if (this.isReleased)
|
|
74
72
|
throw new QueryRunnerAlreadyReleasedError_1.QueryRunnerAlreadyReleasedError();
|
|
75
73
|
if (this.isTransactionActive)
|
|
76
74
|
throw new TransactionAlreadyStartedError_1.TransactionAlreadyStartedError();
|
|
77
|
-
|
|
78
|
-
this.broadcaster.broadcastBeforeTransactionStartEvent(beforeBroadcastResult);
|
|
79
|
-
if (!(beforeBroadcastResult.promises.length > 0)) return [3 /*break*/, 2];
|
|
80
|
-
return [4 /*yield*/, Promise.all(beforeBroadcastResult.promises)];
|
|
75
|
+
return [4 /*yield*/, this.broadcaster.broadcast('BeforeTransactionStart')];
|
|
81
76
|
case 1:
|
|
82
77
|
_a.sent();
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
78
|
+
return [2 /*return*/, new Promise(function (ok, fail) { return (0, tslib_1.__awaiter)(_this, void 0, void 0, function () {
|
|
79
|
+
var pool, transactionCallback;
|
|
80
|
+
var _this = this;
|
|
81
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
82
|
+
switch (_a.label) {
|
|
83
|
+
case 0:
|
|
84
|
+
this.isTransactionActive = true;
|
|
85
|
+
return [4 /*yield*/, (this.mode === "slave" ? this.driver.obtainSlaveConnection() : this.driver.obtainMasterConnection())];
|
|
86
|
+
case 1:
|
|
87
|
+
pool = _a.sent();
|
|
88
|
+
this.databaseConnection = pool.transaction();
|
|
89
|
+
transactionCallback = function (err) {
|
|
90
|
+
if (err) {
|
|
91
|
+
_this.isTransactionActive = false;
|
|
92
|
+
return fail(err);
|
|
93
|
+
}
|
|
94
|
+
ok();
|
|
95
|
+
_this.connection.logger.logQuery("BEGIN TRANSACTION");
|
|
96
|
+
if (isolationLevel) {
|
|
97
|
+
_this.connection.logger.logQuery("SET TRANSACTION ISOLATION LEVEL " + isolationLevel);
|
|
98
|
+
}
|
|
99
|
+
};
|
|
102
100
|
if (isolationLevel) {
|
|
103
|
-
|
|
101
|
+
this.databaseConnection.begin(this.convertIsolationLevel(isolationLevel), transactionCallback);
|
|
104
102
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
return [4 /*yield*/, Promise.all(afterBroadcastResult.promises)];
|
|
116
|
-
case 2:
|
|
117
|
-
_a.sent();
|
|
118
|
-
_a.label = 3;
|
|
119
|
-
case 3: return [2 /*return*/];
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
}); })];
|
|
103
|
+
else {
|
|
104
|
+
this.databaseConnection.begin(transactionCallback);
|
|
105
|
+
}
|
|
106
|
+
return [4 /*yield*/, this.broadcaster.broadcast('AfterTransactionStart')];
|
|
107
|
+
case 2:
|
|
108
|
+
_a.sent();
|
|
109
|
+
return [2 /*return*/];
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
}); })];
|
|
123
113
|
}
|
|
124
114
|
});
|
|
125
115
|
});
|
|
@@ -129,48 +119,37 @@ var SqlServerQueryRunner = /** @class */ (function (_super) {
|
|
|
129
119
|
* Error will be thrown if transaction was not started.
|
|
130
120
|
*/
|
|
131
121
|
SqlServerQueryRunner.prototype.commitTransaction = function () {
|
|
132
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
133
|
-
var beforeBroadcastResult;
|
|
122
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
134
123
|
var _this = this;
|
|
135
|
-
return tslib_1.__generator(this, function (_a) {
|
|
124
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
136
125
|
switch (_a.label) {
|
|
137
126
|
case 0:
|
|
138
127
|
if (this.isReleased)
|
|
139
128
|
throw new QueryRunnerAlreadyReleasedError_1.QueryRunnerAlreadyReleasedError();
|
|
140
129
|
if (!this.isTransactionActive)
|
|
141
130
|
throw new TransactionNotStartedError_1.TransactionNotStartedError();
|
|
142
|
-
|
|
143
|
-
this.broadcaster.broadcastBeforeTransactionCommitEvent(beforeBroadcastResult);
|
|
144
|
-
if (!(beforeBroadcastResult.promises.length > 0)) return [3 /*break*/, 2];
|
|
145
|
-
return [4 /*yield*/, Promise.all(beforeBroadcastResult.promises)];
|
|
131
|
+
return [4 /*yield*/, this.broadcaster.broadcast('BeforeTransactionCommit')];
|
|
146
132
|
case 1:
|
|
147
133
|
_a.sent();
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
ok();
|
|
168
|
-
this.connection.logger.logQuery("COMMIT");
|
|
169
|
-
return [2 /*return*/];
|
|
170
|
-
}
|
|
171
|
-
});
|
|
172
|
-
}); });
|
|
173
|
-
})];
|
|
134
|
+
return [2 /*return*/, new Promise(function (ok, fail) {
|
|
135
|
+
_this.databaseConnection.commit(function (err) { return (0, tslib_1.__awaiter)(_this, void 0, void 0, function () {
|
|
136
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
137
|
+
switch (_a.label) {
|
|
138
|
+
case 0:
|
|
139
|
+
if (err)
|
|
140
|
+
return [2 /*return*/, fail(err)];
|
|
141
|
+
this.isTransactionActive = false;
|
|
142
|
+
this.databaseConnection = null;
|
|
143
|
+
return [4 /*yield*/, this.broadcaster.broadcast('AfterTransactionCommit')];
|
|
144
|
+
case 1:
|
|
145
|
+
_a.sent();
|
|
146
|
+
ok();
|
|
147
|
+
this.connection.logger.logQuery("COMMIT");
|
|
148
|
+
return [2 /*return*/];
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
}); });
|
|
152
|
+
})];
|
|
174
153
|
}
|
|
175
154
|
});
|
|
176
155
|
});
|
|
@@ -180,48 +159,37 @@ var SqlServerQueryRunner = /** @class */ (function (_super) {
|
|
|
180
159
|
* Error will be thrown if transaction was not started.
|
|
181
160
|
*/
|
|
182
161
|
SqlServerQueryRunner.prototype.rollbackTransaction = function () {
|
|
183
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
184
|
-
var beforeBroadcastResult;
|
|
162
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
185
163
|
var _this = this;
|
|
186
|
-
return tslib_1.__generator(this, function (_a) {
|
|
164
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
187
165
|
switch (_a.label) {
|
|
188
166
|
case 0:
|
|
189
167
|
if (this.isReleased)
|
|
190
168
|
throw new QueryRunnerAlreadyReleasedError_1.QueryRunnerAlreadyReleasedError();
|
|
191
169
|
if (!this.isTransactionActive)
|
|
192
170
|
throw new TransactionNotStartedError_1.TransactionNotStartedError();
|
|
193
|
-
|
|
194
|
-
this.broadcaster.broadcastBeforeTransactionRollbackEvent(beforeBroadcastResult);
|
|
195
|
-
if (!(beforeBroadcastResult.promises.length > 0)) return [3 /*break*/, 2];
|
|
196
|
-
return [4 /*yield*/, Promise.all(beforeBroadcastResult.promises)];
|
|
171
|
+
return [4 /*yield*/, this.broadcaster.broadcast('BeforeTransactionRollback')];
|
|
197
172
|
case 1:
|
|
198
173
|
_a.sent();
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
ok();
|
|
219
|
-
this.connection.logger.logQuery("ROLLBACK");
|
|
220
|
-
return [2 /*return*/];
|
|
221
|
-
}
|
|
222
|
-
});
|
|
223
|
-
}); });
|
|
224
|
-
})];
|
|
174
|
+
return [2 /*return*/, new Promise(function (ok, fail) {
|
|
175
|
+
_this.databaseConnection.rollback(function (err) { return (0, tslib_1.__awaiter)(_this, void 0, void 0, function () {
|
|
176
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
177
|
+
switch (_a.label) {
|
|
178
|
+
case 0:
|
|
179
|
+
if (err)
|
|
180
|
+
return [2 /*return*/, fail(err)];
|
|
181
|
+
this.isTransactionActive = false;
|
|
182
|
+
this.databaseConnection = null;
|
|
183
|
+
return [4 /*yield*/, this.broadcaster.broadcast('AfterTransactionRollback')];
|
|
184
|
+
case 1:
|
|
185
|
+
_a.sent();
|
|
186
|
+
ok();
|
|
187
|
+
this.connection.logger.logQuery("ROLLBACK");
|
|
188
|
+
return [2 /*return*/];
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
}); });
|
|
192
|
+
})];
|
|
225
193
|
}
|
|
226
194
|
});
|
|
227
195
|
});
|
|
@@ -231,10 +199,10 @@ var SqlServerQueryRunner = /** @class */ (function (_super) {
|
|
|
231
199
|
*/
|
|
232
200
|
SqlServerQueryRunner.prototype.query = function (query, parameters, useStructuredResult) {
|
|
233
201
|
if (useStructuredResult === void 0) { useStructuredResult = false; }
|
|
234
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
202
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
235
203
|
var release, pool, request_1, queryStartTime_1, raw, result, queryType, err_1;
|
|
236
204
|
var _this = this;
|
|
237
|
-
return tslib_1.__generator(this, function (_a) {
|
|
205
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
238
206
|
switch (_a.label) {
|
|
239
207
|
case 0:
|
|
240
208
|
if (this.isReleased)
|
|
@@ -324,10 +292,10 @@ var SqlServerQueryRunner = /** @class */ (function (_super) {
|
|
|
324
292
|
* Returns raw data stream.
|
|
325
293
|
*/
|
|
326
294
|
SqlServerQueryRunner.prototype.stream = function (query, parameters, onEnd, onError) {
|
|
327
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
295
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
328
296
|
var release, pool, request, PassThrough;
|
|
329
297
|
var _this = this;
|
|
330
|
-
return tslib_1.__generator(this, function (_a) {
|
|
298
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
331
299
|
switch (_a.label) {
|
|
332
300
|
case 0:
|
|
333
301
|
if (this.isReleased)
|
|
@@ -377,9 +345,9 @@ var SqlServerQueryRunner = /** @class */ (function (_super) {
|
|
|
377
345
|
* Returns all available database names including system databases.
|
|
378
346
|
*/
|
|
379
347
|
SqlServerQueryRunner.prototype.getDatabases = function () {
|
|
380
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
348
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
381
349
|
var results;
|
|
382
|
-
return tslib_1.__generator(this, function (_a) {
|
|
350
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
383
351
|
switch (_a.label) {
|
|
384
352
|
case 0: return [4 /*yield*/, this.query("EXEC sp_databases")];
|
|
385
353
|
case 1:
|
|
@@ -394,9 +362,9 @@ var SqlServerQueryRunner = /** @class */ (function (_super) {
|
|
|
394
362
|
* If database parameter specified, returns schemas of that database.
|
|
395
363
|
*/
|
|
396
364
|
SqlServerQueryRunner.prototype.getSchemas = function (database) {
|
|
397
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
365
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
398
366
|
var query, results;
|
|
399
|
-
return tslib_1.__generator(this, function (_a) {
|
|
367
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
400
368
|
switch (_a.label) {
|
|
401
369
|
case 0:
|
|
402
370
|
query = database ? "SELECT * FROM \"" + database + "\".\"sys\".\"schema\"" : "SELECT * FROM \"sys\".\"schemas\"";
|
|
@@ -412,9 +380,9 @@ var SqlServerQueryRunner = /** @class */ (function (_super) {
|
|
|
412
380
|
* Checks if database with the given name exist.
|
|
413
381
|
*/
|
|
414
382
|
SqlServerQueryRunner.prototype.hasDatabase = function (database) {
|
|
415
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
383
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
416
384
|
var result, dbId;
|
|
417
|
-
return tslib_1.__generator(this, function (_a) {
|
|
385
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
418
386
|
switch (_a.label) {
|
|
419
387
|
case 0: return [4 /*yield*/, this.query("SELECT DB_ID('" + database + "') as \"db_id\"")];
|
|
420
388
|
case 1:
|
|
@@ -429,9 +397,9 @@ var SqlServerQueryRunner = /** @class */ (function (_super) {
|
|
|
429
397
|
* Loads currently using database
|
|
430
398
|
*/
|
|
431
399
|
SqlServerQueryRunner.prototype.getCurrentDatabase = function () {
|
|
432
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
400
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
433
401
|
var currentDBQuery;
|
|
434
|
-
return tslib_1.__generator(this, function (_a) {
|
|
402
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
435
403
|
switch (_a.label) {
|
|
436
404
|
case 0: return [4 /*yield*/, this.query("SELECT DB_NAME() AS \"db_name\"")];
|
|
437
405
|
case 1:
|
|
@@ -445,9 +413,9 @@ var SqlServerQueryRunner = /** @class */ (function (_super) {
|
|
|
445
413
|
* Checks if schema with the given name exist.
|
|
446
414
|
*/
|
|
447
415
|
SqlServerQueryRunner.prototype.hasSchema = function (schema) {
|
|
448
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
416
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
449
417
|
var result, schemaId;
|
|
450
|
-
return tslib_1.__generator(this, function (_a) {
|
|
418
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
451
419
|
switch (_a.label) {
|
|
452
420
|
case 0: return [4 /*yield*/, this.query("SELECT SCHEMA_ID('" + schema + "') as \"schema_id\"")];
|
|
453
421
|
case 1:
|
|
@@ -462,9 +430,9 @@ var SqlServerQueryRunner = /** @class */ (function (_super) {
|
|
|
462
430
|
* Loads currently using database schema
|
|
463
431
|
*/
|
|
464
432
|
SqlServerQueryRunner.prototype.getCurrentSchema = function () {
|
|
465
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
433
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
466
434
|
var currentSchemaQuery;
|
|
467
|
-
return tslib_1.__generator(this, function (_a) {
|
|
435
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
468
436
|
switch (_a.label) {
|
|
469
437
|
case 0: return [4 /*yield*/, this.query("SELECT SCHEMA_NAME() AS \"schema_name\"")];
|
|
470
438
|
case 1:
|
|
@@ -478,9 +446,9 @@ var SqlServerQueryRunner = /** @class */ (function (_super) {
|
|
|
478
446
|
* Checks if table with the given name exist in the database.
|
|
479
447
|
*/
|
|
480
448
|
SqlServerQueryRunner.prototype.hasTable = function (tableOrName) {
|
|
481
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
449
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
482
450
|
var parsedTableName, _a, _b, sql, result;
|
|
483
|
-
return tslib_1.__generator(this, function (_c) {
|
|
451
|
+
return (0, tslib_1.__generator)(this, function (_c) {
|
|
484
452
|
switch (_c.label) {
|
|
485
453
|
case 0:
|
|
486
454
|
parsedTableName = this.driver.parseTableName(tableOrName);
|
|
@@ -511,9 +479,9 @@ var SqlServerQueryRunner = /** @class */ (function (_super) {
|
|
|
511
479
|
* Checks if column exist in the table.
|
|
512
480
|
*/
|
|
513
481
|
SqlServerQueryRunner.prototype.hasColumn = function (tableOrName, columnName) {
|
|
514
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
482
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
515
483
|
var parsedTableName, _a, _b, sql, result;
|
|
516
|
-
return tslib_1.__generator(this, function (_c) {
|
|
484
|
+
return (0, tslib_1.__generator)(this, function (_c) {
|
|
517
485
|
switch (_c.label) {
|
|
518
486
|
case 0:
|
|
519
487
|
parsedTableName = this.driver.parseTableName(tableOrName);
|
|
@@ -544,9 +512,9 @@ var SqlServerQueryRunner = /** @class */ (function (_super) {
|
|
|
544
512
|
* Creates a new database.
|
|
545
513
|
*/
|
|
546
514
|
SqlServerQueryRunner.prototype.createDatabase = function (database, ifNotExist) {
|
|
547
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
515
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
548
516
|
var up, down;
|
|
549
|
-
return tslib_1.__generator(this, function (_a) {
|
|
517
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
550
518
|
switch (_a.label) {
|
|
551
519
|
case 0:
|
|
552
520
|
up = ifNotExist ? "IF DB_ID('" + database + "') IS NULL CREATE DATABASE \"" + database + "\"" : "CREATE DATABASE \"" + database + "\"";
|
|
@@ -563,9 +531,9 @@ var SqlServerQueryRunner = /** @class */ (function (_super) {
|
|
|
563
531
|
* Drops database.
|
|
564
532
|
*/
|
|
565
533
|
SqlServerQueryRunner.prototype.dropDatabase = function (database, ifExist) {
|
|
566
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
534
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
567
535
|
var up, down;
|
|
568
|
-
return tslib_1.__generator(this, function (_a) {
|
|
536
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
569
537
|
switch (_a.label) {
|
|
570
538
|
case 0:
|
|
571
539
|
up = ifExist ? "IF DB_ID('" + database + "') IS NOT NULL DROP DATABASE \"" + database + "\"" : "DROP DATABASE \"" + database + "\"";
|
|
@@ -583,9 +551,9 @@ var SqlServerQueryRunner = /** @class */ (function (_super) {
|
|
|
583
551
|
* If database name also specified (e.g. 'dbName.schemaName') schema will be created in specified database.
|
|
584
552
|
*/
|
|
585
553
|
SqlServerQueryRunner.prototype.createSchema = function (schemaPath, ifNotExist) {
|
|
586
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
554
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
587
555
|
var upQueries, downQueries, upQuery, dbName, schema, currentDB, upQuery;
|
|
588
|
-
return tslib_1.__generator(this, function (_a) {
|
|
556
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
589
557
|
switch (_a.label) {
|
|
590
558
|
case 0:
|
|
591
559
|
upQueries = [];
|
|
@@ -622,9 +590,9 @@ var SqlServerQueryRunner = /** @class */ (function (_super) {
|
|
|
622
590
|
* If database name also specified (e.g. 'dbName.schemaName') schema will be dropped in specified database.
|
|
623
591
|
*/
|
|
624
592
|
SqlServerQueryRunner.prototype.dropSchema = function (schemaPath, ifExist) {
|
|
625
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
593
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
626
594
|
var upQueries, downQueries, upQuery, dbName, schema, currentDB, upQuery;
|
|
627
|
-
return tslib_1.__generator(this, function (_a) {
|
|
595
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
628
596
|
switch (_a.label) {
|
|
629
597
|
case 0:
|
|
630
598
|
upQueries = [];
|
|
@@ -663,10 +631,10 @@ var SqlServerQueryRunner = /** @class */ (function (_super) {
|
|
|
663
631
|
if (ifNotExist === void 0) { ifNotExist = false; }
|
|
664
632
|
if (createForeignKeys === void 0) { createForeignKeys = true; }
|
|
665
633
|
if (createIndices === void 0) { createIndices = true; }
|
|
666
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
634
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
667
635
|
var isTableExist, upQueries, downQueries;
|
|
668
636
|
var _this = this;
|
|
669
|
-
return tslib_1.__generator(this, function (_a) {
|
|
637
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
670
638
|
switch (_a.label) {
|
|
671
639
|
case 0:
|
|
672
640
|
if (!ifNotExist) return [3 /*break*/, 2];
|
|
@@ -708,10 +676,10 @@ var SqlServerQueryRunner = /** @class */ (function (_super) {
|
|
|
708
676
|
SqlServerQueryRunner.prototype.dropTable = function (tableOrName, ifExist, dropForeignKeys, dropIndices) {
|
|
709
677
|
if (dropForeignKeys === void 0) { dropForeignKeys = true; }
|
|
710
678
|
if (dropIndices === void 0) { dropIndices = true; }
|
|
711
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
679
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
712
680
|
var isTableExist, createForeignKeys, table, _a, upQueries, downQueries;
|
|
713
681
|
var _this = this;
|
|
714
|
-
return tslib_1.__generator(this, function (_b) {
|
|
682
|
+
return (0, tslib_1.__generator)(this, function (_b) {
|
|
715
683
|
switch (_b.label) {
|
|
716
684
|
case 0:
|
|
717
685
|
if (!ifExist) return [3 /*break*/, 2];
|
|
@@ -760,9 +728,9 @@ var SqlServerQueryRunner = /** @class */ (function (_super) {
|
|
|
760
728
|
* Creates a new view.
|
|
761
729
|
*/
|
|
762
730
|
SqlServerQueryRunner.prototype.createView = function (view) {
|
|
763
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
731
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
764
732
|
var upQueries, downQueries, _a, _b, _c, _d;
|
|
765
|
-
return tslib_1.__generator(this, function (_e) {
|
|
733
|
+
return (0, tslib_1.__generator)(this, function (_e) {
|
|
766
734
|
switch (_e.label) {
|
|
767
735
|
case 0:
|
|
768
736
|
upQueries = [];
|
|
@@ -789,9 +757,9 @@ var SqlServerQueryRunner = /** @class */ (function (_super) {
|
|
|
789
757
|
* Drops the view.
|
|
790
758
|
*/
|
|
791
759
|
SqlServerQueryRunner.prototype.dropView = function (target) {
|
|
792
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
760
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
793
761
|
var viewName, view, upQueries, downQueries, _a, _b, _c, _d;
|
|
794
|
-
return tslib_1.__generator(this, function (_e) {
|
|
762
|
+
return (0, tslib_1.__generator)(this, function (_e) {
|
|
795
763
|
switch (_e.label) {
|
|
796
764
|
case 0:
|
|
797
765
|
viewName = target instanceof View_1.View ? target.name : target;
|
|
@@ -822,10 +790,10 @@ var SqlServerQueryRunner = /** @class */ (function (_super) {
|
|
|
822
790
|
* Renames a table.
|
|
823
791
|
*/
|
|
824
792
|
SqlServerQueryRunner.prototype.renameTable = function (oldTableOrName, newTableName) {
|
|
825
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
793
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
826
794
|
var upQueries, downQueries, oldTable, _a, newTable, dbName, schemaName, oldTableName, splittedName, currentDB, columnNames, oldPkName, newPkName;
|
|
827
795
|
var _this = this;
|
|
828
|
-
return tslib_1.__generator(this, function (_b) {
|
|
796
|
+
return (0, tslib_1.__generator)(this, function (_b) {
|
|
829
797
|
switch (_b.label) {
|
|
830
798
|
case 0:
|
|
831
799
|
upQueries = [];
|
|
@@ -924,9 +892,9 @@ var SqlServerQueryRunner = /** @class */ (function (_super) {
|
|
|
924
892
|
* Creates a new column from the column in the table.
|
|
925
893
|
*/
|
|
926
894
|
SqlServerQueryRunner.prototype.addColumn = function (tableOrName, column) {
|
|
927
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
895
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
928
896
|
var table, _a, clonedTable, upQueries, downQueries, primaryColumns, pkName_1, columnNames_1, pkName, columnNames, columnIndex, uniqueConstraint, defaultName;
|
|
929
|
-
return tslib_1.__generator(this, function (_b) {
|
|
897
|
+
return (0, tslib_1.__generator)(this, function (_b) {
|
|
930
898
|
switch (_b.label) {
|
|
931
899
|
case 0:
|
|
932
900
|
if (!(tableOrName instanceof Table_1.Table)) return [3 /*break*/, 1];
|
|
@@ -993,14 +961,14 @@ var SqlServerQueryRunner = /** @class */ (function (_super) {
|
|
|
993
961
|
* Creates a new columns from the column in the table.
|
|
994
962
|
*/
|
|
995
963
|
SqlServerQueryRunner.prototype.addColumns = function (tableOrName, columns) {
|
|
996
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
964
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
997
965
|
var columns_1, columns_1_1, column, e_1_1;
|
|
998
966
|
var e_1, _a;
|
|
999
|
-
return tslib_1.__generator(this, function (_b) {
|
|
967
|
+
return (0, tslib_1.__generator)(this, function (_b) {
|
|
1000
968
|
switch (_b.label) {
|
|
1001
969
|
case 0:
|
|
1002
970
|
_b.trys.push([0, 5, 6, 7]);
|
|
1003
|
-
columns_1 = tslib_1.__values(columns), columns_1_1 = columns_1.next();
|
|
971
|
+
columns_1 = (0, tslib_1.__values)(columns), columns_1_1 = columns_1.next();
|
|
1004
972
|
_b.label = 1;
|
|
1005
973
|
case 1:
|
|
1006
974
|
if (!!columns_1_1.done) return [3 /*break*/, 4];
|
|
@@ -1032,9 +1000,9 @@ var SqlServerQueryRunner = /** @class */ (function (_super) {
|
|
|
1032
1000
|
* Renames column in the given table.
|
|
1033
1001
|
*/
|
|
1034
1002
|
SqlServerQueryRunner.prototype.renameColumn = function (tableOrName, oldTableColumnOrName, newTableColumnOrName) {
|
|
1035
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1003
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1036
1004
|
var table, _a, oldColumn, newColumn;
|
|
1037
|
-
return tslib_1.__generator(this, function (_b) {
|
|
1005
|
+
return (0, tslib_1.__generator)(this, function (_b) {
|
|
1038
1006
|
switch (_b.label) {
|
|
1039
1007
|
case 0:
|
|
1040
1008
|
if (!(tableOrName instanceof Table_1.Table)) return [3 /*break*/, 1];
|
|
@@ -1069,10 +1037,10 @@ var SqlServerQueryRunner = /** @class */ (function (_super) {
|
|
|
1069
1037
|
* Changes a column in the table.
|
|
1070
1038
|
*/
|
|
1071
1039
|
SqlServerQueryRunner.prototype.changeColumn = function (tableOrName, oldTableColumnOrName, newColumn) {
|
|
1072
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1040
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1073
1041
|
var table, _a, clonedTable, upQueries, downQueries, oldColumn, dbName_1, schemaName_1, splittedName, currentDB, primaryColumns, columnNames, oldPkName, newPkName, oldDefaultName, newDefaultName, oldTableColumn, primaryColumns, pkName, columnNames, column, pkName, columnNames, primaryColumn, column, pkName, columnNames, uniqueConstraint, uniqueConstraint, defaultName, defaultName;
|
|
1074
1042
|
var _this = this;
|
|
1075
|
-
return tslib_1.__generator(this, function (_b) {
|
|
1043
|
+
return (0, tslib_1.__generator)(this, function (_b) {
|
|
1076
1044
|
switch (_b.label) {
|
|
1077
1045
|
case 0:
|
|
1078
1046
|
if (!(tableOrName instanceof Table_1.Table)) return [3 /*break*/, 1];
|
|
@@ -1290,14 +1258,14 @@ var SqlServerQueryRunner = /** @class */ (function (_super) {
|
|
|
1290
1258
|
* Changes a column in the table.
|
|
1291
1259
|
*/
|
|
1292
1260
|
SqlServerQueryRunner.prototype.changeColumns = function (tableOrName, changedColumns) {
|
|
1293
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1261
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1294
1262
|
var changedColumns_1, changedColumns_1_1, _a, oldColumn, newColumn, e_2_1;
|
|
1295
1263
|
var e_2, _b;
|
|
1296
|
-
return tslib_1.__generator(this, function (_c) {
|
|
1264
|
+
return (0, tslib_1.__generator)(this, function (_c) {
|
|
1297
1265
|
switch (_c.label) {
|
|
1298
1266
|
case 0:
|
|
1299
1267
|
_c.trys.push([0, 5, 6, 7]);
|
|
1300
|
-
changedColumns_1 = tslib_1.__values(changedColumns), changedColumns_1_1 = changedColumns_1.next();
|
|
1268
|
+
changedColumns_1 = (0, tslib_1.__values)(changedColumns), changedColumns_1_1 = changedColumns_1.next();
|
|
1301
1269
|
_c.label = 1;
|
|
1302
1270
|
case 1:
|
|
1303
1271
|
if (!!changedColumns_1_1.done) return [3 /*break*/, 4];
|
|
@@ -1329,9 +1297,9 @@ var SqlServerQueryRunner = /** @class */ (function (_super) {
|
|
|
1329
1297
|
* Drops column in the table.
|
|
1330
1298
|
*/
|
|
1331
1299
|
SqlServerQueryRunner.prototype.dropColumn = function (tableOrName, columnOrName) {
|
|
1332
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1300
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1333
1301
|
var table, _a, column, clonedTable, upQueries, downQueries, pkName, columnNames, tableColumn, pkName_2, columnNames_2, columnIndex, columnCheck, columnUnique, defaultName;
|
|
1334
|
-
return tslib_1.__generator(this, function (_b) {
|
|
1302
|
+
return (0, tslib_1.__generator)(this, function (_b) {
|
|
1335
1303
|
switch (_b.label) {
|
|
1336
1304
|
case 0:
|
|
1337
1305
|
if (!(tableOrName instanceof Table_1.Table)) return [3 /*break*/, 1];
|
|
@@ -1405,14 +1373,14 @@ var SqlServerQueryRunner = /** @class */ (function (_super) {
|
|
|
1405
1373
|
* Drops the columns in the table.
|
|
1406
1374
|
*/
|
|
1407
1375
|
SqlServerQueryRunner.prototype.dropColumns = function (tableOrName, columns) {
|
|
1408
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1376
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1409
1377
|
var columns_2, columns_2_1, column, e_3_1;
|
|
1410
1378
|
var e_3, _a;
|
|
1411
|
-
return tslib_1.__generator(this, function (_b) {
|
|
1379
|
+
return (0, tslib_1.__generator)(this, function (_b) {
|
|
1412
1380
|
switch (_b.label) {
|
|
1413
1381
|
case 0:
|
|
1414
1382
|
_b.trys.push([0, 5, 6, 7]);
|
|
1415
|
-
columns_2 = tslib_1.__values(columns), columns_2_1 = columns_2.next();
|
|
1383
|
+
columns_2 = (0, tslib_1.__values)(columns), columns_2_1 = columns_2.next();
|
|
1416
1384
|
_b.label = 1;
|
|
1417
1385
|
case 1:
|
|
1418
1386
|
if (!!columns_2_1.done) return [3 /*break*/, 4];
|
|
@@ -1444,9 +1412,9 @@ var SqlServerQueryRunner = /** @class */ (function (_super) {
|
|
|
1444
1412
|
* Creates a new primary key.
|
|
1445
1413
|
*/
|
|
1446
1414
|
SqlServerQueryRunner.prototype.createPrimaryKey = function (tableOrName, columnNames) {
|
|
1447
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1415
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1448
1416
|
var table, _a, clonedTable, up, down;
|
|
1449
|
-
return tslib_1.__generator(this, function (_b) {
|
|
1417
|
+
return (0, tslib_1.__generator)(this, function (_b) {
|
|
1450
1418
|
switch (_b.label) {
|
|
1451
1419
|
case 0:
|
|
1452
1420
|
if (!(tableOrName instanceof Table_1.Table)) return [3 /*break*/, 1];
|
|
@@ -1479,9 +1447,9 @@ var SqlServerQueryRunner = /** @class */ (function (_super) {
|
|
|
1479
1447
|
* Updates composite primary keys.
|
|
1480
1448
|
*/
|
|
1481
1449
|
SqlServerQueryRunner.prototype.updatePrimaryKeys = function (tableOrName, columns) {
|
|
1482
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1450
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1483
1451
|
var table, _a, clonedTable, columnNames, upQueries, downQueries, primaryColumns, pkName_3, columnNamesString_1, pkName, columnNamesString;
|
|
1484
|
-
return tslib_1.__generator(this, function (_b) {
|
|
1452
|
+
return (0, tslib_1.__generator)(this, function (_b) {
|
|
1485
1453
|
switch (_b.label) {
|
|
1486
1454
|
case 0:
|
|
1487
1455
|
if (!(tableOrName instanceof Table_1.Table)) return [3 /*break*/, 1];
|
|
@@ -1525,9 +1493,9 @@ var SqlServerQueryRunner = /** @class */ (function (_super) {
|
|
|
1525
1493
|
* Drops a primary key.
|
|
1526
1494
|
*/
|
|
1527
1495
|
SqlServerQueryRunner.prototype.dropPrimaryKey = function (tableOrName) {
|
|
1528
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1496
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1529
1497
|
var table, _a, up, down;
|
|
1530
|
-
return tslib_1.__generator(this, function (_b) {
|
|
1498
|
+
return (0, tslib_1.__generator)(this, function (_b) {
|
|
1531
1499
|
switch (_b.label) {
|
|
1532
1500
|
case 0:
|
|
1533
1501
|
if (!(tableOrName instanceof Table_1.Table)) return [3 /*break*/, 1];
|
|
@@ -1556,9 +1524,9 @@ var SqlServerQueryRunner = /** @class */ (function (_super) {
|
|
|
1556
1524
|
* Creates a new unique constraint.
|
|
1557
1525
|
*/
|
|
1558
1526
|
SqlServerQueryRunner.prototype.createUniqueConstraint = function (tableOrName, uniqueConstraint) {
|
|
1559
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1527
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1560
1528
|
var table, _a, up, down;
|
|
1561
|
-
return tslib_1.__generator(this, function (_b) {
|
|
1529
|
+
return (0, tslib_1.__generator)(this, function (_b) {
|
|
1562
1530
|
switch (_b.label) {
|
|
1563
1531
|
case 0:
|
|
1564
1532
|
if (!(tableOrName instanceof Table_1.Table)) return [3 /*break*/, 1];
|
|
@@ -1588,10 +1556,10 @@ var SqlServerQueryRunner = /** @class */ (function (_super) {
|
|
|
1588
1556
|
* Creates a new unique constraints.
|
|
1589
1557
|
*/
|
|
1590
1558
|
SqlServerQueryRunner.prototype.createUniqueConstraints = function (tableOrName, uniqueConstraints) {
|
|
1591
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1559
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1592
1560
|
var promises;
|
|
1593
1561
|
var _this = this;
|
|
1594
|
-
return tslib_1.__generator(this, function (_a) {
|
|
1562
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
1595
1563
|
switch (_a.label) {
|
|
1596
1564
|
case 0:
|
|
1597
1565
|
promises = uniqueConstraints.map(function (uniqueConstraint) { return _this.createUniqueConstraint(tableOrName, uniqueConstraint); });
|
|
@@ -1607,9 +1575,9 @@ var SqlServerQueryRunner = /** @class */ (function (_super) {
|
|
|
1607
1575
|
* Drops unique constraint.
|
|
1608
1576
|
*/
|
|
1609
1577
|
SqlServerQueryRunner.prototype.dropUniqueConstraint = function (tableOrName, uniqueOrName) {
|
|
1610
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1578
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1611
1579
|
var table, _a, uniqueConstraint, up, down;
|
|
1612
|
-
return tslib_1.__generator(this, function (_b) {
|
|
1580
|
+
return (0, tslib_1.__generator)(this, function (_b) {
|
|
1613
1581
|
switch (_b.label) {
|
|
1614
1582
|
case 0:
|
|
1615
1583
|
if (!(tableOrName instanceof Table_1.Table)) return [3 /*break*/, 1];
|
|
@@ -1639,10 +1607,10 @@ var SqlServerQueryRunner = /** @class */ (function (_super) {
|
|
|
1639
1607
|
* Drops an unique constraints.
|
|
1640
1608
|
*/
|
|
1641
1609
|
SqlServerQueryRunner.prototype.dropUniqueConstraints = function (tableOrName, uniqueConstraints) {
|
|
1642
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1610
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1643
1611
|
var promises;
|
|
1644
1612
|
var _this = this;
|
|
1645
|
-
return tslib_1.__generator(this, function (_a) {
|
|
1613
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
1646
1614
|
switch (_a.label) {
|
|
1647
1615
|
case 0:
|
|
1648
1616
|
promises = uniqueConstraints.map(function (uniqueConstraint) { return _this.dropUniqueConstraint(tableOrName, uniqueConstraint); });
|
|
@@ -1658,9 +1626,9 @@ var SqlServerQueryRunner = /** @class */ (function (_super) {
|
|
|
1658
1626
|
* Creates a new check constraint.
|
|
1659
1627
|
*/
|
|
1660
1628
|
SqlServerQueryRunner.prototype.createCheckConstraint = function (tableOrName, checkConstraint) {
|
|
1661
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1629
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1662
1630
|
var table, _a, up, down;
|
|
1663
|
-
return tslib_1.__generator(this, function (_b) {
|
|
1631
|
+
return (0, tslib_1.__generator)(this, function (_b) {
|
|
1664
1632
|
switch (_b.label) {
|
|
1665
1633
|
case 0:
|
|
1666
1634
|
if (!(tableOrName instanceof Table_1.Table)) return [3 /*break*/, 1];
|
|
@@ -1690,10 +1658,10 @@ var SqlServerQueryRunner = /** @class */ (function (_super) {
|
|
|
1690
1658
|
* Creates a new check constraints.
|
|
1691
1659
|
*/
|
|
1692
1660
|
SqlServerQueryRunner.prototype.createCheckConstraints = function (tableOrName, checkConstraints) {
|
|
1693
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1661
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1694
1662
|
var promises;
|
|
1695
1663
|
var _this = this;
|
|
1696
|
-
return tslib_1.__generator(this, function (_a) {
|
|
1664
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
1697
1665
|
switch (_a.label) {
|
|
1698
1666
|
case 0:
|
|
1699
1667
|
promises = checkConstraints.map(function (checkConstraint) { return _this.createCheckConstraint(tableOrName, checkConstraint); });
|
|
@@ -1709,9 +1677,9 @@ var SqlServerQueryRunner = /** @class */ (function (_super) {
|
|
|
1709
1677
|
* Drops check constraint.
|
|
1710
1678
|
*/
|
|
1711
1679
|
SqlServerQueryRunner.prototype.dropCheckConstraint = function (tableOrName, checkOrName) {
|
|
1712
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1680
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1713
1681
|
var table, _a, checkConstraint, up, down;
|
|
1714
|
-
return tslib_1.__generator(this, function (_b) {
|
|
1682
|
+
return (0, tslib_1.__generator)(this, function (_b) {
|
|
1715
1683
|
switch (_b.label) {
|
|
1716
1684
|
case 0:
|
|
1717
1685
|
if (!(tableOrName instanceof Table_1.Table)) return [3 /*break*/, 1];
|
|
@@ -1741,10 +1709,10 @@ var SqlServerQueryRunner = /** @class */ (function (_super) {
|
|
|
1741
1709
|
* Drops check constraints.
|
|
1742
1710
|
*/
|
|
1743
1711
|
SqlServerQueryRunner.prototype.dropCheckConstraints = function (tableOrName, checkConstraints) {
|
|
1744
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1712
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1745
1713
|
var promises;
|
|
1746
1714
|
var _this = this;
|
|
1747
|
-
return tslib_1.__generator(this, function (_a) {
|
|
1715
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
1748
1716
|
switch (_a.label) {
|
|
1749
1717
|
case 0:
|
|
1750
1718
|
promises = checkConstraints.map(function (checkConstraint) { return _this.dropCheckConstraint(tableOrName, checkConstraint); });
|
|
@@ -1760,8 +1728,8 @@ var SqlServerQueryRunner = /** @class */ (function (_super) {
|
|
|
1760
1728
|
* Creates a new exclusion constraint.
|
|
1761
1729
|
*/
|
|
1762
1730
|
SqlServerQueryRunner.prototype.createExclusionConstraint = function (tableOrName, exclusionConstraint) {
|
|
1763
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1764
|
-
return tslib_1.__generator(this, function (_a) {
|
|
1731
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1732
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
1765
1733
|
throw new error_1.TypeORMError("SqlServer does not support exclusion constraints.");
|
|
1766
1734
|
});
|
|
1767
1735
|
});
|
|
@@ -1770,8 +1738,8 @@ var SqlServerQueryRunner = /** @class */ (function (_super) {
|
|
|
1770
1738
|
* Creates a new exclusion constraints.
|
|
1771
1739
|
*/
|
|
1772
1740
|
SqlServerQueryRunner.prototype.createExclusionConstraints = function (tableOrName, exclusionConstraints) {
|
|
1773
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1774
|
-
return tslib_1.__generator(this, function (_a) {
|
|
1741
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1742
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
1775
1743
|
throw new error_1.TypeORMError("SqlServer does not support exclusion constraints.");
|
|
1776
1744
|
});
|
|
1777
1745
|
});
|
|
@@ -1780,8 +1748,8 @@ var SqlServerQueryRunner = /** @class */ (function (_super) {
|
|
|
1780
1748
|
* Drops exclusion constraint.
|
|
1781
1749
|
*/
|
|
1782
1750
|
SqlServerQueryRunner.prototype.dropExclusionConstraint = function (tableOrName, exclusionOrName) {
|
|
1783
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1784
|
-
return tslib_1.__generator(this, function (_a) {
|
|
1751
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1752
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
1785
1753
|
throw new error_1.TypeORMError("SqlServer does not support exclusion constraints.");
|
|
1786
1754
|
});
|
|
1787
1755
|
});
|
|
@@ -1790,8 +1758,8 @@ var SqlServerQueryRunner = /** @class */ (function (_super) {
|
|
|
1790
1758
|
* Drops exclusion constraints.
|
|
1791
1759
|
*/
|
|
1792
1760
|
SqlServerQueryRunner.prototype.dropExclusionConstraints = function (tableOrName, exclusionConstraints) {
|
|
1793
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1794
|
-
return tslib_1.__generator(this, function (_a) {
|
|
1761
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1762
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
1795
1763
|
throw new error_1.TypeORMError("SqlServer does not support exclusion constraints.");
|
|
1796
1764
|
});
|
|
1797
1765
|
});
|
|
@@ -1800,9 +1768,9 @@ var SqlServerQueryRunner = /** @class */ (function (_super) {
|
|
|
1800
1768
|
* Creates a new foreign key.
|
|
1801
1769
|
*/
|
|
1802
1770
|
SqlServerQueryRunner.prototype.createForeignKey = function (tableOrName, foreignKey) {
|
|
1803
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1771
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1804
1772
|
var table, _a, metadata, up, down;
|
|
1805
|
-
return tslib_1.__generator(this, function (_b) {
|
|
1773
|
+
return (0, tslib_1.__generator)(this, function (_b) {
|
|
1806
1774
|
switch (_b.label) {
|
|
1807
1775
|
case 0:
|
|
1808
1776
|
if (!(tableOrName instanceof Table_1.Table)) return [3 /*break*/, 1];
|
|
@@ -1835,10 +1803,10 @@ var SqlServerQueryRunner = /** @class */ (function (_super) {
|
|
|
1835
1803
|
* Creates a new foreign keys.
|
|
1836
1804
|
*/
|
|
1837
1805
|
SqlServerQueryRunner.prototype.createForeignKeys = function (tableOrName, foreignKeys) {
|
|
1838
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1806
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1839
1807
|
var promises;
|
|
1840
1808
|
var _this = this;
|
|
1841
|
-
return tslib_1.__generator(this, function (_a) {
|
|
1809
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
1842
1810
|
switch (_a.label) {
|
|
1843
1811
|
case 0:
|
|
1844
1812
|
promises = foreignKeys.map(function (foreignKey) { return _this.createForeignKey(tableOrName, foreignKey); });
|
|
@@ -1854,9 +1822,9 @@ var SqlServerQueryRunner = /** @class */ (function (_super) {
|
|
|
1854
1822
|
* Drops a foreign key from the table.
|
|
1855
1823
|
*/
|
|
1856
1824
|
SqlServerQueryRunner.prototype.dropForeignKey = function (tableOrName, foreignKeyOrName) {
|
|
1857
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1825
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1858
1826
|
var table, _a, foreignKey, up, down;
|
|
1859
|
-
return tslib_1.__generator(this, function (_b) {
|
|
1827
|
+
return (0, tslib_1.__generator)(this, function (_b) {
|
|
1860
1828
|
switch (_b.label) {
|
|
1861
1829
|
case 0:
|
|
1862
1830
|
if (!(tableOrName instanceof Table_1.Table)) return [3 /*break*/, 1];
|
|
@@ -1886,10 +1854,10 @@ var SqlServerQueryRunner = /** @class */ (function (_super) {
|
|
|
1886
1854
|
* Drops a foreign keys from the table.
|
|
1887
1855
|
*/
|
|
1888
1856
|
SqlServerQueryRunner.prototype.dropForeignKeys = function (tableOrName, foreignKeys) {
|
|
1889
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1857
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1890
1858
|
var promises;
|
|
1891
1859
|
var _this = this;
|
|
1892
|
-
return tslib_1.__generator(this, function (_a) {
|
|
1860
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
1893
1861
|
switch (_a.label) {
|
|
1894
1862
|
case 0:
|
|
1895
1863
|
promises = foreignKeys.map(function (foreignKey) { return _this.dropForeignKey(tableOrName, foreignKey); });
|
|
@@ -1905,9 +1873,9 @@ var SqlServerQueryRunner = /** @class */ (function (_super) {
|
|
|
1905
1873
|
* Creates a new index.
|
|
1906
1874
|
*/
|
|
1907
1875
|
SqlServerQueryRunner.prototype.createIndex = function (tableOrName, index) {
|
|
1908
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1876
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1909
1877
|
var table, _a, up, down;
|
|
1910
|
-
return tslib_1.__generator(this, function (_b) {
|
|
1878
|
+
return (0, tslib_1.__generator)(this, function (_b) {
|
|
1911
1879
|
switch (_b.label) {
|
|
1912
1880
|
case 0:
|
|
1913
1881
|
if (!(tableOrName instanceof Table_1.Table)) return [3 /*break*/, 1];
|
|
@@ -1937,10 +1905,10 @@ var SqlServerQueryRunner = /** @class */ (function (_super) {
|
|
|
1937
1905
|
* Creates a new indices
|
|
1938
1906
|
*/
|
|
1939
1907
|
SqlServerQueryRunner.prototype.createIndices = function (tableOrName, indices) {
|
|
1940
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1908
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1941
1909
|
var promises;
|
|
1942
1910
|
var _this = this;
|
|
1943
|
-
return tslib_1.__generator(this, function (_a) {
|
|
1911
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
1944
1912
|
switch (_a.label) {
|
|
1945
1913
|
case 0:
|
|
1946
1914
|
promises = indices.map(function (index) { return _this.createIndex(tableOrName, index); });
|
|
@@ -1956,9 +1924,9 @@ var SqlServerQueryRunner = /** @class */ (function (_super) {
|
|
|
1956
1924
|
* Drops an index.
|
|
1957
1925
|
*/
|
|
1958
1926
|
SqlServerQueryRunner.prototype.dropIndex = function (tableOrName, indexOrName) {
|
|
1959
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1927
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1960
1928
|
var table, _a, index, up, down;
|
|
1961
|
-
return tslib_1.__generator(this, function (_b) {
|
|
1929
|
+
return (0, tslib_1.__generator)(this, function (_b) {
|
|
1962
1930
|
switch (_b.label) {
|
|
1963
1931
|
case 0:
|
|
1964
1932
|
if (!(tableOrName instanceof Table_1.Table)) return [3 /*break*/, 1];
|
|
@@ -1988,10 +1956,10 @@ var SqlServerQueryRunner = /** @class */ (function (_super) {
|
|
|
1988
1956
|
* Drops an indices from the table.
|
|
1989
1957
|
*/
|
|
1990
1958
|
SqlServerQueryRunner.prototype.dropIndices = function (tableOrName, indices) {
|
|
1991
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1959
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1992
1960
|
var promises;
|
|
1993
1961
|
var _this = this;
|
|
1994
|
-
return tslib_1.__generator(this, function (_a) {
|
|
1962
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
1995
1963
|
switch (_a.label) {
|
|
1996
1964
|
case 0:
|
|
1997
1965
|
promises = indices.map(function (index) { return _this.dropIndex(tableOrName, index); });
|
|
@@ -2008,8 +1976,8 @@ var SqlServerQueryRunner = /** @class */ (function (_super) {
|
|
|
2008
1976
|
* Note: this operation uses SQL's TRUNCATE query which cannot be reverted in transactions.
|
|
2009
1977
|
*/
|
|
2010
1978
|
SqlServerQueryRunner.prototype.clearTable = function (tablePath) {
|
|
2011
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
2012
|
-
return tslib_1.__generator(this, function (_a) {
|
|
1979
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1980
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
2013
1981
|
switch (_a.label) {
|
|
2014
1982
|
case 0: return [4 /*yield*/, this.query("TRUNCATE TABLE " + this.escapePath(tablePath))];
|
|
2015
1983
|
case 1:
|
|
@@ -2023,10 +1991,10 @@ var SqlServerQueryRunner = /** @class */ (function (_super) {
|
|
|
2023
1991
|
* Removes all tables from the currently connected database.
|
|
2024
1992
|
*/
|
|
2025
1993
|
SqlServerQueryRunner.prototype.clearDatabase = function (database) {
|
|
2026
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1994
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
2027
1995
|
var isDatabaseExist, allViewsSql, allViewsResults, allTablesSql, allTablesResults, tablesByCatalog, foreignKeysSql, foreignKeys, error_2, rollbackError_1;
|
|
2028
1996
|
var _this = this;
|
|
2029
|
-
return tslib_1.__generator(this, function (_a) {
|
|
1997
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
2030
1998
|
switch (_a.label) {
|
|
2031
1999
|
case 0:
|
|
2032
2000
|
if (!database) return [3 /*break*/, 2];
|
|
@@ -2069,7 +2037,7 @@ var SqlServerQueryRunner = /** @class */ (function (_super) {
|
|
|
2069
2037
|
return c;
|
|
2070
2038
|
}, {});
|
|
2071
2039
|
foreignKeysSql = Object.entries(tablesByCatalog).map(function (_a) {
|
|
2072
|
-
var _b = tslib_1.__read(_a, 2), TABLE_CATALOG = _b[0], tables = _b[1];
|
|
2040
|
+
var _b = (0, tslib_1.__read)(_a, 2), TABLE_CATALOG = _b[0], tables = _b[1];
|
|
2073
2041
|
var conditions = tables.map(function (_a) {
|
|
2074
2042
|
var TABLE_SCHEMA = _a.TABLE_SCHEMA, TABLE_NAME = _a.TABLE_NAME;
|
|
2075
2043
|
return "(\"fk\".\"referenced_object_id\" = OBJECT_ID('\"" + TABLE_CATALOG + "\".\"" + TABLE_SCHEMA + "\".\"" + TABLE_NAME + "\"'))";
|
|
@@ -2081,8 +2049,8 @@ var SqlServerQueryRunner = /** @class */ (function (_super) {
|
|
|
2081
2049
|
foreignKeys = _a.sent();
|
|
2082
2050
|
return [4 /*yield*/, Promise.all(foreignKeys.map(function (_a) {
|
|
2083
2051
|
var TABLE_CATALOG = _a.TABLE_CATALOG, TABLE_SCHEMA = _a.TABLE_SCHEMA, TABLE_NAME = _a.TABLE_NAME, CONSTRAINT_NAME = _a.CONSTRAINT_NAME;
|
|
2084
|
-
return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
2085
|
-
return tslib_1.__generator(this, function (_b) {
|
|
2052
|
+
return (0, tslib_1.__awaiter)(_this, void 0, void 0, function () {
|
|
2053
|
+
return (0, tslib_1.__generator)(this, function (_b) {
|
|
2086
2054
|
switch (_b.label) {
|
|
2087
2055
|
case 0:
|
|
2088
2056
|
// Disable the constraint first.
|
|
@@ -2139,10 +2107,10 @@ var SqlServerQueryRunner = /** @class */ (function (_super) {
|
|
|
2139
2107
|
// Protected Methods
|
|
2140
2108
|
// -------------------------------------------------------------------------
|
|
2141
2109
|
SqlServerQueryRunner.prototype.loadViews = function (viewPaths) {
|
|
2142
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
2110
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
2143
2111
|
var hasTable, currentSchema, currentDatabase, dbNames, viewsCondition, query, dbViews;
|
|
2144
2112
|
var _this = this;
|
|
2145
|
-
return tslib_1.__generator(this, function (_a) {
|
|
2113
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
2146
2114
|
switch (_a.label) {
|
|
2147
2115
|
case 0: return [4 /*yield*/, this.hasTable(this.getTypeormMetadataTableName())];
|
|
2148
2116
|
case 1:
|
|
@@ -2196,10 +2164,10 @@ var SqlServerQueryRunner = /** @class */ (function (_super) {
|
|
|
2196
2164
|
* Loads all tables (with given names) from the database and creates a Table from them.
|
|
2197
2165
|
*/
|
|
2198
2166
|
SqlServerQueryRunner.prototype.loadTables = function (tableNames) {
|
|
2199
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
2167
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
2200
2168
|
var currentSchema, currentDatabase, dbTables, databasesSql, dbDatabases, tablesSql, _a, _b, _c, _d, tableNamesByCatalog, tablesSql, _e, _f, _g, _h, dbTablesByCatalog, columnsSql, constraintsSql, foreignKeysSql, identityColumnsSql, dbCollationsSql, indicesSql, _j, dbColumns, dbConstraints, dbForeignKeys, dbIdentityColumns, dbCollations, dbIndices;
|
|
2201
2169
|
var _this = this;
|
|
2202
|
-
return tslib_1.__generator(this, function (_k) {
|
|
2170
|
+
return (0, tslib_1.__generator)(this, function (_k) {
|
|
2203
2171
|
switch (_k.label) {
|
|
2204
2172
|
case 0:
|
|
2205
2173
|
// if no tables given then no need to proceed
|
|
@@ -2227,13 +2195,13 @@ var SqlServerQueryRunner = /** @class */ (function (_super) {
|
|
|
2227
2195
|
_d = [[]];
|
|
2228
2196
|
return [4 /*yield*/, this.query(tablesSql)];
|
|
2229
2197
|
case 4:
|
|
2230
|
-
_b.apply(_a, _c.concat([tslib_1.__spreadArray.apply(void 0, _d.concat([tslib_1.__read.apply(void 0, [_k.sent()])]))]));
|
|
2198
|
+
_b.apply(_a, _c.concat([tslib_1.__spreadArray.apply(void 0, _d.concat([tslib_1.__read.apply(void 0, [_k.sent()]), false]))]));
|
|
2231
2199
|
return [3 /*break*/, 7];
|
|
2232
2200
|
case 5:
|
|
2233
2201
|
tableNamesByCatalog = tableNames
|
|
2234
2202
|
.map(function (tableName) { return _this.driver.parseTableName(tableName); })
|
|
2235
2203
|
.reduce(function (c, _a) {
|
|
2236
|
-
var database = _a.database, other = tslib_1.__rest(_a, ["database"]);
|
|
2204
|
+
var database = _a.database, other = (0, tslib_1.__rest)(_a, ["database"]);
|
|
2237
2205
|
database = database || currentDatabase;
|
|
2238
2206
|
c[database] = c[database] || [];
|
|
2239
2207
|
c[database].push({
|
|
@@ -2243,7 +2211,7 @@ var SqlServerQueryRunner = /** @class */ (function (_super) {
|
|
|
2243
2211
|
return c;
|
|
2244
2212
|
}, {});
|
|
2245
2213
|
tablesSql = Object.entries(tableNamesByCatalog).map(function (_a) {
|
|
2246
|
-
var _b = tslib_1.__read(_a, 2), database = _b[0], tables = _b[1];
|
|
2214
|
+
var _b = (0, tslib_1.__read)(_a, 2), database = _b[0], tables = _b[1];
|
|
2247
2215
|
var tablesCondition = tables
|
|
2248
2216
|
.map(function (_a) {
|
|
2249
2217
|
var schema = _a.schema, tableName = _a.tableName;
|
|
@@ -2257,7 +2225,7 @@ var SqlServerQueryRunner = /** @class */ (function (_super) {
|
|
|
2257
2225
|
_h = [[]];
|
|
2258
2226
|
return [4 /*yield*/, this.query(tablesSql)];
|
|
2259
2227
|
case 6:
|
|
2260
|
-
_f.apply(_e, _g.concat([tslib_1.__spreadArray.apply(void 0, _h.concat([tslib_1.__read.apply(void 0, [_k.sent()])]))]));
|
|
2228
|
+
_f.apply(_e, _g.concat([tslib_1.__spreadArray.apply(void 0, _h.concat([tslib_1.__read.apply(void 0, [_k.sent()]), false]))]));
|
|
2261
2229
|
_k.label = 7;
|
|
2262
2230
|
case 7:
|
|
2263
2231
|
// if tables were not found in the db, no need to proceed
|
|
@@ -2265,13 +2233,13 @@ var SqlServerQueryRunner = /** @class */ (function (_super) {
|
|
|
2265
2233
|
return [2 /*return*/, []];
|
|
2266
2234
|
}
|
|
2267
2235
|
dbTablesByCatalog = dbTables.reduce(function (c, _a) {
|
|
2268
|
-
var TABLE_CATALOG = _a.TABLE_CATALOG, other = tslib_1.__rest(_a, ["TABLE_CATALOG"]);
|
|
2236
|
+
var TABLE_CATALOG = _a.TABLE_CATALOG, other = (0, tslib_1.__rest)(_a, ["TABLE_CATALOG"]);
|
|
2269
2237
|
c[TABLE_CATALOG] = c[TABLE_CATALOG] || [];
|
|
2270
2238
|
c[TABLE_CATALOG].push(other);
|
|
2271
2239
|
return c;
|
|
2272
2240
|
}, {});
|
|
2273
2241
|
columnsSql = Object.entries(dbTablesByCatalog).map(function (_a) {
|
|
2274
|
-
var _b = tslib_1.__read(_a, 2), TABLE_CATALOG = _b[0], tables = _b[1];
|
|
2242
|
+
var _b = (0, tslib_1.__read)(_a, 2), TABLE_CATALOG = _b[0], tables = _b[1];
|
|
2275
2243
|
var condition = tables.map(function (_a) {
|
|
2276
2244
|
var TABLE_SCHEMA = _a.TABLE_SCHEMA, TABLE_NAME = _a.TABLE_NAME;
|
|
2277
2245
|
return "(\"TABLE_SCHEMA\" = '" + TABLE_SCHEMA + "' AND \"TABLE_NAME\" = '" + TABLE_NAME + "')";
|
|
@@ -2279,7 +2247,7 @@ var SqlServerQueryRunner = /** @class */ (function (_super) {
|
|
|
2279
2247
|
return "SELECT * FROM \"" + TABLE_CATALOG + "\".\"INFORMATION_SCHEMA\".\"COLUMNS\" WHERE (" + condition + ")";
|
|
2280
2248
|
}).join(" UNION ALL ");
|
|
2281
2249
|
constraintsSql = Object.entries(dbTablesByCatalog).map(function (_a) {
|
|
2282
|
-
var _b = tslib_1.__read(_a, 2), TABLE_CATALOG = _b[0], tables = _b[1];
|
|
2250
|
+
var _b = (0, tslib_1.__read)(_a, 2), TABLE_CATALOG = _b[0], tables = _b[1];
|
|
2283
2251
|
var conditions = tables.map(function (_a) {
|
|
2284
2252
|
var TABLE_NAME = _a.TABLE_NAME, TABLE_SCHEMA = _a.TABLE_SCHEMA;
|
|
2285
2253
|
return "(\"columnUsages\".\"TABLE_SCHEMA\" = '" + TABLE_SCHEMA + "' AND \"columnUsages\".\"TABLE_NAME\" = '" + TABLE_NAME + "')";
|
|
@@ -2299,7 +2267,7 @@ var SqlServerQueryRunner = /** @class */ (function (_super) {
|
|
|
2299
2267
|
"\"tableConstraints\".\"CONSTRAINT_TYPE\" IN ('PRIMARY KEY', 'UNIQUE', 'CHECK')";
|
|
2300
2268
|
}).join(" UNION ALL ");
|
|
2301
2269
|
foreignKeysSql = Object.entries(dbTablesByCatalog).map(function (_a) {
|
|
2302
|
-
var _b = tslib_1.__read(_a, 2), TABLE_CATALOG = _b[0], tables = _b[1];
|
|
2270
|
+
var _b = (0, tslib_1.__read)(_a, 2), TABLE_CATALOG = _b[0], tables = _b[1];
|
|
2303
2271
|
var conditions = tables.map(function (_a) {
|
|
2304
2272
|
var TABLE_NAME = _a.TABLE_NAME, TABLE_SCHEMA = _a.TABLE_SCHEMA;
|
|
2305
2273
|
return "(\"s1\".\"name\" = '" + TABLE_SCHEMA + "' AND \"t1\".\"name\" = '" + TABLE_NAME + "')";
|
|
@@ -2318,7 +2286,7 @@ var SqlServerQueryRunner = /** @class */ (function (_super) {
|
|
|
2318
2286
|
("WHERE (" + conditions + ")");
|
|
2319
2287
|
}).join(" UNION ALL ");
|
|
2320
2288
|
identityColumnsSql = Object.entries(dbTablesByCatalog).map(function (_a) {
|
|
2321
|
-
var _b = tslib_1.__read(_a, 2), TABLE_CATALOG = _b[0], tables = _b[1];
|
|
2289
|
+
var _b = (0, tslib_1.__read)(_a, 2), TABLE_CATALOG = _b[0], tables = _b[1];
|
|
2322
2290
|
var conditions = tables.map(function (_a) {
|
|
2323
2291
|
var TABLE_NAME = _a.TABLE_NAME, TABLE_SCHEMA = _a.TABLE_SCHEMA;
|
|
2324
2292
|
return "(\"TABLE_SCHEMA\" = '" + TABLE_SCHEMA + "' AND \"TABLE_NAME\" = '" + TABLE_NAME + "')";
|
|
@@ -2331,7 +2299,7 @@ var SqlServerQueryRunner = /** @class */ (function (_super) {
|
|
|
2331
2299
|
}).join(" UNION ALL ");
|
|
2332
2300
|
dbCollationsSql = "SELECT \"NAME\", \"COLLATION_NAME\" FROM \"sys\".\"databases\"";
|
|
2333
2301
|
indicesSql = Object.entries(dbTablesByCatalog).map(function (_a) {
|
|
2334
|
-
var _b = tslib_1.__read(_a, 2), TABLE_CATALOG = _b[0], tables = _b[1];
|
|
2302
|
+
var _b = (0, tslib_1.__read)(_a, 2), TABLE_CATALOG = _b[0], tables = _b[1];
|
|
2335
2303
|
var conditions = tables.map(function (_a) {
|
|
2336
2304
|
var TABLE_NAME = _a.TABLE_NAME, TABLE_SCHEMA = _a.TABLE_SCHEMA;
|
|
2337
2305
|
return "(\"s\".\"name\" = '" + TABLE_SCHEMA + "' AND \"t\".\"name\" = '" + TABLE_NAME + "')";
|
|
@@ -2357,10 +2325,10 @@ var SqlServerQueryRunner = /** @class */ (function (_super) {
|
|
|
2357
2325
|
])];
|
|
2358
2326
|
case 8:
|
|
2359
2327
|
_j = tslib_1.__read.apply(void 0, [_k.sent(), 6]), dbColumns = _j[0], dbConstraints = _j[1], dbForeignKeys = _j[2], dbIdentityColumns = _j[3], dbCollations = _j[4], dbIndices = _j[5];
|
|
2360
|
-
return [4 /*yield*/, Promise.all(dbTables.map(function (dbTable) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
2328
|
+
return [4 /*yield*/, Promise.all(dbTables.map(function (dbTable) { return (0, tslib_1.__awaiter)(_this, void 0, void 0, function () {
|
|
2361
2329
|
var table, getSchemaFromKey, db, schema, defaultCollation, tableUniqueConstraints, tableCheckConstraints, tableForeignKeyConstraints, tableIndexConstraints;
|
|
2362
2330
|
var _this = this;
|
|
2363
|
-
return tslib_1.__generator(this, function (_a) {
|
|
2331
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
2364
2332
|
table = new Table_1.Table();
|
|
2365
2333
|
getSchemaFromKey = function (dbObject, key) {
|
|
2366
2334
|
return dbObject[key] === currentSchema && (!_this.driver.options.schema || _this.driver.options.schema === currentSchema)
|
|
@@ -2422,7 +2390,7 @@ var SqlServerQueryRunner = /** @class */ (function (_super) {
|
|
|
2422
2390
|
if (columnCheckConstraints.length) {
|
|
2423
2391
|
try {
|
|
2424
2392
|
// const isEnumRegexp = new RegExp("^\\(\\[" + tableColumn.name + "\\]='[^']+'(?: OR \\[" + tableColumn.name + "\\]='[^']+')*\\)$");
|
|
2425
|
-
for (var columnCheckConstraints_1 = tslib_1.__values(columnCheckConstraints), columnCheckConstraints_1_1 = columnCheckConstraints_1.next(); !columnCheckConstraints_1_1.done; columnCheckConstraints_1_1 = columnCheckConstraints_1.next()) {
|
|
2393
|
+
for (var columnCheckConstraints_1 = (0, tslib_1.__values)(columnCheckConstraints), columnCheckConstraints_1_1 = columnCheckConstraints_1.next(); !columnCheckConstraints_1_1.done; columnCheckConstraints_1_1 = columnCheckConstraints_1.next()) {
|
|
2426
2394
|
var checkConstraint = columnCheckConstraints_1_1.value;
|
|
2427
2395
|
if (_this.isEnumCheckConstraint(checkConstraint["CONSTRAINT_NAME"])) {
|
|
2428
2396
|
// This is an enum constraint, make column into an enum
|
|
@@ -2617,9 +2585,9 @@ var SqlServerQueryRunner = /** @class */ (function (_super) {
|
|
|
2617
2585
|
}
|
|
2618
2586
|
};
|
|
2619
2587
|
SqlServerQueryRunner.prototype.insertViewDefinitionSql = function (view) {
|
|
2620
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
2588
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
2621
2589
|
var parsedTableName, _a, expression, _b, query, parameters;
|
|
2622
|
-
return tslib_1.__generator(this, function (_c) {
|
|
2590
|
+
return (0, tslib_1.__generator)(this, function (_c) {
|
|
2623
2591
|
switch (_c.label) {
|
|
2624
2592
|
case 0:
|
|
2625
2593
|
parsedTableName = this.driver.parseTableName(view);
|
|
@@ -2631,7 +2599,7 @@ var SqlServerQueryRunner = /** @class */ (function (_super) {
|
|
|
2631
2599
|
_c.label = 2;
|
|
2632
2600
|
case 2:
|
|
2633
2601
|
expression = typeof view.expression === "string" ? view.expression.trim() : view.expression(this.connection).getQuery();
|
|
2634
|
-
_b = tslib_1.__read(this.connection.createQueryBuilder()
|
|
2602
|
+
_b = (0, tslib_1.__read)(this.connection.createQueryBuilder()
|
|
2635
2603
|
.insert()
|
|
2636
2604
|
.into(this.getTypeormMetadataTableName())
|
|
2637
2605
|
.values({ type: "VIEW", database: parsedTableName.database, schema: parsedTableName.schema, name: parsedTableName.tableName, value: expression })
|
|
@@ -2651,9 +2619,9 @@ var SqlServerQueryRunner = /** @class */ (function (_super) {
|
|
|
2651
2619
|
* Builds remove view sql.
|
|
2652
2620
|
*/
|
|
2653
2621
|
SqlServerQueryRunner.prototype.deleteViewDefinitionSql = function (viewOrPath) {
|
|
2654
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
2622
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
2655
2623
|
var parsedTableName, _a, qb, _b, query, parameters;
|
|
2656
|
-
return tslib_1.__generator(this, function (_c) {
|
|
2624
|
+
return (0, tslib_1.__generator)(this, function (_c) {
|
|
2657
2625
|
switch (_c.label) {
|
|
2658
2626
|
case 0:
|
|
2659
2627
|
parsedTableName = this.driver.parseTableName(viewOrPath);
|
|
@@ -2665,7 +2633,7 @@ var SqlServerQueryRunner = /** @class */ (function (_super) {
|
|
|
2665
2633
|
_c.label = 2;
|
|
2666
2634
|
case 2:
|
|
2667
2635
|
qb = this.connection.createQueryBuilder();
|
|
2668
|
-
_b = tslib_1.__read(qb.delete()
|
|
2636
|
+
_b = (0, tslib_1.__read)(qb.delete()
|
|
2669
2637
|
.from(this.getTypeormMetadataTableName())
|
|
2670
2638
|
.where(qb.escape("type") + " = 'VIEW'")
|
|
2671
2639
|
.andWhere(qb.escape("database") + " = :database", { database: parsedTableName.database })
|
|
@@ -2838,7 +2806,7 @@ var SqlServerQueryRunner = /** @class */ (function (_super) {
|
|
|
2838
2806
|
case "bigint":
|
|
2839
2807
|
return this.driver.mssql.BigInt;
|
|
2840
2808
|
case "decimal":
|
|
2841
|
-
return (_a = this.driver.mssql).Decimal.apply(_a, tslib_1.__spreadArray([], tslib_1.__read(parameter.params)));
|
|
2809
|
+
return (_a = this.driver.mssql).Decimal.apply(_a, (0, tslib_1.__spreadArray)([], (0, tslib_1.__read)(parameter.params), false));
|
|
2842
2810
|
case "float":
|
|
2843
2811
|
return this.driver.mssql.Float;
|
|
2844
2812
|
case "int":
|
|
@@ -2846,7 +2814,7 @@ var SqlServerQueryRunner = /** @class */ (function (_super) {
|
|
|
2846
2814
|
case "money":
|
|
2847
2815
|
return this.driver.mssql.Money;
|
|
2848
2816
|
case "numeric":
|
|
2849
|
-
return (_b = this.driver.mssql).Numeric.apply(_b, tslib_1.__spreadArray([], tslib_1.__read(parameter.params)));
|
|
2817
|
+
return (_b = this.driver.mssql).Numeric.apply(_b, (0, tslib_1.__spreadArray)([], (0, tslib_1.__read)(parameter.params), false));
|
|
2850
2818
|
case "smallint":
|
|
2851
2819
|
return this.driver.mssql.SmallInt;
|
|
2852
2820
|
case "smallmoney":
|
|
@@ -2857,25 +2825,25 @@ var SqlServerQueryRunner = /** @class */ (function (_super) {
|
|
|
2857
2825
|
return this.driver.mssql.TinyInt;
|
|
2858
2826
|
case "char":
|
|
2859
2827
|
case "nchar":
|
|
2860
|
-
return (_c = this.driver.mssql).NChar.apply(_c, tslib_1.__spreadArray([], tslib_1.__read(parameter.params)));
|
|
2828
|
+
return (_c = this.driver.mssql).NChar.apply(_c, (0, tslib_1.__spreadArray)([], (0, tslib_1.__read)(parameter.params), false));
|
|
2861
2829
|
case "text":
|
|
2862
2830
|
case "ntext":
|
|
2863
2831
|
return this.driver.mssql.Ntext;
|
|
2864
2832
|
case "varchar":
|
|
2865
2833
|
case "nvarchar":
|
|
2866
|
-
return (_d = this.driver.mssql).NVarChar.apply(_d, tslib_1.__spreadArray([], tslib_1.__read(parameter.params)));
|
|
2834
|
+
return (_d = this.driver.mssql).NVarChar.apply(_d, (0, tslib_1.__spreadArray)([], (0, tslib_1.__read)(parameter.params), false));
|
|
2867
2835
|
case "xml":
|
|
2868
2836
|
return this.driver.mssql.Xml;
|
|
2869
2837
|
case "time":
|
|
2870
|
-
return (_e = this.driver.mssql).Time.apply(_e, tslib_1.__spreadArray([], tslib_1.__read(parameter.params)));
|
|
2838
|
+
return (_e = this.driver.mssql).Time.apply(_e, (0, tslib_1.__spreadArray)([], (0, tslib_1.__read)(parameter.params), false));
|
|
2871
2839
|
case "date":
|
|
2872
2840
|
return this.driver.mssql.Date;
|
|
2873
2841
|
case "datetime":
|
|
2874
2842
|
return this.driver.mssql.DateTime;
|
|
2875
2843
|
case "datetime2":
|
|
2876
|
-
return (_f = this.driver.mssql).DateTime2.apply(_f, tslib_1.__spreadArray([], tslib_1.__read(parameter.params)));
|
|
2844
|
+
return (_f = this.driver.mssql).DateTime2.apply(_f, (0, tslib_1.__spreadArray)([], (0, tslib_1.__read)(parameter.params), false));
|
|
2877
2845
|
case "datetimeoffset":
|
|
2878
|
-
return (_g = this.driver.mssql).DateTimeOffset.apply(_g, tslib_1.__spreadArray([], tslib_1.__read(parameter.params)));
|
|
2846
|
+
return (_g = this.driver.mssql).DateTimeOffset.apply(_g, (0, tslib_1.__spreadArray)([], (0, tslib_1.__read)(parameter.params), false));
|
|
2879
2847
|
case "smalldatetime":
|
|
2880
2848
|
return this.driver.mssql.SmallDateTime;
|
|
2881
2849
|
case "uniqueidentifier":
|
|
@@ -2885,7 +2853,7 @@ var SqlServerQueryRunner = /** @class */ (function (_super) {
|
|
|
2885
2853
|
case "binary":
|
|
2886
2854
|
return this.driver.mssql.Binary;
|
|
2887
2855
|
case "varbinary":
|
|
2888
|
-
return (_h = this.driver.mssql).VarBinary.apply(_h, tslib_1.__spreadArray([], tslib_1.__read(parameter.params)));
|
|
2856
|
+
return (_h = this.driver.mssql).VarBinary.apply(_h, (0, tslib_1.__spreadArray)([], (0, tslib_1.__read)(parameter.params), false));
|
|
2889
2857
|
case "image":
|
|
2890
2858
|
return this.driver.mssql.Image;
|
|
2891
2859
|
case "udt":
|