File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -40,17 +40,20 @@ export async function _uncommit(parsedSettings: ParsedSettings): Promise<void> {
4040 // Restore current.sql from migration
4141 const lastMigrationFilepath = lastMigration . fullPath ;
4242 const contents = await fsp . readFile ( lastMigrationFilepath , "utf8" ) ;
43- const { headers, body } = parseMigrationText ( lastMigrationFilepath , contents ) ;
43+ const { headers, body : committedBody } = parseMigrationText (
44+ lastMigrationFilepath ,
45+ contents ,
46+ ) ;
4447
4548 // Replace included migrations with their `--!include` equivalent
46- const decompiledBody = body . replace (
49+ const body = committedBody . replace (
4750 / ^ - - ! I n c l u d e d (?< filename > \S + ) $ [ \s \S ] * ?^ - - ! E n d I n c l u d e d \k<filename > $ / gm,
4851 ( _ , filename ) => `--!include ${ filename } ` ,
4952 ) ;
5053
5154 // Drop Hash, Previous and AllowInvalidHash from headers; then write out
5255 const { Hash, Previous, AllowInvalidHash, ...otherHeaders } = headers ;
53- const completeBody = serializeMigration ( decompiledBody , otherHeaders ) ;
56+ const completeBody = serializeMigration ( body , otherHeaders ) ;
5457 await writeCurrentMigration ( parsedSettings , currentLocation , completeBody ) ;
5558
5659 // Delete the migration from committed and from the DB
You can’t perform that action at this time.
0 commit comments