-
Notifications
You must be signed in to change notification settings - Fork 891
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
Set default value of a column to unhex(replace(uuid(),'-','')) #2245
Comments
There is now a type for it: |
Hey deeuromark, appreciate your answer. But it doesn't cover my question. This works in phinx: But I want this to work: I would like to end up with the following MySQL scheme: If this is currently not possible in Phinx then would you accept a feature in the form of a pull request? |
Sure, feel free to make a PR for further detailed discussion. |
You should be able to use a |
Hi guys,
We're in the process of migrating our database migrations into phinx.
Our tables all use binary(16) as datatype for the Primary Key column.
To generate that value we set the default for the primary key to
unhex(replace(uuid(),'-',''))
.How would I be able to set that particular default using Phinx?
I tried the following (migration generated by https://github.com/odan/phinx-migrations-generator):
This results in:
'PDOException: SQLSTATE[42000]: Syntax error or access violation: 1067 Invalid default value for 'RoleID' in /vendor/robmorgan/phinx/src/Phinx/Db/Adapter/PdoAdapter.php:198'
Also tried
'default' => 'unhex(replace(uuid(),"-",""))',
. Same error.Any suggestions?
Thanks!
The text was updated successfully, but these errors were encountered: