phpmig icon indicating copy to clipboard operation
phpmig copied to clipboard

Can I rollback last migration?

Open IftekherSunny opened this issue 10 years ago • 4 comments

I tried using down() method with version number but it's not work! I changed PhpmigApplication.php file

from

// down
} elseif ($to < $from && $version > $to && $version <= $from) {
   $migrations[] = $path;
}

to

// down
} elseif ($to <= $from && $version => $to && $version <= $from) {
   $migrations[] = $path;
}

Then, I call down() method with version number it's rollback last migration. Anyone here who can help me??

IftekherSunny avatar Dec 03 '15 12:12 IftekherSunny

phpmig rollback

davedevelopment avatar Dec 03 '15 12:12 davedevelopment

@davedevelopment thanks brother. But, I want to use API php mig application method from my custom console command. Can you give me some suggestion?

IftekherSunny avatar Dec 03 '15 12:12 IftekherSunny

Not sure in that case I'm afraid, been a while since I dug around in this codebase. Perhaps just try looking in the RollbackCommand https://github.com/davedevelopment/phpmig/blob/c55d2f803d1242ce08742aa61e1b410802a00932/src/Phpmig/Console/Command/RollbackCommand.php ?

davedevelopment avatar Dec 03 '15 14:12 davedevelopment

OK @davedevelopment I'll check it. And many many thanks for your nice project

IftekherSunny avatar Dec 03 '15 14:12 IftekherSunny