File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change 33
44module LoadHelper
55 def self . import_on_local ( )
6+ LoadHelper . create_db_if_not_exists fetch ( :db_name )
7+
68 run_locally do
79 execute "mysql #{ Helper ::mysql_restore_args } < #{ fetch ( :db_local_dump ) } "
810 end
@@ -11,12 +13,20 @@ def self.import_on_local()
1113 def self . import_on_container ( container )
1214 container . upload! ( fetch ( :db_local_dump ) , fetch ( :db_remote_dump ) )
1315
16+ LoadHelper . create_db_if_not_exists fetch ( :db_name )
17+
1418 container . execute "mysql #{ Helper ::mysql_restore_args } < #{ fetch ( :db_remote_dump ) } "
1519 end
1620
1721 def self . import_on_server ( )
1822 upload! ( fetch ( :db_local_dump ) , fetch ( :db_remote_dump ) )
1923
24+ LoadHelper . create_db_if_not_exists fetch ( :db_name )
25+
2026 execute ( "mysql #{ Helper ::mysql_restore_args } < #{ fetch ( :db_remote_dump ) } " )
2127 end
28+
29+ def self . create_db_if_not_exists ( db )
30+ Helper . execute_db_command_autodetect "CREATE DATABASE IF NOT EXISTS #{ db } ;"
31+ end
2232end
You can’t perform that action at this time.
0 commit comments