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 'active_record'
|
||||||
require 'qx'
|
require 'qx'
|
||||||
require 'pg'
|
require 'pg'
|
||||||
Qx.config(type_map: PG::BasicTypeMapForResults.new(ActiveRecord::Base.connection.raw_connection))
|
def database_exists?
|
||||||
Qx.execute("SET TIME ZONE utc")
|
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