(config: ExportConfig)
| 768 | }; |
| 769 | |
| 770 | export const prepareAndExportMysql = async (config: ExportConfig) => { |
| 771 | const schemaPath = config.schema; |
| 772 | |
| 773 | try { |
| 774 | const { prev, cur, custom } = await prepareMySqlMigrationSnapshot( |
| 775 | [], |
| 776 | schemaPath, |
| 777 | undefined, |
| 778 | ); |
| 779 | |
| 780 | const validatedPrev = mysqlSchema.parse(prev); |
| 781 | const validatedCur = mysqlSchema.parse(cur); |
| 782 | |
| 783 | const squashedPrev = squashMysqlScheme(validatedPrev); |
| 784 | const squashedCur = squashMysqlScheme(validatedCur); |
| 785 | |
| 786 | const { sqlStatements, statements, _meta } = await applyMysqlSnapshotsDiff( |
| 787 | squashedPrev, |
| 788 | squashedCur, |
| 789 | tablesResolver, |
| 790 | columnsResolver, |
| 791 | mySqlViewsResolver, |
| 792 | validatedPrev, |
| 793 | validatedCur, |
| 794 | ); |
| 795 | |
| 796 | console.log(sqlStatements.join('\n')); |
| 797 | } catch (e) { |
| 798 | console.error(e); |
| 799 | } |
| 800 | }; |
| 801 | |
| 802 | export const prepareAndMigrateSqlite = async (config: GenerateConfig) => { |
| 803 | const outFolder = config.out; |
no test coverage detected