Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

4.x: fix rollback not working with a simple change migration #820

Merged
merged 1 commit into from
Mar 8, 2025

Conversation

LordSimal
Copy link
Contributor

@LordSimal LordSimal commented Mar 7, 2025

Do you want an adapter? I can get you an adpater for your adapater to adapter your adapter to another adaptor.

It seems we have adaptered too hard here....


As the title says trying to rollback a simple

        $this->table('test')
            ->addColumn('othername', 'string')
            ->save();

cause the following error

 == 20250307170352 Test2: reverting 
SQLSTATE[HY000]: General error: 1 duplicate column name: othername
Query: CREATE TABLE "tmp_test" ("id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, "name" VARCHAR NOT NULL, "othername" VARCHAR NOT NULL, "othername" VARCHAR NOT NULL);

since it didn't actually prevent the migrations from executing again (to rollback the actions accordingly)

This ONLY was the case, when using the built-in backend and tried to rollback a new migration with the new base class \Migrations\BaseMigration.

@LordSimal LordSimal added the bug label Mar 7, 2025
@LordSimal LordSimal added this to the 4.x (CakePHP 5) milestone Mar 7, 2025
@LordSimal LordSimal force-pushed the 4.x-fix-rollback branch 2 times, most recently from 31fa276 to 73d57b4 Compare March 7, 2025 18:16
@dereuromark dereuromark merged commit 89ca216 into 4.x Mar 8, 2025
20 checks passed
@dereuromark dereuromark deleted the 4.x-fix-rollback branch March 8, 2025 15:49
@markstory
Copy link
Member

Thanks for fixing this. ❤️ The adapter mess is something I'm hoping to clean up incrementally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants