MCPcopy
hub / github.com/drizzle-team/drizzle-orm / prepareAndExportMysql

Function prepareAndExportMysql

drizzle-kit/src/cli/commands/migrate.ts:770–800  ·  view source on GitHub ↗
(config: ExportConfig)

Source from the content-addressed store, hash-verified

768};
769
770export 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
802export const prepareAndMigrateSqlite = async (config: GenerateConfig) => {
803 const outFolder = config.out;

Callers 1

schema.tsFile · 0.85

Calls 3

squashMysqlSchemeFunction · 0.90
applyMysqlSnapshotsDiffFunction · 0.90

Tested by

no test coverage detected