#Problem running migration with data in table
4 messages · Page 1 of 1 (latest)
You’re probably creating a column that has either no default value or Allow null is not enabled.
What happens in the case is that although the database can create the column, but you have defined that the column cannot be null. And you haven’t even defined a default value. So the database doesn’t know what to do with the existing data. Beacuse the column will be created for those rows as well.
So the database runs into a paradox, on what to put in the new column of the existing data. So it’s suggesting to delete those rows and then add the column.
If you enable allow null, the database would accept that and simply put null in those existing rows’s new column you’re creating.
Then you add some values to it and after all of the rows has some value. Then you can come back and set it back to Allow null as off / disabled.
Note that this is a database issue and not directus issue.
Ah ok perfect, I will try the new column with a default value and not null aswell , thank you ! 😄
You’re welcome. See if that works.