Replies: 1 comment
-
I general, I suggest always doing a migration when changing a table.
You need a migration here for sure! Non-nullable columns get a special
You could technically pull this off without a migration, but I very strongly suggest adding one. This has two reasons:
Migrations changing columns are usually pretty easy to write by using this API. Another neat thing that drift can do for you is check whether your database schema matches what it expects. You can just check this when opening your database. Whenever you change your tables and forget to write a migration, drift is then going to tell you what differences it expected in the schema. That way, you catch errors early if there are issues with the schema. |
Beta Was this translation helpful? Give feedback.
-
For example do I need to do anything if I set maxLength before on a textColumn and now I try to increase/decrease the value of it?
TextColumn? get myStringColumn=> text().withLength(min: 0, max: 100).nullable()();
to
TextColumn? get myStringColumn=> text().withLength(min: 0, max: 3000).nullable()();
What about if I modify the nullable column to non-nullable? What about non-nullable to nullable?
I wonder if there is a very long list that contains these information and more that I might run into sooner or later.
Thanks in advance.
Beta Was this translation helpful? Give feedback.
All reactions