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

Possible compatibility issues with column rename MySQL #519

Closed
tpow opened this issue Nov 12, 2021 · 1 comment · Fixed by #525
Closed

Possible compatibility issues with column rename MySQL #519

tpow opened this issue Nov 12, 2021 · 1 comment · Fixed by #525
Labels
bug An existing feature is not working as intended

Comments

@tpow
Copy link

tpow commented Nov 12, 2021

The alter table RENAME COLUMN old TO new syntax is relatively new to MySQL and isn't supported in all versions. (I have a somewhat older distro provided version of MariaDB that I don't think supports it.)

See https://dev.mysql.com/doc/refman/8.0/en/alter-table.html#alter-table-redefine-column

I'm wondering if it might be better to use the MySQL CHANGE old new type version that has been around for a long time. I actually thought that's what Masonite ORM was doing because otherwise I'm not sure why rename requires the data type.

Additionally, is renaming and moving a field (using after) valid in a migration? For example:

table.rename("field1", "field3", "string").after("field2")

If so, depending how the SQL to do this is built, the RENAME COLUMN version may not work. I don't think it allows AFTER to be specified in the rename column syntax, but CHANGE should work correctly.

@tpow tpow added the bug An existing feature is not working as intended label Nov 12, 2021
@josephmancuso
Copy link
Member

You're right. This MySQL syntax is wrong

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An existing feature is not working as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants