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

implement FluidColumnOptions::uniqueIndex() ? #18

Open
dsavina opened this issue Dec 16, 2020 · 3 comments
Open

implement FluidColumnOptions::uniqueIndex() ? #18

dsavina opened this issue Dec 16, 2020 · 3 comments

Comments

@dsavina
Copy link
Contributor

dsavina commented Dec 16, 2020

Working on MySQL, when I use the unique() method, I get constant diff with my versioned schema, as this method only adds an option on the column, whereas an index is created when actually creating the schema in database. Therefore, I'm wondering whether it would be relevant to have a uniqueIndex() method relying on Doctrine method Table::createUniqueIndex().

If agreed, I will gladly implement it.

@dsavina dsavina changed the title implement FluidColumnOptions::uniqueIndex() implement FluidColumnOptions::uniqueIndex() ? Dec 16, 2020
@moufmouf
Copy link
Member

I'm not sure I understand. Whet would be the difference between unique() and uniqueIndex()?

Wouldn't it be better to rewrite the unique() method to use Table::createUniqueIndex() behind the scenes?

@dsavina
Copy link
Contributor Author

dsavina commented Dec 17, 2020

My guess is that the handling for the custom option "unique" on a column as an index is a specificity of MySQL, but I might be wrong here. I'm all in for rewriting the method to use Table::createUniqueIndex() instead, though we might need to make sure that it does not break compatibility for migrations already using this unique method in existing projects.

@moufmouf
Copy link
Member

I'd say that if a migration has already been applied in production, the change won't impact it. So... yeah.... let's make the change directly in the unique() method!

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

No branches or pull requests

2 participants