feat(pg_type_map): add validation for Qx to run if database exists
This commit is contained in:
parent
da68bca689
commit
04a5eb039f
1 changed files with 8 additions and 2 deletions
|
@ -2,6 +2,12 @@
|
|||
require 'active_record'
|
||||
require 'qx'
|
||||
require 'pg'
|
||||
Qx.config(type_map: PG::BasicTypeMapForResults.new(ActiveRecord::Base.connection.raw_connection))
|
||||
Qx.execute("SET TIME ZONE utc")
|
||||
def database_exists?
|
||||
ActiveRecord::Base.connection
|
||||
rescue ActiveRecord::NoDatabaseError
|
||||
false
|
||||
else
|
||||
Qx.config(type_map: PG::BasicTypeMapForResults.new(ActiveRecord::Base.connection.raw_connection))
|
||||
Qx.execute("SET TIME ZONE utc")
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue