Rui Gonçalves
Rui Gonçalves

Reputation: 2443

Remove `not null` constraint during a migration

I would like to cancel the mandatory of a field of my current schema. How can I accomplish that with a symfony migration?

Upvotes: 2

Views: 1186

Answers (1)

Andrei Dziahel
Andrei Dziahel

Reputation: 969

Migrations are intended to alter database, not schema. So you have to alter your schema yourself.

Also, for me best and cleanest way is to edit schema manually (just remove notnull: true on desired column) and issue symfony doctrine:generate-migrations-diff. This will generate new migration class which you have to review and test (with symfony doctrine:migrate --env=dev).

Upvotes: 2

Related Questions