How can I remove a unique constraint on a field when performing a down migration? |
Copy-pasted from https://stackoverflow.com/questions/6503...-migration, feel free to answer the question there too to win a few points.
I have to add a unique constraint to a field after the table was created. I therefore set up a migration file with this in the up() method: Code: $fields = [ Code: $fields = [ When calling Code: php spark migrate:rollback What should I put in down() instead?
I don't think that you can without deleting the field and adding it in again
What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
You could execute some SQL to delete it directly:
PHP Code: public function down() (the unique index will have a name - if you don't know what it is, you can get it with this: SHOW INDEX FROM pages ![]() |
Welcome Guest, Not a member yet? Register Sign In |