| 72 | } |
| 73 | |
| 74 | static async create( |
| 75 | sequelize: Sequelize, |
| 76 | storeService: StoreService, |
| 77 | schemaName: string, |
| 78 | config: NodeConfig |
| 79 | ): Promise<Migration> { |
| 80 | const existingForeignKeys = await syncHelper.getExistingForeignKeys(schemaName, sequelize); |
| 81 | const enumTypeMap = await syncHelper.getExistingEnums(schemaName, sequelize); |
| 82 | const indexesResult = (await sequelize.query(syncHelper.getExistedIndexesQuery(schemaName), { |
| 83 | type: QueryTypes.SELECT, |
| 84 | })) as { |
| 85 | indexname: string; |
| 86 | }[]; |
| 87 | return new Migration(sequelize, storeService, schemaName, config, existingForeignKeys, enumTypeMap, indexesResult); |
| 88 | } |
| 89 | |
| 90 | async run(transaction: Transaction): Promise<ModifiedDbModels> { |
| 91 | if (this.historical) { |