Atlas – Terraform but for Database Migrations
I wish people would explain why they created their project and what their pain points were with existing alternatives. All I can find is &quot;Contrary to existing tools, Atlas intelligently plans schema migrations for you, based on your desired state.&quot;<p>What&#x27;s so bad about writing an explicit migrations using something like Flyway? I&#x27;m a fan of declarative configuration for the most part but it doesn&#x27;t seem that beneficial here to me. Sure, using it to modify the schema to the desired state is fine from just the schema perspective. But there is also data you have to worry about. Like someone else stated, the rename example is probably the most trivial example. How would the tool know if I wanted to delete one column and add another or if I wanted to rename the column?<p>Another more complicated example is what if I had a column called created_at that stored a string and I wanted it to store a date instead. How would atlas know that just by changing the type? I might want it deleted and recreated. But if not, how would it know what format I stored the string in and how to parse it?<p>For the rename problem, each column could have it&#x27;s own id so if the id doesn&#x27;t change it&#x27;s a rename. Or it could ask while running the migrate command and then store those answers somewhere to be used when deploying to production which seems like a pain. Something like that might work for changing the data type too. You have two columns with the same name and different ids. The new column could have something to specify to transform the data from the old column.<p>(I know it&#x27;s a terrible idea to change the data type of a column in production, but the same idea applies if you want to copy the data converted to a new type to a new column, get your production code using that new column, then delete the other column.)<p>Either way, this doesn&#x27;t seem to by much over the classic migration approach. You still have to think about how the data is going to move or be manipulated. And with the classic approach they generate a schema so you can see the final state of your database and make sure it&#x27;s what you want. With the atlas approach you have to approved the planned migration which is basically the same thing as making sure the schema generated is correct using the classic imperative approach.