Skip to content

Commit 42acb49

Browse files
author
alvir
committed
Convert port settings to String.
1 parent d91918b commit 42acb49

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

lib/dump_hook.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ def store_dump(filename)
8282
Hooks::Postgres.new(connection_settings)
8383
when :mysql
8484
Hooks::MySql.new(connection_settings)
85+
else
86+
raise "Unsupported type of source"
8587
end
8688
dumper.dump(filename_with_namespace)
8789
end
@@ -97,6 +99,8 @@ def restore_dump(filename)
9799
Hooks::Postgres.new(connection_settings)
98100
when :mysql
99101
Hooks::MySql.new(connection_settings)
102+
else
103+
raise "Unsupported type of source"
100104
end
101105
dumper.restore(filename_with_namespace)
102106
end

lib/dump_hook/hooks/mysql.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ def dump(filename)
1010
args << "--compress"
1111
args.concat(["--result-file", filename])
1212
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
1414
args << "--password=#{@connection_settings.password}" if @connection_settings.password
1515
Kernel.system("mysqldump", *args)
1616
end
1717

1818
def restore(filename)
1919
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
2222
args << "--password=#{@connection_settings.password}" if @connection_settings.password
2323
Kernel.system("mysql", *args)
2424
end

lib/dump_hook/hooks/postgres.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ def dump(filename)
1010
args.concat(['-d', @connection_settings.database])
1111
args.concat(['-U', @connection_settings.username]) if @connection_settings.username
1212
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
1414
Kernel.system("pg_dump", *args)
1515
end
1616

1717
def restore(filename)
1818
args = ['-d', @connection_settings.database]
1919
args.concat(['-U', @connection_settings.username]) if @connection_settings.username
2020
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
2222
args << filename
2323
Kernel.system("pg_restore", *args)
2424
end

0 commit comments

Comments
 (0)