-
-
Notifications
You must be signed in to change notification settings - Fork 15
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
Migrations: Support ENUM field #8
Comments
+1 |
1 similar comment
+1 |
Is enum supported by all DBs that are supported in Yii? |
@samdark even if not directly supported by a db, adding a check constraint to limit values makes it look like an enum: ALTER TABLE table ADD CONSTRAINT enum_col CHECK (enum_col IN ('value1', 'value2')); CHECK constraints should be supported by most dbs, even SQLite. |
The drawback is that such a CHECK constraint won't be detected as an enum when Yii loads the schema and populates |
So Gii won't be able to generate based on such checks. And since we don't have it in schema we won't be able to work with these in a good way... |
We could have only one supported syntax and detect it, like the example i've posted above. I've already done detecting literal values when parsing column defaults in #9773. |
I actually use such CHECK syntax often and would be interested if it gets detected, because now I have to add it in the model manually. |
It would be great to have support for an API like $this->addEnumValue($tableName, $columnName, ['NEW_ENUM_VALUE']);
$this->removeEnumValue($tableName, $columnName, ['NEW_ENUM_VALUE']); |
+1 |
The biggest challenge with adding/removing ENUM values from a column is migrating old records to the new values. Maybe that should be the responsibility of the developer to write the proper updateAll() statements in their migration? |
I assume that adding a default value can solve the problem with the data migration. |
+1 |
2 similar comments
+1 |
+1 |
We are glad to accept a pull request with the suggested enhancement |
+1 |
2 similar comments
+1 |
+1 |
how to add default value in enum ?? |
|
+1 |
Is anyone working on this? |
No. |
@samdark is this done? |
No. |
I really want to have enum and set column type support :-) |
Is this feature still in progress? |
It is on hold. |
should be supported via
Funding
The text was updated successfully, but these errors were encountered: