taon-typeorm 18.0.19 → 18.0.21
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/assets/shared/shared_folder_info.txt +1 -1
- package/browser/esm2022/lib/typeorm/driver/cordova/CordovaDriver.mjs +1 -1
- package/browser/esm2022/lib/typeorm/driver/cordova/CordovaQueryRunner.mjs +1 -1
- package/browser/esm2022/lib/typeorm/driver/nativescript/NativescriptDriver.mjs +1 -1
- package/browser/esm2022/lib/typeorm/driver/nativescript/NativescriptQueryRunner.mjs +1 -1
- package/browser/esm2022/lib/typeorm/driver/react-native/ReactNativeDriver.mjs +1 -1
- package/browser/esm2022/lib/typeorm/driver/react-native/ReactNativeQueryRunner.mjs +1 -1
- package/browser/esm2022/lib/typeorm/driver/sqljs/SqljsDriver.mjs +1 -1
- package/browser/esm2022/lib/typeorm/driver/sqljs/SqljsQueryRunner.mjs +1 -1
- package/browser/esm2022/lib/typeorm/index.mjs +1 -3
- package/browser/fesm2022/taon-typeorm.mjs.map +1 -1
- package/client/esm2022/lib/typeorm/driver/cordova/CordovaDriver.mjs +1 -1
- package/client/esm2022/lib/typeorm/driver/cordova/CordovaQueryRunner.mjs +1 -1
- package/client/esm2022/lib/typeorm/driver/nativescript/NativescriptDriver.mjs +1 -1
- package/client/esm2022/lib/typeorm/driver/nativescript/NativescriptQueryRunner.mjs +1 -1
- package/client/esm2022/lib/typeorm/driver/react-native/ReactNativeDriver.mjs +1 -1
- package/client/esm2022/lib/typeorm/driver/react-native/ReactNativeQueryRunner.mjs +1 -1
- package/client/esm2022/lib/typeorm/driver/sqljs/SqljsDriver.mjs +1 -1
- package/client/esm2022/lib/typeorm/driver/sqljs/SqljsQueryRunner.mjs +1 -1
- package/client/esm2022/lib/typeorm/index.mjs +1 -3
- package/client/fesm2022/taon-typeorm.mjs.map +1 -1
- package/index.js +15 -2
- package/index.js.map +1 -1
- package/lib/build-info._auto-generated_.js.map +1 -1
- package/lib/index._auto-generated_.d.ts +1 -0
- package/lib/index._auto-generated_.js.map +1 -1
- package/lib/index.js +15 -2
- package/lib/index.js.map +1 -1
- package/lib/typeorm/cache/DbQueryResultCache.js +178 -231
- package/lib/typeorm/cache/DbQueryResultCache.js.map +1 -1
- package/lib/typeorm/cache/QueryResultCache.js.map +1 -1
- package/lib/typeorm/cache/QueryResultCacheFactory.js +11 -11
- package/lib/typeorm/cache/QueryResultCacheFactory.js.map +1 -1
- package/lib/typeorm/cache/QueryResultCacheOptions.js.map +1 -1
- package/lib/typeorm/cache/RedisQueryResultCache.js +121 -149
- package/lib/typeorm/cache/RedisQueryResultCache.js.map +1 -1
- package/lib/typeorm/cli-ts-node-commonjs.js.map +1 -1
- package/lib/typeorm/cli-ts-node-esm.js +7 -5
- package/lib/typeorm/cli-ts-node-esm.js.map +1 -1
- package/lib/typeorm/cli.d.ts +1 -1
- package/lib/typeorm/cli.js +15 -16
- package/lib/typeorm/cli.js.map +1 -1
- package/lib/typeorm/commands/CacheClearCommand.js +37 -65
- package/lib/typeorm/commands/CacheClearCommand.js.map +1 -1
- package/lib/typeorm/commands/CommandUtils.js +57 -112
- package/lib/typeorm/commands/CommandUtils.js.map +1 -1
- package/lib/typeorm/commands/EntityCreateCommand.js +35 -47
- package/lib/typeorm/commands/EntityCreateCommand.js.map +1 -1
- package/lib/typeorm/commands/InitCommand.js +397 -168
- package/lib/typeorm/commands/InitCommand.js.map +1 -1
- package/lib/typeorm/commands/MigrationCreateCommand.js +58 -52
- package/lib/typeorm/commands/MigrationCreateCommand.js.map +1 -1
- package/lib/typeorm/commands/MigrationGenerateCommand.js +141 -138
- package/lib/typeorm/commands/MigrationGenerateCommand.js.map +1 -1
- package/lib/typeorm/commands/MigrationRevertCommand.js +49 -77
- package/lib/typeorm/commands/MigrationRevertCommand.js.map +1 -1
- package/lib/typeorm/commands/MigrationRunCommand.js +52 -82
- package/lib/typeorm/commands/MigrationRunCommand.js.map +1 -1
- package/lib/typeorm/commands/MigrationShowCommand.js +32 -60
- package/lib/typeorm/commands/MigrationShowCommand.js.map +1 -1
- package/lib/typeorm/commands/QueryCommand.js +47 -83
- package/lib/typeorm/commands/QueryCommand.js.map +1 -1
- package/lib/typeorm/commands/SchemaDropCommand.js +33 -61
- package/lib/typeorm/commands/SchemaDropCommand.js.map +1 -1
- package/lib/typeorm/commands/SchemaLogCommand.js +57 -81
- package/lib/typeorm/commands/SchemaLogCommand.js.map +1 -1
- package/lib/typeorm/commands/SchemaSyncCommand.js +33 -61
- package/lib/typeorm/commands/SchemaSyncCommand.js.map +1 -1
- package/lib/typeorm/commands/SubscriberCreateCommand.js +35 -47
- package/lib/typeorm/commands/SubscriberCreateCommand.js.map +1 -1
- package/lib/typeorm/commands/VersionCommand.js +38 -54
- package/lib/typeorm/commands/VersionCommand.js.map +1 -1
- package/lib/typeorm/common/DeepPartial.js.map +1 -1
- package/lib/typeorm/common/EntityTarget.js.map +1 -1
- package/lib/typeorm/common/MixedList.js.map +1 -1
- package/lib/typeorm/common/NonNever.js.map +1 -1
- package/lib/typeorm/common/ObjectLiteral.js.map +1 -1
- package/lib/typeorm/common/ObjectType.js.map +1 -1
- package/lib/typeorm/common/RelationType.js.map +1 -1
- package/lib/typeorm/connection/BaseConnectionOptions.js.map +1 -1
- package/lib/typeorm/connection/Connection.js +3 -9
- package/lib/typeorm/connection/Connection.js.map +1 -1
- package/lib/typeorm/connection/ConnectionManager.js +23 -31
- package/lib/typeorm/connection/ConnectionManager.js.map +1 -1
- package/lib/typeorm/connection/ConnectionMetadataBuilder.js +48 -78
- package/lib/typeorm/connection/ConnectionMetadataBuilder.js.map +1 -1
- package/lib/typeorm/connection/ConnectionOptions.js.map +1 -1
- package/lib/typeorm/connection/ConnectionOptionsReader.js +146 -214
- package/lib/typeorm/connection/ConnectionOptionsReader.js.map +1 -1
- package/lib/typeorm/connection/options-reader/ConnectionOptionsEnvReader.js +50 -58
- package/lib/typeorm/connection/options-reader/ConnectionOptionsEnvReader.js.map +1 -1
- package/lib/typeorm/connection/options-reader/ConnectionOptionsXmlReader.js +45 -58
- package/lib/typeorm/connection/options-reader/ConnectionOptionsXmlReader.js.map +1 -1
- package/lib/typeorm/connection/options-reader/ConnectionOptionsYmlReader.js +14 -23
- package/lib/typeorm/connection/options-reader/ConnectionOptionsYmlReader.js.map +1 -1
- package/lib/typeorm/constants.js.map +1 -1
- package/lib/typeorm/container.js +9 -12
- package/lib/typeorm/container.js.map +1 -1
- package/lib/typeorm/data-source/BaseDataSourceOptions.js.map +1 -1
- package/lib/typeorm/data-source/DataSource.js +320 -478
- package/lib/typeorm/data-source/DataSource.js.map +1 -1
- package/lib/typeorm/data-source/DataSourceOptions.js.map +1 -1
- package/lib/typeorm/data-source/index.js +16 -3
- package/lib/typeorm/data-source/index.js.map +1 -1
- package/lib/typeorm/decorator/Check.js +5 -5
- package/lib/typeorm/decorator/Check.js.map +1 -1
- package/lib/typeorm/decorator/EntityRepository.js +1 -1
- package/lib/typeorm/decorator/EntityRepository.js.map +1 -1
- package/lib/typeorm/decorator/Exclusion.js +5 -5
- package/lib/typeorm/decorator/Exclusion.js.map +1 -1
- package/lib/typeorm/decorator/Generated.js +2 -3
- package/lib/typeorm/decorator/Generated.js.map +1 -1
- package/lib/typeorm/decorator/Index.js +5 -5
- package/lib/typeorm/decorator/Index.js.map +1 -1
- package/lib/typeorm/decorator/Unique.js +8 -8
- package/lib/typeorm/decorator/Unique.js.map +1 -1
- package/lib/typeorm/decorator/columns/Column.js +4 -4
- package/lib/typeorm/decorator/columns/Column.js.map +1 -1
- package/lib/typeorm/decorator/columns/CreateDateColumn.js +1 -1
- package/lib/typeorm/decorator/columns/CreateDateColumn.js.map +1 -1
- package/lib/typeorm/decorator/columns/DeleteDateColumn.js +1 -1
- package/lib/typeorm/decorator/columns/DeleteDateColumn.js.map +1 -1
- package/lib/typeorm/decorator/columns/ObjectIdColumn.js +1 -1
- package/lib/typeorm/decorator/columns/ObjectIdColumn.js.map +1 -1
- package/lib/typeorm/decorator/columns/PrimaryColumn.js +5 -5
- package/lib/typeorm/decorator/columns/PrimaryColumn.js.map +1 -1
- package/lib/typeorm/decorator/columns/PrimaryGeneratedColumn.js +4 -4
- package/lib/typeorm/decorator/columns/PrimaryGeneratedColumn.js.map +1 -1
- package/lib/typeorm/decorator/columns/UpdateDateColumn.js +1 -1
- package/lib/typeorm/decorator/columns/UpdateDateColumn.js.map +1 -1
- package/lib/typeorm/decorator/columns/VersionColumn.js +1 -1
- package/lib/typeorm/decorator/columns/VersionColumn.js.map +1 -1
- package/lib/typeorm/decorator/columns/ViewColumn.js +1 -1
- package/lib/typeorm/decorator/columns/ViewColumn.js.map +1 -1
- package/lib/typeorm/decorator/columns/VirtualColumn.js +5 -5
- package/lib/typeorm/decorator/columns/VirtualColumn.js.map +1 -1
- package/lib/typeorm/decorator/entity/ChildEntity.js +1 -1
- package/lib/typeorm/decorator/entity/ChildEntity.js.map +1 -1
- package/lib/typeorm/decorator/entity/Entity.js +4 -4
- package/lib/typeorm/decorator/entity/Entity.js.map +1 -1
- package/lib/typeorm/decorator/entity/TableInheritance.js +1 -1
- package/lib/typeorm/decorator/entity/TableInheritance.js.map +1 -1
- package/lib/typeorm/decorator/entity-view/ViewEntity.js +4 -4
- package/lib/typeorm/decorator/entity-view/ViewEntity.js.map +1 -1
- package/lib/typeorm/decorator/listeners/AfterInsert.js +2 -2
- package/lib/typeorm/decorator/listeners/AfterInsert.js.map +1 -1
- package/lib/typeorm/decorator/listeners/AfterLoad.js +2 -2
- package/lib/typeorm/decorator/listeners/AfterLoad.js.map +1 -1
- package/lib/typeorm/decorator/listeners/AfterRecover.js +2 -2
- package/lib/typeorm/decorator/listeners/AfterRecover.js.map +1 -1
- package/lib/typeorm/decorator/listeners/AfterRemove.js +2 -2
- package/lib/typeorm/decorator/listeners/AfterRemove.js.map +1 -1
- package/lib/typeorm/decorator/listeners/AfterSoftRemove.js +2 -2
- package/lib/typeorm/decorator/listeners/AfterSoftRemove.js.map +1 -1
- package/lib/typeorm/decorator/listeners/AfterUpdate.js +2 -2
- package/lib/typeorm/decorator/listeners/AfterUpdate.js.map +1 -1
- package/lib/typeorm/decorator/listeners/BeforeInsert.js +2 -2
- package/lib/typeorm/decorator/listeners/BeforeInsert.js.map +1 -1
- package/lib/typeorm/decorator/listeners/BeforeRecover.js +2 -2
- package/lib/typeorm/decorator/listeners/BeforeRecover.js.map +1 -1
- package/lib/typeorm/decorator/listeners/BeforeRemove.js +2 -2
- package/lib/typeorm/decorator/listeners/BeforeRemove.js.map +1 -1
- package/lib/typeorm/decorator/listeners/BeforeSoftRemove.js +2 -2
- package/lib/typeorm/decorator/listeners/BeforeSoftRemove.js.map +1 -1
- package/lib/typeorm/decorator/listeners/BeforeUpdate.js +2 -2
- package/lib/typeorm/decorator/listeners/BeforeUpdate.js.map +1 -1
- package/lib/typeorm/decorator/listeners/EventSubscriber.js +1 -1
- package/lib/typeorm/decorator/listeners/EventSubscriber.js.map +1 -1
- package/lib/typeorm/decorator/options/ColumnCommonOptions.js.map +1 -1
- package/lib/typeorm/decorator/options/ColumnEmbeddedOptions.js.map +1 -1
- package/lib/typeorm/decorator/options/ColumnEnumOptions.js.map +1 -1
- package/lib/typeorm/decorator/options/ColumnHstoreOptions.js.map +1 -1
- package/lib/typeorm/decorator/options/ColumnNumericOptions.js.map +1 -1
- package/lib/typeorm/decorator/options/ColumnOptions.js.map +1 -1
- package/lib/typeorm/decorator/options/ColumnWithLengthOptions.js.map +1 -1
- package/lib/typeorm/decorator/options/ColumnWithWidthOptions.js.map +1 -1
- package/lib/typeorm/decorator/options/EntityOptions.js.map +1 -1
- package/lib/typeorm/decorator/options/IndexOptions.js.map +1 -1
- package/lib/typeorm/decorator/options/JoinColumnOptions.js.map +1 -1
- package/lib/typeorm/decorator/options/JoinTableMultipleColumnsOptions.js.map +1 -1
- package/lib/typeorm/decorator/options/JoinTableOptions.js.map +1 -1
- package/lib/typeorm/decorator/options/PrimaryGeneratedColumnIdentityOptions.js.map +1 -1
- package/lib/typeorm/decorator/options/PrimaryGeneratedColumnNumericOptions.js.map +1 -1
- package/lib/typeorm/decorator/options/PrimaryGeneratedColumnUUIDOptions.js.map +1 -1
- package/lib/typeorm/decorator/options/RelationOptions.js.map +1 -1
- package/lib/typeorm/decorator/options/SpatialColumnOptions.js.map +1 -1
- package/lib/typeorm/decorator/options/TransactionOptions.js.map +1 -1
- package/lib/typeorm/decorator/options/UniqueOptions.js.map +1 -1
- package/lib/typeorm/decorator/options/ValueTransformer.js.map +1 -1
- package/lib/typeorm/decorator/options/ViewColumnOptions.js.map +1 -1
- package/lib/typeorm/decorator/options/ViewEntityOptions.js.map +1 -1
- package/lib/typeorm/decorator/options/VirtualColumnOptions.js.map +1 -1
- package/lib/typeorm/decorator/relations/JoinColumn.js +3 -3
- package/lib/typeorm/decorator/relations/JoinColumn.js.map +1 -1
- package/lib/typeorm/decorator/relations/JoinTable.js +1 -1
- package/lib/typeorm/decorator/relations/JoinTable.js.map +1 -1
- package/lib/typeorm/decorator/relations/ManyToMany.js +5 -5
- package/lib/typeorm/decorator/relations/ManyToMany.js.map +1 -1
- package/lib/typeorm/decorator/relations/ManyToOne.js +5 -5
- package/lib/typeorm/decorator/relations/ManyToOne.js.map +1 -1
- package/lib/typeorm/decorator/relations/OneToMany.js +3 -3
- package/lib/typeorm/decorator/relations/OneToMany.js.map +1 -1
- package/lib/typeorm/decorator/relations/OneToOne.js +5 -5
- package/lib/typeorm/decorator/relations/OneToOne.js.map +1 -1
- package/lib/typeorm/decorator/relations/RelationCount.js +1 -1
- package/lib/typeorm/decorator/relations/RelationCount.js.map +1 -1
- package/lib/typeorm/decorator/relations/RelationId.js +1 -1
- package/lib/typeorm/decorator/relations/RelationId.js.map +1 -1
- package/lib/typeorm/decorator/tree/Tree.js +1 -1
- package/lib/typeorm/decorator/tree/Tree.js.map +1 -1
- package/lib/typeorm/decorator/tree/TreeChildren.js +4 -4
- package/lib/typeorm/decorator/tree/TreeChildren.js.map +1 -1
- package/lib/typeorm/decorator/tree/TreeLevelColumn.js +1 -1
- package/lib/typeorm/decorator/tree/TreeLevelColumn.js.map +1 -1
- package/lib/typeorm/decorator/tree/TreeParent.js +4 -4
- package/lib/typeorm/decorator/tree/TreeParent.js.map +1 -1
- package/lib/typeorm/driver/Driver.js.map +1 -1
- package/lib/typeorm/driver/DriverFactory.js +24 -27
- package/lib/typeorm/driver/DriverFactory.js.map +1 -1
- package/lib/typeorm/driver/DriverUtils.js +78 -126
- package/lib/typeorm/driver/DriverUtils.js.map +1 -1
- package/lib/typeorm/driver/Query.js +6 -5
- package/lib/typeorm/driver/Query.js.map +1 -1
- package/lib/typeorm/driver/SqlInMemory.js +4 -7
- package/lib/typeorm/driver/SqlInMemory.js.map +1 -1
- package/lib/typeorm/driver/aurora-mysql/AuroraMysqlConnection.js +9 -12
- package/lib/typeorm/driver/aurora-mysql/AuroraMysqlConnection.js.map +1 -1
- package/lib/typeorm/driver/aurora-mysql/AuroraMysqlConnectionCredentialsOptions.js.map +1 -1
- package/lib/typeorm/driver/aurora-mysql/AuroraMysqlConnectionOptions.js.map +1 -1
- package/lib/typeorm/driver/aurora-mysql/AuroraMysqlDriver.js +392 -399
- package/lib/typeorm/driver/aurora-mysql/AuroraMysqlDriver.js.map +1 -1
- package/lib/typeorm/driver/aurora-mysql/AuroraMysqlQueryRunner.js +1320 -2084
- package/lib/typeorm/driver/aurora-mysql/AuroraMysqlQueryRunner.js.map +1 -1
- package/lib/typeorm/driver/aurora-postgres/AuroraPostgresConnectionOptions.js.map +1 -1
- package/lib/typeorm/driver/aurora-postgres/AuroraPostgresDriver.js +50 -78
- package/lib/typeorm/driver/aurora-postgres/AuroraPostgresDriver.js.map +1 -1
- package/lib/typeorm/driver/aurora-postgres/AuroraPostgresQueryRunner.js +89 -160
- package/lib/typeorm/driver/aurora-postgres/AuroraPostgresQueryRunner.js.map +1 -1
- package/lib/typeorm/driver/better-sqlite3/BetterSqlite3ConnectionOptions.js.map +1 -1
- package/lib/typeorm/driver/better-sqlite3/BetterSqlite3Driver.js +78 -152
- package/lib/typeorm/driver/better-sqlite3/BetterSqlite3Driver.js.map +1 -1
- package/lib/typeorm/driver/better-sqlite3/BetterSqlite3QueryRunner.js +96 -155
- package/lib/typeorm/driver/better-sqlite3/BetterSqlite3QueryRunner.js.map +1 -1
- package/lib/typeorm/driver/capacitor/CapacitorConnectionOptions.js.map +1 -1
- package/lib/typeorm/driver/capacitor/CapacitorDriver.js +44 -89
- package/lib/typeorm/driver/capacitor/CapacitorDriver.js.map +1 -1
- package/lib/typeorm/driver/capacitor/CapacitorQueryRunner.js +70 -122
- package/lib/typeorm/driver/capacitor/CapacitorQueryRunner.js.map +1 -1
- package/lib/typeorm/driver/cockroachdb/CockroachConnectionCredentialsOptions.js.map +1 -1
- package/lib/typeorm/driver/cockroachdb/CockroachConnectionOptions.js.map +1 -1
- package/lib/typeorm/driver/cockroachdb/CockroachDriver.js +368 -404
- package/lib/typeorm/driver/cockroachdb/CockroachDriver.js.map +1 -1
- package/lib/typeorm/driver/cockroachdb/CockroachQueryRunner.js +1752 -2862
- package/lib/typeorm/driver/cockroachdb/CockroachQueryRunner.js.map +1 -1
- package/lib/typeorm/driver/cordova/CordovaConnectionOptions.js.map +1 -1
- package/lib/typeorm/driver/cordova/CordovaDriver.js +36 -58
- package/lib/typeorm/driver/cordova/CordovaDriver.js.map +1 -1
- package/lib/typeorm/driver/cordova/CordovaQueryRunner.js +86 -164
- package/lib/typeorm/driver/cordova/CordovaQueryRunner.js.map +1 -1
- package/lib/typeorm/driver/expo/ExpoConnectionOptions.js.map +1 -1
- package/lib/typeorm/driver/expo/ExpoDriver.js +34 -44
- package/lib/typeorm/driver/expo/ExpoDriver.js.map +1 -1
- package/lib/typeorm/driver/expo/ExpoQueryRunner.js +114 -204
- package/lib/typeorm/driver/expo/ExpoQueryRunner.js.map +1 -1
- package/lib/typeorm/driver/mongodb/MongoConnectionOptions.js.map +1 -1
- package/lib/typeorm/driver/mongodb/MongoDriver.js +269 -243
- package/lib/typeorm/driver/mongodb/MongoDriver.js.map +1 -1
- package/lib/typeorm/driver/mongodb/MongoQueryRunner.js +357 -793
- package/lib/typeorm/driver/mongodb/MongoQueryRunner.js.map +1 -1
- package/lib/typeorm/driver/mongodb/typings.js.map +1 -1
- package/lib/typeorm/driver/mysql/MysqlConnectionCredentialsOptions.js.map +1 -1
- package/lib/typeorm/driver/mysql/MysqlConnectionOptions.js.map +1 -1
- package/lib/typeorm/driver/mysql/MysqlDriver.js +475 -480
- package/lib/typeorm/driver/mysql/MysqlDriver.js.map +1 -1
- package/lib/typeorm/driver/mysql/MysqlQueryRunner.js +1692 -2466
- package/lib/typeorm/driver/mysql/MysqlQueryRunner.js.map +1 -1
- package/lib/typeorm/driver/nativescript/NativescriptConnectionOptions.js.map +1 -1
- package/lib/typeorm/driver/nativescript/NativescriptDriver.js +46 -50
- package/lib/typeorm/driver/nativescript/NativescriptDriver.js.map +1 -1
- package/lib/typeorm/driver/nativescript/NativescriptQueryRunner.js +62 -101
- package/lib/typeorm/driver/nativescript/NativescriptQueryRunner.js.map +1 -1
- package/lib/typeorm/driver/oracle/OracleConnectionCredentialsOptions.js.map +1 -1
- package/lib/typeorm/driver/oracle/OracleConnectionOptions.js.map +1 -1
- package/lib/typeorm/driver/oracle/OracleDriver.js +345 -377
- package/lib/typeorm/driver/oracle/OracleDriver.js.map +1 -1
- package/lib/typeorm/driver/oracle/OracleQueryRunner.js +1484 -2384
- package/lib/typeorm/driver/oracle/OracleQueryRunner.js.map +1 -1
- package/lib/typeorm/driver/postgres/PostgresConnectionCredentialsOptions.js.map +1 -1
- package/lib/typeorm/driver/postgres/PostgresConnectionOptions.js.map +1 -1
- package/lib/typeorm/driver/postgres/PostgresDriver.js +574 -690
- package/lib/typeorm/driver/postgres/PostgresDriver.js.map +1 -1
- package/lib/typeorm/driver/postgres/PostgresQueryRunner.js +2153 -3379
- package/lib/typeorm/driver/postgres/PostgresQueryRunner.js.map +1 -1
- package/lib/typeorm/driver/react-native/ReactNativeConnectionOptions.js.map +1 -1
- package/lib/typeorm/driver/react-native/ReactNativeDriver.js +34 -44
- package/lib/typeorm/driver/react-native/ReactNativeDriver.js.map +1 -1
- package/lib/typeorm/driver/react-native/ReactNativeQueryRunner.js +60 -94
- package/lib/typeorm/driver/react-native/ReactNativeQueryRunner.js.map +1 -1
- package/lib/typeorm/driver/sap/SapConnectionCredentialsOptions.js.map +1 -1
- package/lib/typeorm/driver/sap/SapConnectionOptions.js.map +1 -1
- package/lib/typeorm/driver/sap/SapDriver.js +310 -305
- package/lib/typeorm/driver/sap/SapDriver.js.map +1 -1
- package/lib/typeorm/driver/sap/SapQueryRunner.js +1635 -2561
- package/lib/typeorm/driver/sap/SapQueryRunner.js.map +1 -1
- package/lib/typeorm/driver/spanner/SpannerConnectionCredentialsOptions.js.map +1 -1
- package/lib/typeorm/driver/spanner/SpannerConnectionOptions.js.map +1 -1
- package/lib/typeorm/driver/spanner/SpannerDriver.js +250 -236
- package/lib/typeorm/driver/spanner/SpannerDriver.js.map +1 -1
- package/lib/typeorm/driver/spanner/SpannerQueryRunner.js +1136 -2168
- package/lib/typeorm/driver/spanner/SpannerQueryRunner.js.map +1 -1
- package/lib/typeorm/driver/sqlite/SqliteConnectionOptions.js.map +1 -1
- package/lib/typeorm/driver/sqlite/SqliteDriver.js +82 -169
- package/lib/typeorm/driver/sqlite/SqliteDriver.js.map +1 -1
- package/lib/typeorm/driver/sqlite/SqliteQueryRunner.js +78 -122
- package/lib/typeorm/driver/sqlite/SqliteQueryRunner.js.map +1 -1
- package/lib/typeorm/driver/sqlite-abstract/AbstractSqliteDriver.js +280 -268
- package/lib/typeorm/driver/sqlite-abstract/AbstractSqliteDriver.js.map +1 -1
- package/lib/typeorm/driver/sqlite-abstract/AbstractSqliteQueryRunner.js +1158 -1990
- package/lib/typeorm/driver/sqlite-abstract/AbstractSqliteQueryRunner.js.map +1 -1
- package/lib/typeorm/driver/sqljs/SqljsConnectionOptions.js.map +1 -1
- package/lib/typeorm/driver/sqljs/SqljsDriver.js +187 -253
- package/lib/typeorm/driver/sqljs/SqljsDriver.js.map +1 -1
- package/lib/typeorm/driver/sqljs/SqljsQueryRunner.js +88 -147
- package/lib/typeorm/driver/sqljs/SqljsQueryRunner.js.map +1 -1
- package/lib/typeorm/driver/sqlserver/MssqlParameter.js +10 -13
- package/lib/typeorm/driver/sqlserver/MssqlParameter.js.map +1 -1
- package/lib/typeorm/driver/sqlserver/SqlServerConnectionCredentialsOptions.js.map +1 -1
- package/lib/typeorm/driver/sqlserver/SqlServerConnectionOptions.js.map +1 -1
- package/lib/typeorm/driver/sqlserver/SqlServerDriver.js +352 -372
- package/lib/typeorm/driver/sqlserver/SqlServerDriver.js.map +1 -1
- package/lib/typeorm/driver/sqlserver/SqlServerQueryRunner.js +1979 -3068
- package/lib/typeorm/driver/sqlserver/SqlServerQueryRunner.js.map +1 -1
- package/lib/typeorm/driver/sqlserver/authentication/AzureActiveDirectoryAccessTokenAuthentication.js.map +1 -1
- package/lib/typeorm/driver/sqlserver/authentication/AzureActiveDirectoryMsiAppServiceAuthentication.js.map +1 -1
- package/lib/typeorm/driver/sqlserver/authentication/AzureActiveDirectoryMsiVmAuthentication.js.map +1 -1
- package/lib/typeorm/driver/sqlserver/authentication/AzureActiveDirectoryPasswordAuthentication.js.map +1 -1
- package/lib/typeorm/driver/sqlserver/authentication/AzureActiveDirectoryServicePrincipalSecret.js.map +1 -1
- package/lib/typeorm/driver/sqlserver/authentication/DefaultAuthentication.js.map +1 -1
- package/lib/typeorm/driver/sqlserver/authentication/NtlmAuthentication.js.map +1 -1
- package/lib/typeorm/driver/types/ColumnTypes.js.map +1 -1
- package/lib/typeorm/driver/types/CteCapabilities.js.map +1 -1
- package/lib/typeorm/driver/types/DataTypeDefaults.js.map +1 -1
- package/lib/typeorm/driver/types/DatabaseType.js.map +1 -1
- package/lib/typeorm/driver/types/IsolationLevel.js.map +1 -1
- package/lib/typeorm/driver/types/MappedColumnTypes.js.map +1 -1
- package/lib/typeorm/driver/types/MetadataTableType.js.map +1 -1
- package/lib/typeorm/driver/types/ReplicationMode.js.map +1 -1
- package/lib/typeorm/driver/types/UpsertType.js.map +1 -1
- package/lib/typeorm/entity-manager/EntityManager.js +351 -469
- package/lib/typeorm/entity-manager/EntityManager.js.map +1 -1
- package/lib/typeorm/entity-manager/EntityManagerFactory.js +7 -10
- package/lib/typeorm/entity-manager/EntityManagerFactory.js.map +1 -1
- package/lib/typeorm/entity-manager/MongoEntityManager.js +371 -487
- package/lib/typeorm/entity-manager/MongoEntityManager.js.map +1 -1
- package/lib/typeorm/entity-manager/SqljsEntityManager.js +16 -37
- package/lib/typeorm/entity-manager/SqljsEntityManager.js.map +1 -1
- package/lib/typeorm/entity-schema/EntitySchema.js +5 -5
- package/lib/typeorm/entity-schema/EntitySchema.js.map +1 -1
- package/lib/typeorm/entity-schema/EntitySchemaCheckOptions.js.map +1 -1
- package/lib/typeorm/entity-schema/EntitySchemaColumnOptions.js.map +1 -1
- package/lib/typeorm/entity-schema/EntitySchemaEmbeddedColumnOptions.js +17 -5
- package/lib/typeorm/entity-schema/EntitySchemaEmbeddedColumnOptions.js.map +1 -1
- package/lib/typeorm/entity-schema/EntitySchemaEmbeddedError.js +11 -14
- package/lib/typeorm/entity-schema/EntitySchemaEmbeddedError.js.map +1 -1
- package/lib/typeorm/entity-schema/EntitySchemaExclusionOptions.js.map +1 -1
- package/lib/typeorm/entity-schema/EntitySchemaIndexOptions.js.map +1 -1
- package/lib/typeorm/entity-schema/EntitySchemaOptions.js +82 -5
- package/lib/typeorm/entity-schema/EntitySchemaOptions.js.map +1 -1
- package/lib/typeorm/entity-schema/EntitySchemaRelationIdOptions.js.map +1 -1
- package/lib/typeorm/entity-schema/EntitySchemaRelationOptions.js.map +1 -1
- package/lib/typeorm/entity-schema/EntitySchemaTransformer.js +51 -68
- package/lib/typeorm/entity-schema/EntitySchemaTransformer.js.map +1 -1
- package/lib/typeorm/entity-schema/EntitySchemaUniqueOptions.js.map +1 -1
- package/lib/typeorm/error/AlreadyHasActiveConnectionError.js +6 -9
- package/lib/typeorm/error/AlreadyHasActiveConnectionError.js.map +1 -1
- package/lib/typeorm/error/CannotAttachTreeChildrenEntityError.js +6 -9
- package/lib/typeorm/error/CannotAttachTreeChildrenEntityError.js.map +1 -1
- package/lib/typeorm/error/CannotConnectAlreadyConnectedError.js +5 -8
- package/lib/typeorm/error/CannotConnectAlreadyConnectedError.js.map +1 -1
- package/lib/typeorm/error/CannotCreateEntityIdMapError.js +7 -11
- package/lib/typeorm/error/CannotCreateEntityIdMapError.js.map +1 -1
- package/lib/typeorm/error/CannotDetermineEntityError.js +6 -9
- package/lib/typeorm/error/CannotDetermineEntityError.js.map +1 -1
- package/lib/typeorm/error/CannotExecuteNotConnectedError.js +5 -8
- package/lib/typeorm/error/CannotExecuteNotConnectedError.js.map +1 -1
- package/lib/typeorm/error/CannotGetEntityManagerNotConnectedError.js +5 -8
- package/lib/typeorm/error/CannotGetEntityManagerNotConnectedError.js.map +1 -1
- package/lib/typeorm/error/CannotReflectMethodParameterTypeError.js +7 -10
- package/lib/typeorm/error/CannotReflectMethodParameterTypeError.js.map +1 -1
- package/lib/typeorm/error/CircularRelationsError.js +6 -9
- package/lib/typeorm/error/CircularRelationsError.js.map +1 -1
- package/lib/typeorm/error/ColumnTypeUndefinedError.js +8 -11
- package/lib/typeorm/error/ColumnTypeUndefinedError.js.map +1 -1
- package/lib/typeorm/error/ConnectionIsNotSetError.js +5 -8
- package/lib/typeorm/error/ConnectionIsNotSetError.js.map +1 -1
- package/lib/typeorm/error/ConnectionNotFoundError.js +5 -8
- package/lib/typeorm/error/ConnectionNotFoundError.js.map +1 -1
- package/lib/typeorm/error/CustomRepositoryCannotInheritRepositoryError.js +7 -10
- package/lib/typeorm/error/CustomRepositoryCannotInheritRepositoryError.js.map +1 -1
- package/lib/typeorm/error/CustomRepositoryDoesNotHaveEntityError.js +7 -10
- package/lib/typeorm/error/CustomRepositoryDoesNotHaveEntityError.js.map +1 -1
- package/lib/typeorm/error/CustomRepositoryNotFoundError.js +7 -10
- package/lib/typeorm/error/CustomRepositoryNotFoundError.js.map +1 -1
- package/lib/typeorm/error/DataTypeNotSupportedError.js +7 -11
- package/lib/typeorm/error/DataTypeNotSupportedError.js.map +1 -1
- package/lib/typeorm/error/DriverOptionNotSetError.js +6 -9
- package/lib/typeorm/error/DriverOptionNotSetError.js.map +1 -1
- package/lib/typeorm/error/DriverPackageNotInstalledError.js +6 -9
- package/lib/typeorm/error/DriverPackageNotInstalledError.js.map +1 -1
- package/lib/typeorm/error/EntityMetadataNotFoundError.js +10 -14
- package/lib/typeorm/error/EntityMetadataNotFoundError.js.map +1 -1
- package/lib/typeorm/error/EntityNotFoundError.js +13 -17
- package/lib/typeorm/error/EntityNotFoundError.js.map +1 -1
- package/lib/typeorm/error/EntityPropertyNotFoundError.js +7 -11
- package/lib/typeorm/error/EntityPropertyNotFoundError.js.map +1 -1
- package/lib/typeorm/error/FindRelationsNotFoundError.js +9 -13
- package/lib/typeorm/error/FindRelationsNotFoundError.js.map +1 -1
- package/lib/typeorm/error/ForbiddenTransactionModeOverrideError.js +6 -9
- package/lib/typeorm/error/ForbiddenTransactionModeOverrideError.js.map +1 -1
- package/lib/typeorm/error/InitializedRelationError.js +7 -10
- package/lib/typeorm/error/InitializedRelationError.js.map +1 -1
- package/lib/typeorm/error/InsertValuesMissingError.js +6 -9
- package/lib/typeorm/error/InsertValuesMissingError.js.map +1 -1
- package/lib/typeorm/error/LimitOnUpdateNotSupportedError.js +5 -8
- package/lib/typeorm/error/LimitOnUpdateNotSupportedError.js.map +1 -1
- package/lib/typeorm/error/LockNotSupportedOnGivenDriverError.js +5 -8
- package/lib/typeorm/error/LockNotSupportedOnGivenDriverError.js.map +1 -1
- package/lib/typeorm/error/MetadataAlreadyExistsError.js +6 -9
- package/lib/typeorm/error/MetadataAlreadyExistsError.js.map +1 -1
- package/lib/typeorm/error/MetadataWithSuchNameAlreadyExistsError.js +6 -9
- package/lib/typeorm/error/MetadataWithSuchNameAlreadyExistsError.js.map +1 -1
- package/lib/typeorm/error/MissingDeleteDateColumnError.js +5 -8
- package/lib/typeorm/error/MissingDeleteDateColumnError.js.map +1 -1
- package/lib/typeorm/error/MissingDriverError.js +6 -10
- package/lib/typeorm/error/MissingDriverError.js.map +1 -1
- package/lib/typeorm/error/MissingJoinColumnError.js +12 -16
- package/lib/typeorm/error/MissingJoinColumnError.js.map +1 -1
- package/lib/typeorm/error/MissingJoinTableError.js +12 -16
- package/lib/typeorm/error/MissingJoinTableError.js.map +1 -1
- package/lib/typeorm/error/MissingPrimaryColumnError.js +6 -9
- package/lib/typeorm/error/MissingPrimaryColumnError.js.map +1 -1
- package/lib/typeorm/error/MustBeEntityError.js +5 -8
- package/lib/typeorm/error/MustBeEntityError.js.map +1 -1
- package/lib/typeorm/error/NamingStrategyNotFoundError.js +9 -13
- package/lib/typeorm/error/NamingStrategyNotFoundError.js.map +1 -1
- package/lib/typeorm/error/NestedSetMultipleRootError.js +5 -8
- package/lib/typeorm/error/NestedSetMultipleRootError.js.map +1 -1
- package/lib/typeorm/error/NoConnectionForRepositoryError.js +6 -9
- package/lib/typeorm/error/NoConnectionForRepositoryError.js.map +1 -1
- package/lib/typeorm/error/NoConnectionOptionError.js +6 -9
- package/lib/typeorm/error/NoConnectionOptionError.js.map +1 -1
- package/lib/typeorm/error/NoNeedToReleaseEntityManagerError.js +7 -10
- package/lib/typeorm/error/NoNeedToReleaseEntityManagerError.js.map +1 -1
- package/lib/typeorm/error/NoVersionOrUpdateDateColumnError.js +5 -8
- package/lib/typeorm/error/NoVersionOrUpdateDateColumnError.js.map +1 -1
- package/lib/typeorm/error/OffsetWithoutLimitNotSupportedError.js +7 -10
- package/lib/typeorm/error/OffsetWithoutLimitNotSupportedError.js.map +1 -1
- package/lib/typeorm/error/OptimisticLockCanNotBeUsedError.js +5 -8
- package/lib/typeorm/error/OptimisticLockCanNotBeUsedError.js.map +1 -1
- package/lib/typeorm/error/OptimisticLockVersionMismatchError.js +5 -8
- package/lib/typeorm/error/OptimisticLockVersionMismatchError.js.map +1 -1
- package/lib/typeorm/error/PersistedEntityNotFoundError.js +5 -8
- package/lib/typeorm/error/PersistedEntityNotFoundError.js.map +1 -1
- package/lib/typeorm/error/PessimisticLockTransactionRequiredError.js +5 -8
- package/lib/typeorm/error/PessimisticLockTransactionRequiredError.js.map +1 -1
- package/lib/typeorm/error/PrimaryColumnCannotBeNullableError.js +6 -9
- package/lib/typeorm/error/PrimaryColumnCannotBeNullableError.js.map +1 -1
- package/lib/typeorm/error/QueryFailedError.js +18 -17
- package/lib/typeorm/error/QueryFailedError.js.map +1 -1
- package/lib/typeorm/error/QueryRunnerAlreadyReleasedError.js +5 -8
- package/lib/typeorm/error/QueryRunnerAlreadyReleasedError.js.map +1 -1
- package/lib/typeorm/error/QueryRunnerProviderAlreadyReleasedError.js +6 -9
- package/lib/typeorm/error/QueryRunnerProviderAlreadyReleasedError.js.map +1 -1
- package/lib/typeorm/error/RepositoryNotTreeError.js +9 -13
- package/lib/typeorm/error/RepositoryNotTreeError.js.map +1 -1
- package/lib/typeorm/error/ReturningStatementNotSupportedError.js +5 -8
- package/lib/typeorm/error/ReturningStatementNotSupportedError.js.map +1 -1
- package/lib/typeorm/error/SubjectRemovedAndUpdatedError.js +6 -9
- package/lib/typeorm/error/SubjectRemovedAndUpdatedError.js.map +1 -1
- package/lib/typeorm/error/SubjectWithoutIdentifierError.js +5 -8
- package/lib/typeorm/error/SubjectWithoutIdentifierError.js.map +1 -1
- package/lib/typeorm/error/TransactionAlreadyStartedError.js +5 -8
- package/lib/typeorm/error/TransactionAlreadyStartedError.js.map +1 -1
- package/lib/typeorm/error/TransactionNotStartedError.js +5 -8
- package/lib/typeorm/error/TransactionNotStartedError.js.map +1 -1
- package/lib/typeorm/error/TreeRepositoryNotSupportedError.js +5 -8
- package/lib/typeorm/error/TreeRepositoryNotSupportedError.js.map +1 -1
- package/lib/typeorm/error/TypeORMError.js +9 -18
- package/lib/typeorm/error/TypeORMError.js.map +1 -1
- package/lib/typeorm/error/UpdateValuesMissingError.js +5 -8
- package/lib/typeorm/error/UpdateValuesMissingError.js.map +1 -1
- package/lib/typeorm/error/UsingJoinColumnIsNotAllowedError.js +6 -9
- package/lib/typeorm/error/UsingJoinColumnIsNotAllowedError.js.map +1 -1
- package/lib/typeorm/error/UsingJoinColumnOnlyOnOneSideAllowedError.js +7 -10
- package/lib/typeorm/error/UsingJoinColumnOnlyOnOneSideAllowedError.js.map +1 -1
- package/lib/typeorm/error/UsingJoinTableIsNotAllowedError.js +7 -10
- package/lib/typeorm/error/UsingJoinTableIsNotAllowedError.js.map +1 -1
- package/lib/typeorm/error/UsingJoinTableOnlyOnOneSideAllowedError.js +7 -10
- package/lib/typeorm/error/UsingJoinTableOnlyOnOneSideAllowedError.js.map +1 -1
- package/lib/typeorm/error/index.js +75 -62
- package/lib/typeorm/error/index.js.map +1 -1
- package/lib/typeorm/find-options/EqualOperator.js +6 -10
- package/lib/typeorm/find-options/EqualOperator.js.map +1 -1
- package/lib/typeorm/find-options/FindManyOptions.js.map +1 -1
- package/lib/typeorm/find-options/FindOneOptions.js.map +1 -1
- package/lib/typeorm/find-options/FindOperator.js +90 -94
- package/lib/typeorm/find-options/FindOperator.js.map +1 -1
- package/lib/typeorm/find-options/FindOperatorType.js.map +1 -1
- package/lib/typeorm/find-options/FindOptionsOrder.js.map +1 -1
- package/lib/typeorm/find-options/FindOptionsRelations.js.map +1 -1
- package/lib/typeorm/find-options/FindOptionsSelect.js.map +1 -1
- package/lib/typeorm/find-options/FindOptionsUtils.js +56 -87
- package/lib/typeorm/find-options/FindOptionsUtils.js.map +1 -1
- package/lib/typeorm/find-options/FindOptionsWhere.js.map +1 -1
- package/lib/typeorm/find-options/FindTreeOptions.js.map +1 -1
- package/lib/typeorm/find-options/JoinOptions.js.map +1 -1
- package/lib/typeorm/find-options/OrderByCondition.js.map +1 -1
- package/lib/typeorm/find-options/mongodb/MongoFindManyOptions.js.map +1 -1
- package/lib/typeorm/find-options/mongodb/MongoFindOneOptions.js.map +1 -1
- package/lib/typeorm/find-options/operator/And.js +2 -6
- package/lib/typeorm/find-options/operator/And.js.map +1 -1
- package/lib/typeorm/find-options/operator/Any.js +1 -1
- package/lib/typeorm/find-options/operator/Any.js.map +1 -1
- package/lib/typeorm/find-options/operator/ArrayContainedBy.js +1 -1
- package/lib/typeorm/find-options/operator/ArrayContainedBy.js.map +1 -1
- package/lib/typeorm/find-options/operator/ArrayContains.js +1 -1
- package/lib/typeorm/find-options/operator/ArrayContains.js.map +1 -1
- package/lib/typeorm/find-options/operator/ArrayOverlap.js +1 -1
- package/lib/typeorm/find-options/operator/ArrayOverlap.js.map +1 -1
- package/lib/typeorm/find-options/operator/Between.js +1 -1
- package/lib/typeorm/find-options/operator/Between.js.map +1 -1
- package/lib/typeorm/find-options/operator/Equal.js +1 -1
- package/lib/typeorm/find-options/operator/Equal.js.map +1 -1
- package/lib/typeorm/find-options/operator/ILike.js +1 -1
- package/lib/typeorm/find-options/operator/ILike.js.map +1 -1
- package/lib/typeorm/find-options/operator/In.js +1 -1
- package/lib/typeorm/find-options/operator/In.js.map +1 -1
- package/lib/typeorm/find-options/operator/IsNull.js +1 -1
- package/lib/typeorm/find-options/operator/IsNull.js.map +1 -1
- package/lib/typeorm/find-options/operator/LessThan.js +1 -1
- package/lib/typeorm/find-options/operator/LessThan.js.map +1 -1
- package/lib/typeorm/find-options/operator/LessThanOrEqual.js +1 -1
- package/lib/typeorm/find-options/operator/LessThanOrEqual.js.map +1 -1
- package/lib/typeorm/find-options/operator/Like.js +1 -1
- package/lib/typeorm/find-options/operator/Like.js.map +1 -1
- package/lib/typeorm/find-options/operator/MoreThan.js +1 -1
- package/lib/typeorm/find-options/operator/MoreThan.js.map +1 -1
- package/lib/typeorm/find-options/operator/MoreThanOrEqual.js +1 -1
- package/lib/typeorm/find-options/operator/MoreThanOrEqual.js.map +1 -1
- package/lib/typeorm/find-options/operator/Not.js +1 -1
- package/lib/typeorm/find-options/operator/Not.js.map +1 -1
- package/lib/typeorm/find-options/operator/Raw.js +1 -1
- package/lib/typeorm/find-options/operator/Raw.js.map +1 -1
- package/lib/typeorm/globals.js +33 -99
- package/lib/typeorm/globals.js.map +1 -1
- package/lib/typeorm/index.d.ts +0 -1
- package/lib/typeorm/index.js +136 -126
- package/lib/typeorm/index.js.map +1 -1
- package/lib/typeorm/logger/AdvancedConsoleLogger.js +26 -26
- package/lib/typeorm/logger/AdvancedConsoleLogger.js.map +1 -1
- package/lib/typeorm/logger/DebugLogger.js +24 -27
- package/lib/typeorm/logger/DebugLogger.js.map +1 -1
- package/lib/typeorm/logger/FileLogger.js +31 -30
- package/lib/typeorm/logger/FileLogger.js.map +1 -1
- package/lib/typeorm/logger/Logger.js.map +1 -1
- package/lib/typeorm/logger/LoggerFactory.js +9 -12
- package/lib/typeorm/logger/LoggerFactory.js.map +1 -1
- package/lib/typeorm/logger/LoggerOptions.js.map +1 -1
- package/lib/typeorm/logger/SimpleConsoleLogger.js +25 -25
- package/lib/typeorm/logger/SimpleConsoleLogger.js.map +1 -1
- package/lib/typeorm/metadata/CheckMetadata.js +30 -6
- package/lib/typeorm/metadata/CheckMetadata.js.map +1 -1
- package/lib/typeorm/metadata/ColumnMetadata.js +343 -199
- package/lib/typeorm/metadata/ColumnMetadata.js.map +1 -1
- package/lib/typeorm/metadata/EmbeddedMetadata.js +174 -153
- package/lib/typeorm/metadata/EmbeddedMetadata.js.map +1 -1
- package/lib/typeorm/metadata/EntityListenerMetadata.js +35 -15
- package/lib/typeorm/metadata/EntityListenerMetadata.js.map +1 -1
- package/lib/typeorm/metadata/EntityMetadata.js +516 -372
- package/lib/typeorm/metadata/EntityMetadata.js.map +1 -1
- package/lib/typeorm/metadata/ExclusionMetadata.js +30 -6
- package/lib/typeorm/metadata/ExclusionMetadata.js.map +1 -1
- package/lib/typeorm/metadata/ForeignKeyMetadata.js +60 -24
- package/lib/typeorm/metadata/ForeignKeyMetadata.js.map +1 -1
- package/lib/typeorm/metadata/IndexMetadata.js +119 -73
- package/lib/typeorm/metadata/IndexMetadata.js.map +1 -1
- package/lib/typeorm/metadata/RelationCountMetadata.js +40 -10
- package/lib/typeorm/metadata/RelationCountMetadata.js.map +1 -1
- package/lib/typeorm/metadata/RelationIdMetadata.js +47 -18
- package/lib/typeorm/metadata/RelationIdMetadata.js.map +1 -1
- package/lib/typeorm/metadata/RelationMetadata.js +270 -187
- package/lib/typeorm/metadata/RelationMetadata.js.map +1 -1
- package/lib/typeorm/metadata/UniqueMetadata.js +72 -47
- package/lib/typeorm/metadata/UniqueMetadata.js.map +1 -1
- package/lib/typeorm/metadata/types/ClosureTreeOptions.js.map +1 -1
- package/lib/typeorm/metadata/types/DeferrableType.js.map +1 -1
- package/lib/typeorm/metadata/types/EventListenerTypes.js +13 -16
- package/lib/typeorm/metadata/types/EventListenerTypes.js.map +1 -1
- package/lib/typeorm/metadata/types/OnDeleteType.js.map +1 -1
- package/lib/typeorm/metadata/types/OnUpdateType.js.map +1 -1
- package/lib/typeorm/metadata/types/PropertyTypeInFunction.js.map +1 -1
- package/lib/typeorm/metadata/types/RelationTypeInFunction.js.map +1 -1
- package/lib/typeorm/metadata/types/RelationTypes.js.map +1 -1
- package/lib/typeorm/metadata/types/TableTypes.js.map +1 -1
- package/lib/typeorm/metadata/types/TreeTypes.js.map +1 -1
- package/lib/typeorm/metadata-args/CheckMetadataArgs.js.map +1 -1
- package/lib/typeorm/metadata-args/ColumnMetadataArgs.js.map +1 -1
- package/lib/typeorm/metadata-args/DiscriminatorValueMetadataArgs.js.map +1 -1
- package/lib/typeorm/metadata-args/EmbeddedMetadataArgs.js.map +1 -1
- package/lib/typeorm/metadata-args/EntityListenerMetadataArgs.js.map +1 -1
- package/lib/typeorm/metadata-args/EntityRepositoryMetadataArgs.js.map +1 -1
- package/lib/typeorm/metadata-args/EntitySubscriberMetadataArgs.js.map +1 -1
- package/lib/typeorm/metadata-args/ExclusionMetadataArgs.js.map +1 -1
- package/lib/typeorm/metadata-args/GeneratedMetadataArgs.js.map +1 -1
- package/lib/typeorm/metadata-args/IndexMetadataArgs.js.map +1 -1
- package/lib/typeorm/metadata-args/InheritanceMetadataArgs.js.map +1 -1
- package/lib/typeorm/metadata-args/JoinColumnMetadataArgs.js.map +1 -1
- package/lib/typeorm/metadata-args/JoinTableMetadataArgs.js.map +1 -1
- package/lib/typeorm/metadata-args/MetadataArgsStorage.js +108 -113
- package/lib/typeorm/metadata-args/MetadataArgsStorage.js.map +1 -1
- package/lib/typeorm/metadata-args/NamingStrategyMetadataArgs.js.map +1 -1
- package/lib/typeorm/metadata-args/RelationCountMetadataArgs.js.map +1 -1
- package/lib/typeorm/metadata-args/RelationIdMetadataArgs.js.map +1 -1
- package/lib/typeorm/metadata-args/RelationMetadataArgs.js.map +1 -1
- package/lib/typeorm/metadata-args/TableMetadataArgs.js.map +1 -1
- package/lib/typeorm/metadata-args/TransactionEntityMetadataArgs.js.map +1 -1
- package/lib/typeorm/metadata-args/TransactionRepositoryMetadataArgs.js.map +1 -1
- package/lib/typeorm/metadata-args/TreeMetadataArgs.js.map +1 -1
- package/lib/typeorm/metadata-args/UniqueMetadataArgs.js.map +1 -1
- package/lib/typeorm/metadata-args/types/ColumnMode.js.map +1 -1
- package/lib/typeorm/metadata-builder/ClosureJunctionEntityMetadataBuilder.js +14 -15
- package/lib/typeorm/metadata-builder/ClosureJunctionEntityMetadataBuilder.js.map +1 -1
- package/lib/typeorm/metadata-builder/EntityMetadataBuilder.js +291 -347
- package/lib/typeorm/metadata-builder/EntityMetadataBuilder.js.map +1 -1
- package/lib/typeorm/metadata-builder/EntityMetadataValidator.js +63 -77
- package/lib/typeorm/metadata-builder/EntityMetadataValidator.js.map +1 -1
- package/lib/typeorm/metadata-builder/JunctionEntityMetadataBuilder.js +64 -69
- package/lib/typeorm/metadata-builder/JunctionEntityMetadataBuilder.js.map +1 -1
- package/lib/typeorm/metadata-builder/MetadataUtils.js +12 -15
- package/lib/typeorm/metadata-builder/MetadataUtils.js.map +1 -1
- package/lib/typeorm/metadata-builder/RelationJoinColumnBuilder.js +43 -49
- package/lib/typeorm/metadata-builder/RelationJoinColumnBuilder.js.map +1 -1
- package/lib/typeorm/migration/Migration.js +23 -4
- package/lib/typeorm/migration/Migration.js.map +1 -1
- package/lib/typeorm/migration/MigrationExecutor.js +432 -691
- package/lib/typeorm/migration/MigrationExecutor.js.map +1 -1
- package/lib/typeorm/migration/MigrationInterface.js.map +1 -1
- package/lib/typeorm/naming-strategy/DefaultNamingStrategy.js +80 -84
- package/lib/typeorm/naming-strategy/DefaultNamingStrategy.js.map +1 -1
- package/lib/typeorm/naming-strategy/NamingStrategyInterface.js.map +1 -1
- package/lib/typeorm/persistence/EntityPersistExecutor.js +154 -212
- package/lib/typeorm/persistence/EntityPersistExecutor.js.map +1 -1
- package/lib/typeorm/persistence/Subject.js +162 -149
- package/lib/typeorm/persistence/Subject.js.map +1 -1
- package/lib/typeorm/persistence/SubjectChangeMap.js.map +1 -1
- package/lib/typeorm/persistence/SubjectChangedColumnsComputer.js +29 -35
- package/lib/typeorm/persistence/SubjectChangedColumnsComputer.js.map +1 -1
- package/lib/typeorm/persistence/SubjectDatabaseEntityLoader.js +99 -130
- package/lib/typeorm/persistence/SubjectDatabaseEntityLoader.js.map +1 -1
- package/lib/typeorm/persistence/SubjectExecutor.js +635 -879
- package/lib/typeorm/persistence/SubjectExecutor.js.map +1 -1
- package/lib/typeorm/persistence/SubjectTopoligicalSorter.js +62 -58
- package/lib/typeorm/persistence/SubjectTopoligicalSorter.js.map +1 -1
- package/lib/typeorm/persistence/subject-builder/CascadesSubjectBuilder.js +16 -19
- package/lib/typeorm/persistence/subject-builder/CascadesSubjectBuilder.js.map +1 -1
- package/lib/typeorm/persistence/subject-builder/ManyToManySubjectBuilder.js +50 -53
- package/lib/typeorm/persistence/subject-builder/ManyToManySubjectBuilder.js.map +1 -1
- package/lib/typeorm/persistence/subject-builder/OneToManySubjectBuilder.js +28 -33
- package/lib/typeorm/persistence/subject-builder/OneToManySubjectBuilder.js.map +1 -1
- package/lib/typeorm/persistence/subject-builder/OneToOneInverseSideSubjectBuilder.js +19 -20
- package/lib/typeorm/persistence/subject-builder/OneToOneInverseSideSubjectBuilder.js.map +1 -1
- package/lib/typeorm/persistence/tree/ClosureSubjectExecutor.js +202 -271
- package/lib/typeorm/persistence/tree/ClosureSubjectExecutor.js.map +1 -1
- package/lib/typeorm/persistence/tree/MaterializedPathSubjectExecutor.js +79 -121
- package/lib/typeorm/persistence/tree/MaterializedPathSubjectExecutor.js.map +1 -1
- package/lib/typeorm/persistence/tree/NestedSetSubjectExecutor.js +220 -353
- package/lib/typeorm/persistence/tree/NestedSetSubjectExecutor.js.map +1 -1
- package/lib/typeorm/platform/PlatformTools.js +66 -78
- package/lib/typeorm/platform/PlatformTools.js.map +1 -1
- package/lib/typeorm/query-builder/Alias.js +31 -32
- package/lib/typeorm/query-builder/Alias.js.map +1 -1
- package/lib/typeorm/query-builder/Brackets.js +8 -5
- package/lib/typeorm/query-builder/Brackets.js.map +1 -1
- package/lib/typeorm/query-builder/DeleteQueryBuilder.js +96 -120
- package/lib/typeorm/query-builder/DeleteQueryBuilder.js.map +1 -1
- package/lib/typeorm/query-builder/InsertOrUpdateOptions.js.map +1 -1
- package/lib/typeorm/query-builder/InsertQueryBuilder.js +321 -367
- package/lib/typeorm/query-builder/InsertQueryBuilder.js.map +1 -1
- package/lib/typeorm/query-builder/JoinAttribute.js +175 -206
- package/lib/typeorm/query-builder/JoinAttribute.js.map +1 -1
- package/lib/typeorm/query-builder/JoinOptions.js.map +1 -1
- package/lib/typeorm/query-builder/NotBrackets.js +4 -11
- package/lib/typeorm/query-builder/NotBrackets.js.map +1 -1
- package/lib/typeorm/query-builder/QueryBuilder.js +400 -646
- package/lib/typeorm/query-builder/QueryBuilder.js.map +1 -1
- package/lib/typeorm/query-builder/QueryBuilderCte.js.map +1 -1
- package/lib/typeorm/query-builder/QueryBuilderUtils.js +5 -9
- package/lib/typeorm/query-builder/QueryBuilderUtils.js.map +1 -1
- package/lib/typeorm/query-builder/QueryExpressionMap.js +304 -233
- package/lib/typeorm/query-builder/QueryExpressionMap.js.map +1 -1
- package/lib/typeorm/query-builder/QueryPartialEntity.js.map +1 -1
- package/lib/typeorm/query-builder/RelationIdLoader.js +166 -189
- package/lib/typeorm/query-builder/RelationIdLoader.js.map +1 -1
- package/lib/typeorm/query-builder/RelationLoader.js +81 -94
- package/lib/typeorm/query-builder/RelationLoader.js.map +1 -1
- package/lib/typeorm/query-builder/RelationQueryBuilder.js +91 -127
- package/lib/typeorm/query-builder/RelationQueryBuilder.js.map +1 -1
- package/lib/typeorm/query-builder/RelationRemover.js +121 -124
- package/lib/typeorm/query-builder/RelationRemover.js.map +1 -1
- package/lib/typeorm/query-builder/RelationUpdater.js +130 -148
- package/lib/typeorm/query-builder/RelationUpdater.js.map +1 -1
- package/lib/typeorm/query-builder/ReturningResultsEntityUpdator.js +131 -159
- package/lib/typeorm/query-builder/ReturningResultsEntityUpdator.js.map +1 -1
- package/lib/typeorm/query-builder/SelectQuery.js.map +1 -1
- package/lib/typeorm/query-builder/SelectQueryBuilder.js +955 -1211
- package/lib/typeorm/query-builder/SelectQueryBuilder.js.map +1 -1
- package/lib/typeorm/query-builder/SelectQueryBuilderOption.js.map +1 -1
- package/lib/typeorm/query-builder/SoftDeleteQueryBuilder.js +155 -194
- package/lib/typeorm/query-builder/SoftDeleteQueryBuilder.js.map +1 -1
- package/lib/typeorm/query-builder/UpdateQueryBuilder.js +204 -246
- package/lib/typeorm/query-builder/UpdateQueryBuilder.js.map +1 -1
- package/lib/typeorm/query-builder/WhereClause.js.map +1 -1
- package/lib/typeorm/query-builder/WhereExpressionBuilder.js.map +1 -1
- package/lib/typeorm/query-builder/relation-count/RelationCountAttribute.js +85 -98
- package/lib/typeorm/query-builder/relation-count/RelationCountAttribute.js.map +1 -1
- package/lib/typeorm/query-builder/relation-count/RelationCountLoadResult.js.map +1 -1
- package/lib/typeorm/query-builder/relation-count/RelationCountLoader.js +153 -172
- package/lib/typeorm/query-builder/relation-count/RelationCountLoader.js.map +1 -1
- package/lib/typeorm/query-builder/relation-count/RelationCountMetadataToAttributeTransformer.js +16 -17
- package/lib/typeorm/query-builder/relation-count/RelationCountMetadataToAttributeTransformer.js.map +1 -1
- package/lib/typeorm/query-builder/relation-id/RelationIdAttribute.js +93 -107
- package/lib/typeorm/query-builder/relation-id/RelationIdAttribute.js.map +1 -1
- package/lib/typeorm/query-builder/relation-id/RelationIdLoadResult.js.map +1 -1
- package/lib/typeorm/query-builder/relation-id/RelationIdLoader.js +259 -267
- package/lib/typeorm/query-builder/relation-id/RelationIdLoader.js.map +1 -1
- package/lib/typeorm/query-builder/relation-id/RelationIdMetadataToAttributeTransformer.js +16 -17
- package/lib/typeorm/query-builder/relation-id/RelationIdMetadataToAttributeTransformer.js.map +1 -1
- package/lib/typeorm/query-builder/result/DeleteResult.js +14 -8
- package/lib/typeorm/query-builder/result/DeleteResult.js.map +1 -1
- package/lib/typeorm/query-builder/result/InsertResult.js +19 -18
- package/lib/typeorm/query-builder/result/InsertResult.js.map +1 -1
- package/lib/typeorm/query-builder/result/UpdateResult.js +24 -18
- package/lib/typeorm/query-builder/result/UpdateResult.js.map +1 -1
- package/lib/typeorm/query-builder/transformer/DocumentToEntityTransformer.js +24 -26
- package/lib/typeorm/query-builder/transformer/DocumentToEntityTransformer.js.map +1 -1
- package/lib/typeorm/query-builder/transformer/PlainObjectToDatabaseEntityTransformer.js +77 -112
- package/lib/typeorm/query-builder/transformer/PlainObjectToDatabaseEntityTransformer.js.map +1 -1
- package/lib/typeorm/query-builder/transformer/PlainObjectToNewEntityTransformer.js +16 -22
- package/lib/typeorm/query-builder/transformer/PlainObjectToNewEntityTransformer.js.map +1 -1
- package/lib/typeorm/query-builder/transformer/RawSqlResultsToEntityTransformer.js +117 -132
- package/lib/typeorm/query-builder/transformer/RawSqlResultsToEntityTransformer.js.map +1 -1
- package/lib/typeorm/query-runner/BaseQueryRunner.js +227 -393
- package/lib/typeorm/query-runner/BaseQueryRunner.js.map +1 -1
- package/lib/typeorm/query-runner/QueryLock.js +19 -32
- package/lib/typeorm/query-runner/QueryLock.js.map +1 -1
- package/lib/typeorm/query-runner/QueryResult.js +14 -9
- package/lib/typeorm/query-runner/QueryResult.js.map +1 -1
- package/lib/typeorm/query-runner/QueryRunner.js.map +1 -1
- package/lib/typeorm/repository/AbstractRepository.js +46 -50
- package/lib/typeorm/repository/AbstractRepository.js.map +1 -1
- package/lib/typeorm/repository/BaseEntity.js +106 -123
- package/lib/typeorm/repository/BaseEntity.js.map +1 -1
- package/lib/typeorm/repository/EntityId.js.map +1 -1
- package/lib/typeorm/repository/FindTreesOptions.js.map +1 -1
- package/lib/typeorm/repository/MongoRepository.js +109 -135
- package/lib/typeorm/repository/MongoRepository.js.map +1 -1
- package/lib/typeorm/repository/RemoveOptions.js.map +1 -1
- package/lib/typeorm/repository/Repository.js +108 -140
- package/lib/typeorm/repository/Repository.js.map +1 -1
- package/lib/typeorm/repository/SaveOptions.js.map +1 -1
- package/lib/typeorm/repository/TreeRepository.js +107 -154
- package/lib/typeorm/repository/TreeRepository.js.map +1 -1
- package/lib/typeorm/repository/UpsertOptions.js.map +1 -1
- package/lib/typeorm/schema-builder/MongoSchemaBuilder.js +30 -42
- package/lib/typeorm/schema-builder/MongoSchemaBuilder.js.map +1 -1
- package/lib/typeorm/schema-builder/RdbmsSchemaBuilder.js +727 -1938
- package/lib/typeorm/schema-builder/RdbmsSchemaBuilder.js.map +1 -1
- package/lib/typeorm/schema-builder/SchemaBuilder.js.map +1 -1
- package/lib/typeorm/schema-builder/options/TableCheckOptions.js.map +1 -1
- package/lib/typeorm/schema-builder/options/TableColumnOptions.js.map +1 -1
- package/lib/typeorm/schema-builder/options/TableExclusionOptions.js.map +1 -1
- package/lib/typeorm/schema-builder/options/TableForeignKeyOptions.js.map +1 -1
- package/lib/typeorm/schema-builder/options/TableIndexOptions.js.map +1 -1
- package/lib/typeorm/schema-builder/options/TableOptions.js.map +1 -1
- package/lib/typeorm/schema-builder/options/TableUniqueOptions.js.map +1 -1
- package/lib/typeorm/schema-builder/options/ViewOptions.js.map +1 -1
- package/lib/typeorm/schema-builder/table/Table.js +160 -157
- package/lib/typeorm/schema-builder/table/Table.js.map +1 -1
- package/lib/typeorm/schema-builder/table/TableCheck.js +24 -15
- package/lib/typeorm/schema-builder/table/TableCheck.js.map +1 -1
- package/lib/typeorm/schema-builder/table/TableColumn.js +123 -41
- package/lib/typeorm/schema-builder/table/TableColumn.js.map +1 -1
- package/lib/typeorm/schema-builder/table/TableExclusion.js +19 -9
- package/lib/typeorm/schema-builder/table/TableExclusion.js.map +1 -1
- package/lib/typeorm/schema-builder/table/TableForeignKey.js +52 -20
- package/lib/typeorm/schema-builder/table/TableForeignKey.js.map +1 -1
- package/lib/typeorm/schema-builder/table/TableIndex.js +52 -16
- package/lib/typeorm/schema-builder/table/TableIndex.js.map +1 -1
- package/lib/typeorm/schema-builder/table/TableUnique.js +26 -16
- package/lib/typeorm/schema-builder/table/TableUnique.js.map +1 -1
- package/lib/typeorm/schema-builder/util/TableUtils.js +5 -8
- package/lib/typeorm/schema-builder/util/TableUtils.js.map +1 -1
- package/lib/typeorm/schema-builder/util/ViewUtils.js +4 -7
- package/lib/typeorm/schema-builder/util/ViewUtils.js.map +1 -1
- package/lib/typeorm/schema-builder/view/View.js +32 -10
- package/lib/typeorm/schema-builder/view/View.js.map +1 -1
- package/lib/typeorm/subscriber/Broadcaster.js +180 -216
- package/lib/typeorm/subscriber/Broadcaster.js.map +1 -1
- package/lib/typeorm/subscriber/BroadcasterResult.js +16 -29
- package/lib/typeorm/subscriber/BroadcasterResult.js.map +1 -1
- package/lib/typeorm/subscriber/EntitySubscriberInterface.js.map +1 -1
- package/lib/typeorm/subscriber/event/InsertEvent.js.map +1 -1
- package/lib/typeorm/subscriber/event/LoadEvent.js.map +1 -1
- package/lib/typeorm/subscriber/event/RecoverEvent.js.map +1 -1
- package/lib/typeorm/subscriber/event/RemoveEvent.js.map +1 -1
- package/lib/typeorm/subscriber/event/SoftRemoveEvent.js.map +1 -1
- package/lib/typeorm/subscriber/event/TransactionCommitEvent.js.map +1 -1
- package/lib/typeorm/subscriber/event/TransactionRollbackEvent.js.map +1 -1
- package/lib/typeorm/subscriber/event/TransactionStartEvent.js.map +1 -1
- package/lib/typeorm/subscriber/event/UpdateEvent.js.map +1 -1
- package/lib/typeorm/util/ApplyValueTransformers.js +9 -12
- package/lib/typeorm/util/ApplyValueTransformers.js.map +1 -1
- package/lib/typeorm/util/DateUtils.js +44 -53
- package/lib/typeorm/util/DateUtils.js.map +1 -1
- package/lib/typeorm/util/DepGraph.js +50 -53
- package/lib/typeorm/util/DepGraph.js.map +1 -1
- package/lib/typeorm/util/DirectoryExportedClassesLoader.js +48 -70
- package/lib/typeorm/util/DirectoryExportedClassesLoader.js.map +1 -1
- package/lib/typeorm/util/ImportUtils.js +43 -65
- package/lib/typeorm/util/ImportUtils.js.map +1 -1
- package/lib/typeorm/util/InstanceChecker.js +64 -67
- package/lib/typeorm/util/InstanceChecker.js.map +1 -1
- package/lib/typeorm/util/ObjectUtils.js +13 -42
- package/lib/typeorm/util/ObjectUtils.js.map +1 -1
- package/lib/typeorm/util/OrmUtils.js +91 -158
- package/lib/typeorm/util/OrmUtils.js.map +1 -1
- package/lib/typeorm/util/PathUtils.js +8 -8
- package/lib/typeorm/util/PathUtils.js.map +1 -1
- package/lib/typeorm/util/RandomGenerator.js +22 -25
- package/lib/typeorm/util/RandomGenerator.js.map +1 -1
- package/lib/typeorm/util/StringUtils.js +17 -21
- package/lib/typeorm/util/StringUtils.js.map +1 -1
- package/lib/typeorm/util/TreeRepositoryUtils.js +27 -30
- package/lib/typeorm/util/TreeRepositoryUtils.js.map +1 -1
- package/lib/typeorm/util/VersionUtils.js +9 -13
- package/lib/typeorm/util/VersionUtils.js.map +1 -1
- package/lib/typeorm/util/escapeRegExp.js +2 -2
- package/lib/typeorm/util/escapeRegExp.js.map +1 -1
- package/migrations/index.js +15 -2
- package/migrations/index.js.map +1 -1
- package/migrations/migrations_index._auto-generated_.d.ts +1 -0
- package/migrations/migrations_index._auto-generated_.js.map +1 -1
- package/package.json +8 -44
- package/src.d.ts +1 -1
- package/taon.jsonc +3 -30
- package/tmp-environment.json +8 -370
- package/websql/esm2022/lib/typeorm/driver/cordova/CordovaDriver.mjs +1 -1
- package/websql/esm2022/lib/typeorm/driver/cordova/CordovaQueryRunner.mjs +1 -1
- package/websql/esm2022/lib/typeorm/driver/nativescript/NativescriptDriver.mjs +1 -1
- package/websql/esm2022/lib/typeorm/driver/nativescript/NativescriptQueryRunner.mjs +1 -1
- package/websql/esm2022/lib/typeorm/driver/react-native/ReactNativeDriver.mjs +1 -1
- package/websql/esm2022/lib/typeorm/driver/react-native/ReactNativeQueryRunner.mjs +1 -1
- package/websql/esm2022/lib/typeorm/driver/sqljs/SqljsDriver.mjs +1 -1
- package/websql/esm2022/lib/typeorm/driver/sqljs/SqljsQueryRunner.mjs +1 -1
- package/websql/esm2022/lib/typeorm/index.mjs +1 -3
- package/websql/fesm2022/taon-typeorm.mjs.map +1 -1
- package/browser/package.json +0 -25
- package/websql/package.json +0 -25
|
@@ -1,36 +1,52 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MigrationExecutor = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var Migration_1 = require("./Migration");
|
|
4
|
+
const Table_1 = require("../schema-builder/table/Table");
|
|
5
|
+
const Migration_1 = require("./Migration");
|
|
7
6
|
//#region @backend
|
|
8
|
-
|
|
7
|
+
const MssqlParameter_1 = require("../driver/sqlserver/MssqlParameter");
|
|
9
8
|
//#endregion
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
const error_1 = require("../error");
|
|
10
|
+
const InstanceChecker_1 = require("../util/InstanceChecker");
|
|
12
11
|
/**
|
|
13
12
|
* Executes migrations: runs pending and reverts previously executed migrations.
|
|
14
13
|
*/
|
|
15
|
-
|
|
14
|
+
class MigrationExecutor {
|
|
15
|
+
connection;
|
|
16
|
+
queryRunner;
|
|
17
|
+
// -------------------------------------------------------------------------
|
|
18
|
+
// Public Properties
|
|
19
|
+
// -------------------------------------------------------------------------
|
|
20
|
+
/**
|
|
21
|
+
* Indicates how migrations should be run in transactions.
|
|
22
|
+
* all: all migrations are run in a single transaction
|
|
23
|
+
* none: all migrations are run without a transaction
|
|
24
|
+
* each: each migration is run in a separate transaction
|
|
25
|
+
*/
|
|
26
|
+
transaction = "all";
|
|
27
|
+
/**
|
|
28
|
+
* Option to fake-run or fake-revert a migration, adding to the
|
|
29
|
+
* executed migrations table, but not actually running it. This feature is
|
|
30
|
+
* useful for when migrations are added after the fact or for
|
|
31
|
+
* interoperability between applications which are desired to each keep
|
|
32
|
+
* a consistent migration history.
|
|
33
|
+
*/
|
|
34
|
+
fake;
|
|
35
|
+
// -------------------------------------------------------------------------
|
|
36
|
+
// Private Properties
|
|
37
|
+
// -------------------------------------------------------------------------
|
|
38
|
+
migrationsDatabase;
|
|
39
|
+
migrationsSchema;
|
|
40
|
+
migrationsTable;
|
|
41
|
+
migrationsTableName;
|
|
16
42
|
// -------------------------------------------------------------------------
|
|
17
43
|
// Constructor
|
|
18
44
|
// -------------------------------------------------------------------------
|
|
19
|
-
|
|
45
|
+
constructor(connection, queryRunner) {
|
|
20
46
|
this.connection = connection;
|
|
21
47
|
this.queryRunner = queryRunner;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
// -------------------------------------------------------------------------
|
|
25
|
-
/**
|
|
26
|
-
* Indicates how migrations should be run in transactions.
|
|
27
|
-
* all: all migrations are run in a single transaction
|
|
28
|
-
* none: all migrations are run without a transaction
|
|
29
|
-
* each: each migration is run in a separate transaction
|
|
30
|
-
*/
|
|
31
|
-
this.transaction = "all";
|
|
32
|
-
var schema = this.connection.driver.options.schema;
|
|
33
|
-
var database = this.connection.driver.database;
|
|
48
|
+
const { schema } = this.connection.driver.options;
|
|
49
|
+
const database = this.connection.driver.database;
|
|
34
50
|
this.migrationsDatabase = database;
|
|
35
51
|
this.migrationsSchema = schema;
|
|
36
52
|
this.migrationsTableName =
|
|
@@ -43,742 +59,467 @@ var MigrationExecutor = /** @class */ (function () {
|
|
|
43
59
|
/**
|
|
44
60
|
* Tries to execute a single migration given.
|
|
45
61
|
*/
|
|
46
|
-
|
|
47
|
-
return
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
schemaBuilder = this.connection.driver.createSchemaBuilder();
|
|
60
|
-
if (!InstanceChecker_1.InstanceChecker.isRdbmsSchemaBuilder(schemaBuilder)) return [3 /*break*/, 3];
|
|
61
|
-
return [4 /*yield*/, schemaBuilder.createMetadataTableIfNecessary(queryRunner)];
|
|
62
|
-
case 2:
|
|
63
|
-
_a.sent();
|
|
64
|
-
_a.label = 3;
|
|
65
|
-
case 3: return [4 /*yield*/, queryRunner.beforeMigration()];
|
|
66
|
-
case 4:
|
|
67
|
-
_a.sent();
|
|
68
|
-
return [4 /*yield*/, migration.instance.up(queryRunner)];
|
|
69
|
-
case 5:
|
|
70
|
-
_a.sent();
|
|
71
|
-
return [4 /*yield*/, queryRunner.afterMigration()];
|
|
72
|
-
case 6:
|
|
73
|
-
_a.sent();
|
|
74
|
-
return [4 /*yield*/, this.insertExecutedMigration(queryRunner, migration)];
|
|
75
|
-
case 7:
|
|
76
|
-
_a.sent();
|
|
77
|
-
return [2 /*return*/, migration];
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
}); })];
|
|
81
|
-
});
|
|
62
|
+
async executeMigration(migration) {
|
|
63
|
+
return this.withQueryRunner(async (queryRunner) => {
|
|
64
|
+
await this.createMigrationsTableIfNotExist(queryRunner);
|
|
65
|
+
// create typeorm_metadata table if it's not created yet
|
|
66
|
+
const schemaBuilder = this.connection.driver.createSchemaBuilder();
|
|
67
|
+
if (InstanceChecker_1.InstanceChecker.isRdbmsSchemaBuilder(schemaBuilder)) {
|
|
68
|
+
await schemaBuilder.createMetadataTableIfNecessary(queryRunner);
|
|
69
|
+
}
|
|
70
|
+
await queryRunner.beforeMigration();
|
|
71
|
+
await migration.instance.up(queryRunner);
|
|
72
|
+
await queryRunner.afterMigration();
|
|
73
|
+
await this.insertExecutedMigration(queryRunner, migration);
|
|
74
|
+
return migration;
|
|
82
75
|
});
|
|
83
|
-
}
|
|
76
|
+
}
|
|
84
77
|
/**
|
|
85
78
|
* Returns an array of all migrations.
|
|
86
79
|
*/
|
|
87
|
-
|
|
88
|
-
return
|
|
89
|
-
|
|
90
|
-
return [2 /*return*/, Promise.resolve(this.getMigrations())];
|
|
91
|
-
});
|
|
92
|
-
});
|
|
93
|
-
};
|
|
80
|
+
async getAllMigrations() {
|
|
81
|
+
return Promise.resolve(this.getMigrations());
|
|
82
|
+
}
|
|
94
83
|
/**
|
|
95
84
|
* Returns an array of all executed migrations.
|
|
96
85
|
*/
|
|
97
|
-
|
|
98
|
-
return
|
|
99
|
-
|
|
100
|
-
return
|
|
101
|
-
return [2 /*return*/, this.withQueryRunner(function (queryRunner) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
102
|
-
return tslib_1.__generator(this, function (_a) {
|
|
103
|
-
switch (_a.label) {
|
|
104
|
-
case 0: return [4 /*yield*/, this.createMigrationsTableIfNotExist(queryRunner)];
|
|
105
|
-
case 1:
|
|
106
|
-
_a.sent();
|
|
107
|
-
return [4 /*yield*/, this.loadExecutedMigrations(queryRunner)];
|
|
108
|
-
case 2: return [2 /*return*/, _a.sent()];
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
}); })];
|
|
112
|
-
});
|
|
86
|
+
async getExecutedMigrations() {
|
|
87
|
+
return this.withQueryRunner(async (queryRunner) => {
|
|
88
|
+
await this.createMigrationsTableIfNotExist(queryRunner);
|
|
89
|
+
return await this.loadExecutedMigrations(queryRunner);
|
|
113
90
|
});
|
|
114
|
-
}
|
|
91
|
+
}
|
|
115
92
|
/**
|
|
116
93
|
* Returns an array of all pending migrations.
|
|
117
94
|
*/
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
case 0: return [4 /*yield*/, this.getAllMigrations()];
|
|
124
|
-
case 1:
|
|
125
|
-
allMigrations = _a.sent();
|
|
126
|
-
return [4 /*yield*/, this.getExecutedMigrations()];
|
|
127
|
-
case 2:
|
|
128
|
-
executedMigrations = _a.sent();
|
|
129
|
-
return [2 /*return*/, allMigrations.filter(function (migration) {
|
|
130
|
-
return !executedMigrations.find(function (executedMigration) {
|
|
131
|
-
return executedMigration.name === migration.name;
|
|
132
|
-
});
|
|
133
|
-
})];
|
|
134
|
-
}
|
|
135
|
-
});
|
|
136
|
-
});
|
|
137
|
-
};
|
|
95
|
+
async getPendingMigrations() {
|
|
96
|
+
const allMigrations = await this.getAllMigrations();
|
|
97
|
+
const executedMigrations = await this.getExecutedMigrations();
|
|
98
|
+
return allMigrations.filter((migration) => !executedMigrations.find((executedMigration) => executedMigration.name === migration.name));
|
|
99
|
+
}
|
|
138
100
|
/**
|
|
139
101
|
* Inserts an executed migration.
|
|
140
102
|
*/
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
return _this.insertExecutedMigration(q, migration);
|
|
145
|
-
});
|
|
146
|
-
};
|
|
103
|
+
insertMigration(migration) {
|
|
104
|
+
return this.withQueryRunner((q) => this.insertExecutedMigration(q, migration));
|
|
105
|
+
}
|
|
147
106
|
/**
|
|
148
107
|
* Deletes an executed migration.
|
|
149
108
|
*/
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
return _this.deleteExecutedMigration(q, migration);
|
|
154
|
-
});
|
|
155
|
-
};
|
|
109
|
+
deleteMigration(migration) {
|
|
110
|
+
return this.withQueryRunner((q) => this.deleteExecutedMigration(q, migration));
|
|
111
|
+
}
|
|
156
112
|
/**
|
|
157
113
|
* Lists all migrations and whether they have been executed or not
|
|
158
114
|
* returns true if there are unapplied migrations
|
|
159
115
|
*/
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
});
|
|
186
|
-
if (executedMigration) {
|
|
187
|
-
this_1.connection.logger.logSchemaBuild("[X] ".concat(migration.name));
|
|
188
|
-
}
|
|
189
|
-
else {
|
|
190
|
-
hasUnappliedMigrations = true;
|
|
191
|
-
this_1.connection.logger.logSchemaBuild("[ ] ".concat(migration.name));
|
|
192
|
-
}
|
|
193
|
-
};
|
|
194
|
-
this_1 = this;
|
|
195
|
-
try {
|
|
196
|
-
for (allMigrations_1 = tslib_1.__values(allMigrations), allMigrations_1_1 = allMigrations_1.next(); !allMigrations_1_1.done; allMigrations_1_1 = allMigrations_1.next()) {
|
|
197
|
-
migration = allMigrations_1_1.value;
|
|
198
|
-
_loop_1(migration);
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
202
|
-
finally {
|
|
203
|
-
try {
|
|
204
|
-
if (allMigrations_1_1 && !allMigrations_1_1.done && (_a = allMigrations_1.return)) _a.call(allMigrations_1);
|
|
205
|
-
}
|
|
206
|
-
finally { if (e_1) throw e_1.error; }
|
|
207
|
-
}
|
|
208
|
-
if (!!this.queryRunner) return [3 /*break*/, 4];
|
|
209
|
-
return [4 /*yield*/, queryRunner.release()];
|
|
210
|
-
case 3:
|
|
211
|
-
_b.sent();
|
|
212
|
-
_b.label = 4;
|
|
213
|
-
case 4: return [2 /*return*/, hasUnappliedMigrations];
|
|
214
|
-
}
|
|
215
|
-
});
|
|
216
|
-
});
|
|
217
|
-
};
|
|
116
|
+
async showMigrations() {
|
|
117
|
+
let hasUnappliedMigrations = false;
|
|
118
|
+
const queryRunner = this.queryRunner || this.connection.createQueryRunner();
|
|
119
|
+
// create migrations table if its not created yet
|
|
120
|
+
await this.createMigrationsTableIfNotExist(queryRunner);
|
|
121
|
+
// get all migrations that are executed and saved in the database
|
|
122
|
+
const executedMigrations = await this.loadExecutedMigrations(queryRunner);
|
|
123
|
+
// get all user's migrations in the source code
|
|
124
|
+
const allMigrations = this.getMigrations();
|
|
125
|
+
for (const migration of allMigrations) {
|
|
126
|
+
const executedMigration = executedMigrations.find((executedMigration) => executedMigration.name === migration.name);
|
|
127
|
+
if (executedMigration) {
|
|
128
|
+
this.connection.logger.logSchemaBuild(`[X] ${migration.name}`);
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
hasUnappliedMigrations = true;
|
|
132
|
+
this.connection.logger.logSchemaBuild(`[ ] ${migration.name}`);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
// if query runner was created by us then release it
|
|
136
|
+
if (!this.queryRunner) {
|
|
137
|
+
await queryRunner.release();
|
|
138
|
+
}
|
|
139
|
+
return hasUnappliedMigrations;
|
|
140
|
+
}
|
|
218
141
|
/**
|
|
219
142
|
* Executes all pending migrations. Pending migrations are migrations that are not yet executed,
|
|
220
143
|
* thus not saved in the database.
|
|
221
144
|
*/
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
allMigrations = this.getMigrations();
|
|
251
|
-
successMigrations = [];
|
|
252
|
-
pendingMigrations = allMigrations.filter(function (migration) {
|
|
253
|
-
// check if we already have executed migration
|
|
254
|
-
var executedMigration = executedMigrations.find(function (executedMigration) {
|
|
255
|
-
return executedMigration.name === migration.name;
|
|
256
|
-
});
|
|
257
|
-
if (executedMigration)
|
|
258
|
-
return false;
|
|
259
|
-
// migration is new and not executed. now check if its timestamp is correct
|
|
260
|
-
// if (lastTimeExecutedMigration && migration.timestamp < lastTimeExecutedMigration.timestamp)
|
|
261
|
-
// throw new TypeORMError(`New migration found: ${migration.name}, however this migration's timestamp is not valid. Migration's timestamp should not be older then migrations already executed in the database.`);
|
|
262
|
-
// every check is passed means that migration was not run yet and we need to run it
|
|
263
|
-
return true;
|
|
264
|
-
});
|
|
265
|
-
if (!!pendingMigrations.length) return [3 /*break*/, 7];
|
|
266
|
-
this.connection.logger.logSchemaBuild("No migrations are pending");
|
|
267
|
-
if (!!this.queryRunner) return [3 /*break*/, 6];
|
|
268
|
-
return [4 /*yield*/, queryRunner.release()];
|
|
269
|
-
case 5:
|
|
270
|
-
_b.sent();
|
|
271
|
-
_b.label = 6;
|
|
272
|
-
case 6: return [2 /*return*/, []];
|
|
273
|
-
case 7:
|
|
274
|
-
// log information about migration execution
|
|
275
|
-
this.connection.logger.logSchemaBuild("".concat(executedMigrations.length, " migrations are already loaded in the database."));
|
|
276
|
-
this.connection.logger.logSchemaBuild("".concat(allMigrations.length, " migrations were found in the source code."));
|
|
277
|
-
if (lastTimeExecutedMigration)
|
|
278
|
-
this.connection.logger.logSchemaBuild("".concat(lastTimeExecutedMigration.name, " is the last executed migration. It was executed on ").concat(new Date(lastTimeExecutedMigration.timestamp).toString(), "."));
|
|
279
|
-
this.connection.logger.logSchemaBuild("".concat(pendingMigrations.length, " migrations are new migrations must be executed."));
|
|
280
|
-
transactionStartedByUs = false;
|
|
281
|
-
if (!(this.transaction === "all" && !queryRunner.isTransactionActive)) return [3 /*break*/, 9];
|
|
282
|
-
return [4 /*yield*/, queryRunner.startTransaction()];
|
|
283
|
-
case 8:
|
|
284
|
-
_b.sent();
|
|
285
|
-
transactionStartedByUs = true;
|
|
286
|
-
_b.label = 9;
|
|
287
|
-
case 9:
|
|
288
|
-
_b.trys.push([9, 20, 25, 28]);
|
|
289
|
-
_loop_2 = function (migration) {
|
|
290
|
-
return tslib_1.__generator(this, function (_c) {
|
|
291
|
-
switch (_c.label) {
|
|
292
|
-
case 0:
|
|
293
|
-
if (!this_2.fake) return [3 /*break*/, 2];
|
|
294
|
-
// directly insert migration record into the database if it is fake
|
|
295
|
-
return [4 /*yield*/, this_2.insertExecutedMigration(queryRunner, migration)
|
|
296
|
-
// nothing else needs to be done, continue to next migration
|
|
297
|
-
];
|
|
298
|
-
case 1:
|
|
299
|
-
// directly insert migration record into the database if it is fake
|
|
300
|
-
_c.sent();
|
|
301
|
-
return [2 /*return*/, "continue"];
|
|
302
|
-
case 2:
|
|
303
|
-
if (!(this_2.transaction === "each" &&
|
|
304
|
-
!queryRunner.isTransactionActive)) return [3 /*break*/, 4];
|
|
305
|
-
return [4 /*yield*/, queryRunner.startTransaction()];
|
|
306
|
-
case 3:
|
|
307
|
-
_c.sent();
|
|
308
|
-
transactionStartedByUs = true;
|
|
309
|
-
_c.label = 4;
|
|
310
|
-
case 4: return [4 /*yield*/, migration
|
|
311
|
-
.instance.up(queryRunner)
|
|
312
|
-
.catch(function (error) {
|
|
313
|
-
// informative log about migration failure
|
|
314
|
-
_this.connection.logger.logMigration("Migration \"".concat(migration.name, "\" failed, error: ").concat(error === null || error === void 0 ? void 0 : error.message));
|
|
315
|
-
throw error;
|
|
316
|
-
})
|
|
317
|
-
.then(function () { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
318
|
-
return tslib_1.__generator(this, function (_a) {
|
|
319
|
-
switch (_a.label) {
|
|
320
|
-
case 0:
|
|
321
|
-
// now when migration is executed we need to insert record about it into the database
|
|
322
|
-
return [4 /*yield*/, this.insertExecutedMigration(queryRunner, migration)
|
|
323
|
-
// commit transaction if we started it
|
|
324
|
-
];
|
|
325
|
-
case 1:
|
|
326
|
-
// now when migration is executed we need to insert record about it into the database
|
|
327
|
-
_a.sent();
|
|
328
|
-
if (!(this.transaction === "each" &&
|
|
329
|
-
transactionStartedByUs)) return [3 /*break*/, 3];
|
|
330
|
-
return [4 /*yield*/, queryRunner.commitTransaction()];
|
|
331
|
-
case 2:
|
|
332
|
-
_a.sent();
|
|
333
|
-
_a.label = 3;
|
|
334
|
-
case 3: return [2 /*return*/];
|
|
335
|
-
}
|
|
336
|
-
});
|
|
337
|
-
}); })
|
|
338
|
-
.then(function () {
|
|
339
|
-
// informative log about migration success
|
|
340
|
-
successMigrations.push(migration);
|
|
341
|
-
_this.connection.logger.logSchemaBuild("Migration ".concat(migration.name, " has been ").concat(_this.fake ? "(fake)" : "", " executed successfully."));
|
|
342
|
-
})];
|
|
343
|
-
case 5:
|
|
344
|
-
_c.sent();
|
|
345
|
-
return [2 /*return*/];
|
|
346
|
-
}
|
|
347
|
-
});
|
|
348
|
-
};
|
|
349
|
-
this_2 = this;
|
|
350
|
-
_b.label = 10;
|
|
351
|
-
case 10:
|
|
352
|
-
_b.trys.push([10, 15, 16, 17]);
|
|
353
|
-
pendingMigrations_1 = tslib_1.__values(pendingMigrations), pendingMigrations_1_1 = pendingMigrations_1.next();
|
|
354
|
-
_b.label = 11;
|
|
355
|
-
case 11:
|
|
356
|
-
if (!!pendingMigrations_1_1.done) return [3 /*break*/, 14];
|
|
357
|
-
migration = pendingMigrations_1_1.value;
|
|
358
|
-
return [5 /*yield**/, _loop_2(migration)];
|
|
359
|
-
case 12:
|
|
360
|
-
_b.sent();
|
|
361
|
-
_b.label = 13;
|
|
362
|
-
case 13:
|
|
363
|
-
pendingMigrations_1_1 = pendingMigrations_1.next();
|
|
364
|
-
return [3 /*break*/, 11];
|
|
365
|
-
case 14: return [3 /*break*/, 17];
|
|
366
|
-
case 15:
|
|
367
|
-
e_2_1 = _b.sent();
|
|
368
|
-
e_2 = { error: e_2_1 };
|
|
369
|
-
return [3 /*break*/, 17];
|
|
370
|
-
case 16:
|
|
371
|
-
try {
|
|
372
|
-
if (pendingMigrations_1_1 && !pendingMigrations_1_1.done && (_a = pendingMigrations_1.return)) _a.call(pendingMigrations_1);
|
|
373
|
-
}
|
|
374
|
-
finally { if (e_2) throw e_2.error; }
|
|
375
|
-
return [7 /*endfinally*/];
|
|
376
|
-
case 17:
|
|
377
|
-
if (!(this.transaction === "all" && transactionStartedByUs)) return [3 /*break*/, 19];
|
|
378
|
-
return [4 /*yield*/, queryRunner.commitTransaction()];
|
|
379
|
-
case 18:
|
|
380
|
-
_b.sent();
|
|
381
|
-
_b.label = 19;
|
|
382
|
-
case 19: return [3 /*break*/, 28];
|
|
383
|
-
case 20:
|
|
384
|
-
err_1 = _b.sent();
|
|
385
|
-
if (!transactionStartedByUs) return [3 /*break*/, 24];
|
|
386
|
-
_b.label = 21;
|
|
387
|
-
case 21:
|
|
388
|
-
_b.trys.push([21, 23, , 24]);
|
|
389
|
-
// we throw original error even if rollback thrown an error
|
|
390
|
-
return [4 /*yield*/, queryRunner.rollbackTransaction()];
|
|
391
|
-
case 22:
|
|
392
|
-
// we throw original error even if rollback thrown an error
|
|
393
|
-
_b.sent();
|
|
394
|
-
return [3 /*break*/, 24];
|
|
395
|
-
case 23:
|
|
396
|
-
rollbackError_1 = _b.sent();
|
|
397
|
-
return [3 /*break*/, 24];
|
|
398
|
-
case 24: throw err_1;
|
|
399
|
-
case 25:
|
|
400
|
-
if (!!this.queryRunner) return [3 /*break*/, 27];
|
|
401
|
-
return [4 /*yield*/, queryRunner.release()];
|
|
402
|
-
case 26:
|
|
403
|
-
_b.sent();
|
|
404
|
-
_b.label = 27;
|
|
405
|
-
case 27: return [7 /*endfinally*/];
|
|
406
|
-
case 28: return [2 /*return*/, successMigrations];
|
|
407
|
-
}
|
|
408
|
-
});
|
|
145
|
+
async executePendingMigrations() {
|
|
146
|
+
const queryRunner = this.queryRunner || this.connection.createQueryRunner();
|
|
147
|
+
// create migrations table if it's not created yet
|
|
148
|
+
await this.createMigrationsTableIfNotExist(queryRunner);
|
|
149
|
+
// create the typeorm_metadata table if it's not created yet
|
|
150
|
+
const schemaBuilder = this.connection.driver.createSchemaBuilder();
|
|
151
|
+
if (InstanceChecker_1.InstanceChecker.isRdbmsSchemaBuilder(schemaBuilder)) {
|
|
152
|
+
await schemaBuilder.createMetadataTableIfNecessary(queryRunner);
|
|
153
|
+
}
|
|
154
|
+
// get all migrations that are executed and saved in the database
|
|
155
|
+
const executedMigrations = await this.loadExecutedMigrations(queryRunner);
|
|
156
|
+
// get the time when last migration was executed
|
|
157
|
+
let lastTimeExecutedMigration = this.getLatestTimestampMigration(executedMigrations);
|
|
158
|
+
// get all user's migrations in the source code
|
|
159
|
+
const allMigrations = this.getMigrations();
|
|
160
|
+
// variable to store all migrations we did successfully
|
|
161
|
+
const successMigrations = [];
|
|
162
|
+
// find all migrations that needs to be executed
|
|
163
|
+
const pendingMigrations = allMigrations.filter((migration) => {
|
|
164
|
+
// check if we already have executed migration
|
|
165
|
+
const executedMigration = executedMigrations.find((executedMigration) => executedMigration.name === migration.name);
|
|
166
|
+
if (executedMigration)
|
|
167
|
+
return false;
|
|
168
|
+
// migration is new and not executed. now check if its timestamp is correct
|
|
169
|
+
// if (lastTimeExecutedMigration && migration.timestamp < lastTimeExecutedMigration.timestamp)
|
|
170
|
+
// throw new TypeORMError(`New migration found: ${migration.name}, however this migration's timestamp is not valid. Migration's timestamp should not be older then migrations already executed in the database.`);
|
|
171
|
+
// every check is passed means that migration was not run yet and we need to run it
|
|
172
|
+
return true;
|
|
409
173
|
});
|
|
410
|
-
|
|
174
|
+
// if no migrations are pending then nothing to do here
|
|
175
|
+
if (!pendingMigrations.length) {
|
|
176
|
+
this.connection.logger.logSchemaBuild(`No migrations are pending`);
|
|
177
|
+
// if query runner was created by us then release it
|
|
178
|
+
if (!this.queryRunner)
|
|
179
|
+
await queryRunner.release();
|
|
180
|
+
return [];
|
|
181
|
+
}
|
|
182
|
+
// log information about migration execution
|
|
183
|
+
this.connection.logger.logSchemaBuild(`${executedMigrations.length} migrations are already loaded in the database.`);
|
|
184
|
+
this.connection.logger.logSchemaBuild(`${allMigrations.length} migrations were found in the source code.`);
|
|
185
|
+
if (lastTimeExecutedMigration)
|
|
186
|
+
this.connection.logger.logSchemaBuild(`${lastTimeExecutedMigration.name} is the last executed migration. It was executed on ${new Date(lastTimeExecutedMigration.timestamp).toString()}.`);
|
|
187
|
+
this.connection.logger.logSchemaBuild(`${pendingMigrations.length} migrations are new migrations must be executed.`);
|
|
188
|
+
// start transaction if its not started yet
|
|
189
|
+
let transactionStartedByUs = false;
|
|
190
|
+
if (this.transaction === "all" && !queryRunner.isTransactionActive) {
|
|
191
|
+
await queryRunner.startTransaction();
|
|
192
|
+
transactionStartedByUs = true;
|
|
193
|
+
}
|
|
194
|
+
// run all pending migrations in a sequence
|
|
195
|
+
try {
|
|
196
|
+
for (const migration of pendingMigrations) {
|
|
197
|
+
if (this.fake) {
|
|
198
|
+
// directly insert migration record into the database if it is fake
|
|
199
|
+
await this.insertExecutedMigration(queryRunner, migration);
|
|
200
|
+
// nothing else needs to be done, continue to next migration
|
|
201
|
+
continue;
|
|
202
|
+
}
|
|
203
|
+
if (this.transaction === "each" &&
|
|
204
|
+
!queryRunner.isTransactionActive) {
|
|
205
|
+
await queryRunner.startTransaction();
|
|
206
|
+
transactionStartedByUs = true;
|
|
207
|
+
}
|
|
208
|
+
await migration
|
|
209
|
+
.instance.up(queryRunner)
|
|
210
|
+
.catch((error) => {
|
|
211
|
+
// informative log about migration failure
|
|
212
|
+
this.connection.logger.logMigration(`Migration "${migration.name}" failed, error: ${error?.message}`);
|
|
213
|
+
throw error;
|
|
214
|
+
})
|
|
215
|
+
.then(async () => {
|
|
216
|
+
// now when migration is executed we need to insert record about it into the database
|
|
217
|
+
await this.insertExecutedMigration(queryRunner, migration);
|
|
218
|
+
// commit transaction if we started it
|
|
219
|
+
if (this.transaction === "each" &&
|
|
220
|
+
transactionStartedByUs)
|
|
221
|
+
await queryRunner.commitTransaction();
|
|
222
|
+
})
|
|
223
|
+
.then(() => {
|
|
224
|
+
// informative log about migration success
|
|
225
|
+
successMigrations.push(migration);
|
|
226
|
+
this.connection.logger.logSchemaBuild(`Migration ${migration.name} has been ${this.fake ? "(fake)" : ""} executed successfully.`);
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
// commit transaction if we started it
|
|
230
|
+
if (this.transaction === "all" && transactionStartedByUs)
|
|
231
|
+
await queryRunner.commitTransaction();
|
|
232
|
+
}
|
|
233
|
+
catch (err) {
|
|
234
|
+
// rollback transaction if we started it
|
|
235
|
+
if (transactionStartedByUs) {
|
|
236
|
+
try {
|
|
237
|
+
// we throw original error even if rollback thrown an error
|
|
238
|
+
await queryRunner.rollbackTransaction();
|
|
239
|
+
}
|
|
240
|
+
catch (rollbackError) { }
|
|
241
|
+
}
|
|
242
|
+
throw err;
|
|
243
|
+
}
|
|
244
|
+
finally {
|
|
245
|
+
// if query runner was created by us then release it
|
|
246
|
+
if (!this.queryRunner)
|
|
247
|
+
await queryRunner.release();
|
|
248
|
+
}
|
|
249
|
+
return successMigrations;
|
|
250
|
+
}
|
|
411
251
|
/**
|
|
412
252
|
* Reverts last migration that were run.
|
|
413
253
|
*/
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
return [4 /*yield*/, migrationToRevert.instance.down(queryRunner)];
|
|
468
|
-
case 8:
|
|
469
|
-
_a.sent();
|
|
470
|
-
return [4 /*yield*/, queryRunner.afterMigration()];
|
|
471
|
-
case 9:
|
|
472
|
-
_a.sent();
|
|
473
|
-
_a.label = 10;
|
|
474
|
-
case 10: return [4 /*yield*/, this.deleteExecutedMigration(queryRunner, migrationToRevert)];
|
|
475
|
-
case 11:
|
|
476
|
-
_a.sent();
|
|
477
|
-
this.connection.logger.logSchemaBuild("Migration ".concat(migrationToRevert.name, " has been ").concat(this.fake ? "(fake)" : "", " reverted successfully."));
|
|
478
|
-
if (!transactionStartedByUs) return [3 /*break*/, 13];
|
|
479
|
-
return [4 /*yield*/, queryRunner.commitTransaction()];
|
|
480
|
-
case 12:
|
|
481
|
-
_a.sent();
|
|
482
|
-
_a.label = 13;
|
|
483
|
-
case 13: return [3 /*break*/, 22];
|
|
484
|
-
case 14:
|
|
485
|
-
err_2 = _a.sent();
|
|
486
|
-
if (!transactionStartedByUs) return [3 /*break*/, 18];
|
|
487
|
-
_a.label = 15;
|
|
488
|
-
case 15:
|
|
489
|
-
_a.trys.push([15, 17, , 18]);
|
|
490
|
-
// we throw original error even if rollback thrown an error
|
|
491
|
-
return [4 /*yield*/, queryRunner.rollbackTransaction()];
|
|
492
|
-
case 16:
|
|
493
|
-
// we throw original error even if rollback thrown an error
|
|
494
|
-
_a.sent();
|
|
495
|
-
return [3 /*break*/, 18];
|
|
496
|
-
case 17:
|
|
497
|
-
rollbackError_2 = _a.sent();
|
|
498
|
-
return [3 /*break*/, 18];
|
|
499
|
-
case 18: throw err_2;
|
|
500
|
-
case 19:
|
|
501
|
-
if (!!this.queryRunner) return [3 /*break*/, 21];
|
|
502
|
-
return [4 /*yield*/, queryRunner.release()];
|
|
503
|
-
case 20:
|
|
504
|
-
_a.sent();
|
|
505
|
-
_a.label = 21;
|
|
506
|
-
case 21: return [7 /*endfinally*/];
|
|
507
|
-
case 22: return [2 /*return*/];
|
|
254
|
+
async undoLastMigration() {
|
|
255
|
+
const queryRunner = this.queryRunner || this.connection.createQueryRunner();
|
|
256
|
+
// create migrations table if it's not created yet
|
|
257
|
+
await this.createMigrationsTableIfNotExist(queryRunner);
|
|
258
|
+
// create typeorm_metadata table if it's not created yet
|
|
259
|
+
const schemaBuilder = this.connection.driver.createSchemaBuilder();
|
|
260
|
+
if (InstanceChecker_1.InstanceChecker.isRdbmsSchemaBuilder(schemaBuilder)) {
|
|
261
|
+
await schemaBuilder.createMetadataTableIfNecessary(queryRunner);
|
|
262
|
+
}
|
|
263
|
+
// get all migrations that are executed and saved in the database
|
|
264
|
+
const executedMigrations = await this.loadExecutedMigrations(queryRunner);
|
|
265
|
+
// get the time when last migration was executed
|
|
266
|
+
let lastTimeExecutedMigration = this.getLatestExecutedMigration(executedMigrations);
|
|
267
|
+
// if no migrations found in the database then nothing to revert
|
|
268
|
+
if (!lastTimeExecutedMigration) {
|
|
269
|
+
this.connection.logger.logSchemaBuild(`No migrations was found in the database. Nothing to revert!`);
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
// get all user's migrations in the source code
|
|
273
|
+
const allMigrations = this.getMigrations();
|
|
274
|
+
// find the instance of the migration we need to remove
|
|
275
|
+
const migrationToRevert = allMigrations.find((migration) => migration.name === lastTimeExecutedMigration.name);
|
|
276
|
+
// if no migrations found in the database then nothing to revert
|
|
277
|
+
if (!migrationToRevert)
|
|
278
|
+
throw new error_1.TypeORMError(`No migration ${lastTimeExecutedMigration.name} was found in the source code. Make sure you have this migration in your codebase and its included in the connection options.`);
|
|
279
|
+
// log information about migration execution
|
|
280
|
+
this.connection.logger.logSchemaBuild(`${executedMigrations.length} migrations are already loaded in the database.`);
|
|
281
|
+
this.connection.logger.logSchemaBuild(`${lastTimeExecutedMigration.name} is the last executed migration. It was executed on ${new Date(lastTimeExecutedMigration.timestamp).toString()}.`);
|
|
282
|
+
this.connection.logger.logSchemaBuild(`Now reverting it...`);
|
|
283
|
+
// start transaction if its not started yet
|
|
284
|
+
let transactionStartedByUs = false;
|
|
285
|
+
if (this.transaction !== "none" && !queryRunner.isTransactionActive) {
|
|
286
|
+
await queryRunner.startTransaction();
|
|
287
|
+
transactionStartedByUs = true;
|
|
288
|
+
}
|
|
289
|
+
try {
|
|
290
|
+
if (!this.fake) {
|
|
291
|
+
await queryRunner.beforeMigration();
|
|
292
|
+
await migrationToRevert.instance.down(queryRunner);
|
|
293
|
+
await queryRunner.afterMigration();
|
|
294
|
+
}
|
|
295
|
+
await this.deleteExecutedMigration(queryRunner, migrationToRevert);
|
|
296
|
+
this.connection.logger.logSchemaBuild(`Migration ${migrationToRevert.name} has been ${this.fake ? "(fake)" : ""} reverted successfully.`);
|
|
297
|
+
// commit transaction if we started it
|
|
298
|
+
if (transactionStartedByUs)
|
|
299
|
+
await queryRunner.commitTransaction();
|
|
300
|
+
}
|
|
301
|
+
catch (err) {
|
|
302
|
+
// rollback transaction if we started it
|
|
303
|
+
if (transactionStartedByUs) {
|
|
304
|
+
try {
|
|
305
|
+
// we throw original error even if rollback thrown an error
|
|
306
|
+
await queryRunner.rollbackTransaction();
|
|
508
307
|
}
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
308
|
+
catch (rollbackError) { }
|
|
309
|
+
}
|
|
310
|
+
throw err;
|
|
311
|
+
}
|
|
312
|
+
finally {
|
|
313
|
+
// if query runner was created by us then release it
|
|
314
|
+
if (!this.queryRunner)
|
|
315
|
+
await queryRunner.release();
|
|
316
|
+
}
|
|
317
|
+
}
|
|
512
318
|
// -------------------------------------------------------------------------
|
|
513
319
|
// Protected Methods
|
|
514
320
|
// -------------------------------------------------------------------------
|
|
515
321
|
/**
|
|
516
322
|
* Creates table "migrations" that will store information about executed migrations.
|
|
517
323
|
*/
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
return
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
.migrationName,
|
|
563
|
-
}),
|
|
564
|
-
isNullable: false,
|
|
565
|
-
},
|
|
566
|
-
],
|
|
567
|
-
}))];
|
|
568
|
-
case 2:
|
|
569
|
-
_a.sent();
|
|
570
|
-
_a.label = 3;
|
|
571
|
-
case 3: return [2 /*return*/];
|
|
572
|
-
}
|
|
573
|
-
});
|
|
574
|
-
});
|
|
575
|
-
};
|
|
324
|
+
async createMigrationsTableIfNotExist(queryRunner) {
|
|
325
|
+
// If driver is mongo no need to create
|
|
326
|
+
if (this.connection.driver.options.type === "mongodb") {
|
|
327
|
+
return;
|
|
328
|
+
}
|
|
329
|
+
const tableExist = await queryRunner.hasTable(this.migrationsTable); // todo: table name should be configurable
|
|
330
|
+
if (!tableExist) {
|
|
331
|
+
await queryRunner.createTable(new Table_1.Table({
|
|
332
|
+
database: this.migrationsDatabase,
|
|
333
|
+
schema: this.migrationsSchema,
|
|
334
|
+
name: this.migrationsTable,
|
|
335
|
+
columns: [
|
|
336
|
+
{
|
|
337
|
+
name: "id",
|
|
338
|
+
type: this.connection.driver.normalizeType({
|
|
339
|
+
type: this.connection.driver.mappedDataTypes
|
|
340
|
+
.migrationId,
|
|
341
|
+
}),
|
|
342
|
+
isGenerated: true,
|
|
343
|
+
generationStrategy: "increment",
|
|
344
|
+
isPrimary: true,
|
|
345
|
+
isNullable: false,
|
|
346
|
+
},
|
|
347
|
+
{
|
|
348
|
+
name: "timestamp",
|
|
349
|
+
type: this.connection.driver.normalizeType({
|
|
350
|
+
type: this.connection.driver.mappedDataTypes
|
|
351
|
+
.migrationTimestamp,
|
|
352
|
+
}),
|
|
353
|
+
isPrimary: false,
|
|
354
|
+
isNullable: false,
|
|
355
|
+
},
|
|
356
|
+
{
|
|
357
|
+
name: "name",
|
|
358
|
+
type: this.connection.driver.normalizeType({
|
|
359
|
+
type: this.connection.driver.mappedDataTypes
|
|
360
|
+
.migrationName,
|
|
361
|
+
}),
|
|
362
|
+
isNullable: false,
|
|
363
|
+
},
|
|
364
|
+
],
|
|
365
|
+
}));
|
|
366
|
+
}
|
|
367
|
+
}
|
|
576
368
|
/**
|
|
577
369
|
* Loads all migrations that were executed and saved into the database (sorts by id).
|
|
578
370
|
*/
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
.select()
|
|
601
|
-
.orderBy(this.connection.driver.escape("id"), "DESC")
|
|
602
|
-
.from(this.migrationsTable, this.migrationsTableName)
|
|
603
|
-
.getRawMany()];
|
|
604
|
-
case 3:
|
|
605
|
-
migrationsRaw = _a.sent();
|
|
606
|
-
return [2 /*return*/, migrationsRaw.map(function (migrationRaw) {
|
|
607
|
-
return new Migration_1.Migration(parseInt(migrationRaw["id"]), parseInt(migrationRaw["timestamp"]), migrationRaw["name"]);
|
|
608
|
-
})];
|
|
609
|
-
}
|
|
371
|
+
async loadExecutedMigrations(queryRunner) {
|
|
372
|
+
if (this.connection.driver.options.type === "mongodb") {
|
|
373
|
+
//#region @backendFunc
|
|
374
|
+
const mongoRunner = queryRunner;
|
|
375
|
+
return await mongoRunner.databaseConnection
|
|
376
|
+
.db(this.connection.driver.database)
|
|
377
|
+
.collection(this.migrationsTableName)
|
|
378
|
+
.find()
|
|
379
|
+
.sort({ _id: -1 })
|
|
380
|
+
.toArray();
|
|
381
|
+
//#endregion
|
|
382
|
+
}
|
|
383
|
+
else {
|
|
384
|
+
const migrationsRaw = await this.connection.manager
|
|
385
|
+
.createQueryBuilder(queryRunner)
|
|
386
|
+
.select()
|
|
387
|
+
.orderBy(this.connection.driver.escape("id"), "DESC")
|
|
388
|
+
.from(this.migrationsTable, this.migrationsTableName)
|
|
389
|
+
.getRawMany();
|
|
390
|
+
return migrationsRaw.map((migrationRaw) => {
|
|
391
|
+
return new Migration_1.Migration(parseInt(migrationRaw["id"]), parseInt(migrationRaw["timestamp"]), migrationRaw["name"]);
|
|
610
392
|
});
|
|
611
|
-
}
|
|
612
|
-
}
|
|
393
|
+
}
|
|
394
|
+
}
|
|
613
395
|
/**
|
|
614
396
|
* Gets all migrations that setup for this connection.
|
|
615
397
|
*/
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
398
|
+
getMigrations() {
|
|
399
|
+
const migrations = this.connection.migrations.map((migration) => {
|
|
400
|
+
const migrationClassName = migration.name || migration.constructor.name;
|
|
401
|
+
const migrationTimestamp = parseInt(migrationClassName.substr(-13), 10);
|
|
620
402
|
if (!migrationTimestamp || isNaN(migrationTimestamp)) {
|
|
621
|
-
throw new error_1.TypeORMError(
|
|
403
|
+
throw new error_1.TypeORMError(`${migrationClassName} migration name is wrong. Migration class name should have a JavaScript timestamp appended.`);
|
|
622
404
|
}
|
|
623
405
|
return new Migration_1.Migration(undefined, migrationTimestamp, migrationClassName, migration);
|
|
624
406
|
});
|
|
625
407
|
this.checkForDuplicateMigrations(migrations);
|
|
626
408
|
// sort them by timestamp
|
|
627
|
-
return migrations.sort(
|
|
628
|
-
}
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
return migrationNames.indexOf(migrationName) < index;
|
|
633
|
-
})));
|
|
409
|
+
return migrations.sort((a, b) => a.timestamp - b.timestamp);
|
|
410
|
+
}
|
|
411
|
+
checkForDuplicateMigrations(migrations) {
|
|
412
|
+
const migrationNames = migrations.map((migration) => migration.name);
|
|
413
|
+
const duplicates = Array.from(new Set(migrationNames.filter((migrationName, index) => migrationNames.indexOf(migrationName) < index)));
|
|
634
414
|
if (duplicates.length > 0) {
|
|
635
|
-
throw Error(
|
|
415
|
+
throw Error(`Duplicate migrations: ${duplicates.join(", ")}`);
|
|
636
416
|
}
|
|
637
|
-
}
|
|
417
|
+
}
|
|
638
418
|
/**
|
|
639
419
|
* Finds the latest migration (sorts by timestamp) in the given array of migrations.
|
|
640
420
|
*/
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
.map(
|
|
644
|
-
.sort(
|
|
421
|
+
getLatestTimestampMigration(migrations) {
|
|
422
|
+
const sortedMigrations = migrations
|
|
423
|
+
.map((migration) => migration)
|
|
424
|
+
.sort((a, b) => (a.timestamp - b.timestamp) * -1);
|
|
645
425
|
return sortedMigrations.length > 0 ? sortedMigrations[0] : undefined;
|
|
646
|
-
}
|
|
426
|
+
}
|
|
647
427
|
/**
|
|
648
428
|
* Finds the latest migration in the given array of migrations.
|
|
649
429
|
* PRE: Migration array must be sorted by descending id.
|
|
650
430
|
*/
|
|
651
|
-
|
|
431
|
+
getLatestExecutedMigration(sortedMigrations) {
|
|
652
432
|
return sortedMigrations.length > 0 ? sortedMigrations[0] : undefined;
|
|
653
|
-
}
|
|
433
|
+
}
|
|
654
434
|
/**
|
|
655
435
|
* Inserts new executed migration's data into migrations table.
|
|
656
436
|
*/
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
return [4 /*yield*/, qb
|
|
693
|
-
.insert()
|
|
694
|
-
.into(this.migrationsTable)
|
|
695
|
-
.values(values)
|
|
696
|
-
.execute()];
|
|
697
|
-
case 3:
|
|
698
|
-
_a.sent();
|
|
699
|
-
_a.label = 4;
|
|
700
|
-
case 4: return [2 /*return*/];
|
|
701
|
-
}
|
|
702
|
-
});
|
|
703
|
-
});
|
|
704
|
-
};
|
|
437
|
+
async insertExecutedMigration(queryRunner, migration) {
|
|
438
|
+
const values = {};
|
|
439
|
+
if (this.connection.driver.options.type === "mssql") {
|
|
440
|
+
//#region @backend
|
|
441
|
+
values["timestamp"] = new MssqlParameter_1.MssqlParameter(migration.timestamp, this.connection.driver.normalizeType({
|
|
442
|
+
type: this.connection.driver.mappedDataTypes
|
|
443
|
+
.migrationTimestamp,
|
|
444
|
+
}));
|
|
445
|
+
values["name"] = new MssqlParameter_1.MssqlParameter(migration.name, this.connection.driver.normalizeType({
|
|
446
|
+
type: this.connection.driver.mappedDataTypes.migrationName,
|
|
447
|
+
}));
|
|
448
|
+
//#endregion
|
|
449
|
+
}
|
|
450
|
+
else {
|
|
451
|
+
values["timestamp"] = migration.timestamp;
|
|
452
|
+
values["name"] = migration.name;
|
|
453
|
+
}
|
|
454
|
+
if (this.connection.driver.options.type === "mongodb") {
|
|
455
|
+
//#region @backend
|
|
456
|
+
const mongoRunner = queryRunner;
|
|
457
|
+
await mongoRunner.databaseConnection
|
|
458
|
+
.db(this.connection.driver.database)
|
|
459
|
+
.collection(this.migrationsTableName)
|
|
460
|
+
.insertOne(values);
|
|
461
|
+
//#endregion
|
|
462
|
+
}
|
|
463
|
+
else {
|
|
464
|
+
const qb = queryRunner.manager.createQueryBuilder();
|
|
465
|
+
await qb
|
|
466
|
+
.insert()
|
|
467
|
+
.into(this.migrationsTable)
|
|
468
|
+
.values(values)
|
|
469
|
+
.execute();
|
|
470
|
+
}
|
|
471
|
+
}
|
|
705
472
|
/**
|
|
706
473
|
* Delete previously executed migration's data from the migrations table.
|
|
707
474
|
*/
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
};
|
|
758
|
-
MigrationExecutor.prototype.withQueryRunner = function (callback) {
|
|
759
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
760
|
-
var queryRunner;
|
|
761
|
-
return tslib_1.__generator(this, function (_a) {
|
|
762
|
-
switch (_a.label) {
|
|
763
|
-
case 0:
|
|
764
|
-
queryRunner = this.queryRunner || this.connection.createQueryRunner();
|
|
765
|
-
_a.label = 1;
|
|
766
|
-
case 1:
|
|
767
|
-
_a.trys.push([1, , 2, 5]);
|
|
768
|
-
return [2 /*return*/, callback(queryRunner)];
|
|
769
|
-
case 2:
|
|
770
|
-
if (!!this.queryRunner) return [3 /*break*/, 4];
|
|
771
|
-
return [4 /*yield*/, queryRunner.release()];
|
|
772
|
-
case 3:
|
|
773
|
-
_a.sent();
|
|
774
|
-
_a.label = 4;
|
|
775
|
-
case 4: return [7 /*endfinally*/];
|
|
776
|
-
case 5: return [2 /*return*/];
|
|
777
|
-
}
|
|
778
|
-
});
|
|
779
|
-
});
|
|
780
|
-
};
|
|
781
|
-
return MigrationExecutor;
|
|
782
|
-
}());
|
|
475
|
+
async deleteExecutedMigration(queryRunner, migration) {
|
|
476
|
+
const conditions = {};
|
|
477
|
+
if (this.connection.driver.options.type === "mssql") {
|
|
478
|
+
//#region @backend
|
|
479
|
+
conditions["timestamp"] = new MssqlParameter_1.MssqlParameter(migration.timestamp, this.connection.driver.normalizeType({
|
|
480
|
+
type: this.connection.driver.mappedDataTypes
|
|
481
|
+
.migrationTimestamp,
|
|
482
|
+
}));
|
|
483
|
+
conditions["name"] = new MssqlParameter_1.MssqlParameter(migration.name, this.connection.driver.normalizeType({
|
|
484
|
+
type: this.connection.driver.mappedDataTypes.migrationName,
|
|
485
|
+
}));
|
|
486
|
+
//#endregion
|
|
487
|
+
}
|
|
488
|
+
else {
|
|
489
|
+
conditions["timestamp"] = migration.timestamp;
|
|
490
|
+
conditions["name"] = migration.name;
|
|
491
|
+
}
|
|
492
|
+
if (this.connection.driver.options.type === "mongodb") {
|
|
493
|
+
//#region @backend
|
|
494
|
+
const mongoRunner = queryRunner;
|
|
495
|
+
await mongoRunner.databaseConnection
|
|
496
|
+
.db(this.connection.driver.database)
|
|
497
|
+
.collection(this.migrationsTableName)
|
|
498
|
+
.deleteOne(conditions);
|
|
499
|
+
//#endregion
|
|
500
|
+
}
|
|
501
|
+
else {
|
|
502
|
+
const qb = queryRunner.manager.createQueryBuilder();
|
|
503
|
+
await qb
|
|
504
|
+
.delete()
|
|
505
|
+
.from(this.migrationsTable)
|
|
506
|
+
.where(`${qb.escape("timestamp")} = :timestamp`)
|
|
507
|
+
.andWhere(`${qb.escape("name")} = :name`)
|
|
508
|
+
.setParameters(conditions)
|
|
509
|
+
.execute();
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
async withQueryRunner(callback) {
|
|
513
|
+
const queryRunner = this.queryRunner || this.connection.createQueryRunner();
|
|
514
|
+
try {
|
|
515
|
+
return callback(queryRunner);
|
|
516
|
+
}
|
|
517
|
+
finally {
|
|
518
|
+
if (!this.queryRunner) {
|
|
519
|
+
await queryRunner.release();
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
}
|
|
783
524
|
exports.MigrationExecutor = MigrationExecutor;
|
|
784
525
|
//# sourceMappingURL=MigrationExecutor.js.map
|