Under review

Updating existing database with new tables and references

Mathias Bjerglund Poulsen 6 years ago updated by Adam Mościcki 6 years ago 1

I have a simple model designed and exported it and set up a database from that.

Now I want to update my model with new tables and references and export this as well and then update my database.

I tried to do that, but when I imported it to my existing schema, it didn't have all columns and references only some of them.

I use MySQL workbench to manage my MySQL database.

Would I need to make a need schema with the new exported model and then migrate the new one to the old one using something like Flyway? Or how would one do this? 

Sorry if this is a very basic question or it is unclear what i am asking. I am rather new to SQL databases. 

Under review


You can generate two kinds of script in Vertabelo:

  1. Create
  2. Drop

The create script will not work when your tables already exist. It is probably the reason why you don't see the changes in your schema.

You need to apply the drop script first and then create script again. Warning: When you apply the drop script, all data will be lost.

Another solution is to use our migration tool. Migration scripts are usefull when you need to preserve data. More info is here: https://www.vertabelo.com/documentation/managing-models/migration-scripts

Hope this helps,
Adam Mościcki