Sync schema changes from files to database
Hello everyone,
I am currently using VisualStudio with SQL Server Data Tools (SSDT) to edit local .sql files and then synchronize these changes into my (dev) MSSQL Server. I am trying to find the same functionality for Postgres and was hoping that DataGrip would provide such a functionality.
What I achieved:
- Using `SQL Scripts > SQL Generator …` I was able to export the database in form of .sql files to my disk.
- I was able to change these .sql files (duh!)
What I have not achieved:
- I now would like to “synchronize” (deploy, migrate, …) all changes to the database server. How can this be done?
Kind regards
Andreas
Please sign in to leave a comment.
If you are frequently storing local SQL files, you'd want to apply to your data source(prod database), a more scalable solution for your use case would be mapping a DDL data source
https://www.jetbrains.com/help/datagrip/ddl-data-sources.html
It'll dump a selected scope of your original database locally, allowing you then to make changes and apply them to your prod db.
Thank you for your suggestion - that is indeed what I was looking for.
It is however missing an important functionality: VisualStudio+SSDT will validate the schema changes. If the schema change contains inconsistencies (e.g. a column in a view is not existing in the underlying table) or would lead to data loss (e.g. column from table removed) it will stop and throw an error.
Does DataGrip have a similar functionality?
https://www.jetbrains.com/help/datagrip/schemas.html#force-refresh-schema-information
If you want to compare specific objects, Compare Structure could also be a good alternative
https://www.jetbrains.com/help/datagrip/schema-comparison-and-migration.html