Using DataGrip across multiple environments/data sources
I'm wondering if anyone has any tips on how they manage this.
When I'm working with a database, I may be making and testing changes in my dev environment (one data source) but also querying the live environment (a second data source) to check on data, existing schema, etc.
If I have a script file attached to my project which I have already run in one environment, it remembers that connection the next time I open it, making the possibility of running a script file in the wrong environment a bit too easy. In the past, I've gotten round this by creating separate DataGrip projects for each of the environments but this seems clunky, and actually deprives me of some useful comparison tools.
It would be great to have a setting and/or command which clears all script file data sources either manually or on certain actions, like exiting the project - does anything like that exist?
And if anyone else works in this way, how do you manage working across environments with less danger?!
请先登录再写评论。
Alternatively, you can adjust the SQL dialect scope for the SQL files folder so it doesn't associate any files with the given dialect's data sources.
Am I correct that your goal is to reset all data source connections set to your SQL Files after IDE restart?
I'm just looking for any ways to help me work across several environments that will make it easier to prevent running an update in the wrong one!
I was having a look at the your read-only suggestion which would probably be good if it could be always on by default when loading the project, and I would set it to non read-only on a session-by-session basis.
I think what I might have to do is set up two projects, one for dev work where the live DB is always read-only, and one that I'll only use when I want to update the live DB. I've also set a colour for the different data sources to make it clearer which one the current tab is looking at which I think will really help.
Thanks for taking the time to respond!