()
| 249 | |
| 250 | const context: MigrationContext = { |
| 251 | async auto() { |
| 252 | let generated: MigrationOperation[]; |
| 253 | |
| 254 | if (mode === "from-schema") { |
| 255 | generated = generateMigrationFromSchema( |
| 256 | currentSchema, |
| 257 | targetSchema, |
| 258 | userConfig |
| 259 | ); |
| 260 | } else { |
| 261 | if (!generateMigrationFromDatabase) |
| 262 | throw new Error(`${mode} is not supported for this adapter.`); |
| 263 | |
| 264 | generated = await generateMigrationFromDatabase({ |
| 265 | target: targetSchema, |
| 266 | dropUnusedColumns: unsafe, |
| 267 | }); |
| 268 | } |
| 269 | |
| 270 | for (const transformer of transformers) { |
| 271 | if (!transformer.afterAuto) continue; |
| 272 | |
| 273 | generated = transformer.afterAuto(generated, { |
| 274 | prev: currentSchema, |
| 275 | next: targetSchema, |
| 276 | options, |
| 277 | }); |
| 278 | } |
| 279 | |
| 280 | return generated; |
| 281 | }, |
| 282 | }; |
| 283 | |
| 284 | let operations = await run(context); |
nothing calls this directly
no test coverage detected