Support for 'source' in mysql

I have a repo in repo in phpstorm that contains various sql files for create views, SPs etc.

I want to create a file like install.sql tthat contains:
 source file1.sql
source file2.sql

So that I can then run that one file and all my views etc are updated. The order that this files run is important.

I know this is possible from the cli and also that some gui clients support this - I believe that mysql workbench does for example.

Is there a way to do this in PHPStorm? If not can this go in as a feature request?

 

 

 

0
Hi,

Are you referring to the sql files concatenated into a single file you want to run as an import? Please provide more details about your scenario and the execution flow control    
0

Essentially yes.

The idea is I would have a project like

  • views
    • view1.sql
    • view2.sql
    • view3.sql
  • Storedprocedures
    • storedprocedure1.sql
    • storedprocedure2.sql

and then a file called install.sql that would contain

source views/view1.sql
source views/view2.sql
source views/view3.sql
source Storedprocedures/storedprocedure1.sql
source Storedprocedures/storedprocedure2.sql

Running install.sql would then run on of those files in order

This can be done on the command line like:
mysql> source \home\user\Desktop\test.sql;

but being able to do it via the IDE and have the file in version control would be super useful

0
We may file a feature request. However, this use case can be achieved with a Run Configuration job where you add the DDL scripts in the execution flow order of your choice and store them as a single entity

https://www.jetbrains.com/help/datagrip/run-debug-configurations-dialog.html

Once a job is created, it'll execute the scripts against the target you specified in a single go.   
0

请先登录再写评论。