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

[7.x] Added renameColumn() enum support #32205

Merged
merged 3 commits into from
Apr 6, 2020
Merged

[7.x] Added renameColumn() enum support #32205

merged 3 commits into from
Apr 6, 2020

Conversation

nuernbergerA
Copy link
Contributor

@nuernbergerA nuernbergerA commented Apr 3, 2020

This PR adds support for tables with enum columns in migration files.

Current State

It's impossible to renameColumn() or change() column types on tables with an enum-column in your migrations.

There is also a big warning in the docs.

Solution

I just add the type to doctrines internal mapping and it works.

$schema = $connection->getDoctrineSchemaManager();
$databasePlatform = $schema->getDatabasePlatform();
$databasePlatform->registerDoctrineTypeMapping('enum', 'string');

What's still unsupported

Renaming and changing an enum column directly. I will take a look into this after this PR.

Thanks to my friend @bosske1 for working with me on this.
Also thanks to @staudenmeir who was so kind as to answer my questions.

@nuernbergerA nuernbergerA changed the title Rename column support tables with enum [7.x] Rename column support tables with enum Apr 3, 2020
@nuernbergerA nuernbergerA changed the title [7.x] Rename column support tables with enum [7.x] renameColumn() support tables with enum Apr 3, 2020
@nuernbergerA nuernbergerA marked this pull request as ready for review April 3, 2020 19:01
@GrahamCampbell GrahamCampbell changed the title [7.x] renameColumn() support tables with enum [7.x] Added renameColumn() enum support Apr 4, 2020
@taylorotwell taylorotwell merged commit cd6849b into laravel:7.x Apr 6, 2020
perifer added a commit to perifer/docs that referenced this pull request Sep 24, 2020
@nuernbergerA nuernbergerA deleted the rename-column-support-tables-with-enum branch March 19, 2021 09:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants