File tree Expand file tree Collapse file tree 3 files changed +9
-5
lines changed Expand file tree Collapse file tree 3 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -82,6 +82,8 @@ def store_dump(filename)
82
82
Hooks ::Postgres . new ( connection_settings )
83
83
when :mysql
84
84
Hooks ::MySql . new ( connection_settings )
85
+ else
86
+ raise "Unsupported type of source"
85
87
end
86
88
dumper . dump ( filename_with_namespace )
87
89
end
@@ -97,6 +99,8 @@ def restore_dump(filename)
97
99
Hooks ::Postgres . new ( connection_settings )
98
100
when :mysql
99
101
Hooks ::MySql . new ( connection_settings )
102
+ else
103
+ raise "Unsupported type of source"
100
104
end
101
105
dumper . restore ( filename_with_namespace )
102
106
end
Original file line number Diff line number Diff line change @@ -10,15 +10,15 @@ def dump(filename)
10
10
args << "--compress"
11
11
args . concat ( [ "--result-file" , filename ] )
12
12
args . concat ( [ "--ignore-table" , "#{ @connection_settings . database } .schema_migrations" ] )
13
- args . concat [ '--user' , @connection_settings . username ] if @connection_settings . username
13
+ args . concat ( [ '--user' , @connection_settings . username ] ) if @connection_settings . username
14
14
args << "--password=#{ @connection_settings . password } " if @connection_settings . password
15
15
Kernel . system ( "mysqldump" , *args )
16
16
end
17
17
18
18
def restore ( filename )
19
19
args = [ @connection_settings . database ]
20
- args . concat [ "-e" , "source #{ filename } " ]
21
- args . concat [ '--user' , @connection_settings . username ] if @connection_settings . username
20
+ args . concat ( [ "-e" , "source #{ filename } " ] )
21
+ args . concat ( [ '--user' , @connection_settings . username ] ) if @connection_settings . username
22
22
args << "--password=#{ @connection_settings . password } " if @connection_settings . password
23
23
Kernel . system ( "mysql" , *args )
24
24
end
Original file line number Diff line number Diff line change @@ -10,15 +10,15 @@ def dump(filename)
10
10
args . concat ( [ '-d' , @connection_settings . database ] )
11
11
args . concat ( [ '-U' , @connection_settings . username ] ) if @connection_settings . username
12
12
args . concat ( [ '-h' , @connection_settings . host ] ) if @connection_settings . host
13
- args . concat ( [ '-p' , @connection_settings . port ] ) if @connection_settings . port
13
+ args . concat ( [ '-p' , @connection_settings . port . to_s ] ) if @connection_settings . port
14
14
Kernel . system ( "pg_dump" , *args )
15
15
end
16
16
17
17
def restore ( filename )
18
18
args = [ '-d' , @connection_settings . database ]
19
19
args . concat ( [ '-U' , @connection_settings . username ] ) if @connection_settings . username
20
20
args . concat ( [ '-h' , @connection_settings . host ] ) if @connection_settings . host
21
- args . concat ( [ '-p' , @connection_settings . port ] ) if @connection_settings . port
21
+ args . concat ( [ '-p' , @connection_settings . port . to_s ] ) if @connection_settings . port
22
22
args << filename
23
23
Kernel . system ( "pg_restore" , *args )
24
24
end
You can’t perform that action at this time.
0 commit comments