Docker - how do you deploy with new DB structural updates?

You learned that trick from me!

With your “Production” target selected (not “Development”) click “Deploy”, and then go the Database manager → Changes → Right-click and click “Apply latest changes”. This last step will apply structure changes (“migrations”). Each migration is a (JavaScript) file that details what changes occurred (e.g.: created table xyz, created column abc). Data additions are not part of migrations! A migration only deletes data if you have a drop table or drop column instruction. There’s something called a “Seed” that’s used to pre-populate a database with data (like a migration but for data), but for a beginner I wouldn’t suggest to use it before you understand the database manager/migrations.

It’s important to realize the data you add on localhost is not added to the remote server - that is, when the Development target is selected. If you want to see data on the remote host, ensure the Production target is selected, and re-create the data if needed. Such data will persist across migration applies, unless the migration itself deletes the table or column in question.

If you’re unable to solve the problem reading the explanations I gave, you’ll need to post screenshots of the steps you’re doing :slight_smile:

1 Like