When you’re just starting figuring out your domain model, it’s sometimes easier to modify your create table migration instead of creating new migrations.
Let’s say you originally were storing a field as a string
But you realized that you’re needing to store data that’s longer than 255 characters, so you decide to switch to a text type.
(Don’t know the difference between text and string this will help)
So you just edit the original migration to this:
But nothing will happen until you wipe out your own database and reset it.
In the command line, just run:
Although this works out if you’re hacking up a brand new development database that has never been deployed, I wouldn’t recommend doing this on something that’s been deployed to production!
Enjoyed the article? Subscribe to my newsletter for more.
© Thomas McGoey-Smith (2014-2018). RSS.