Class: Rails::Sequel::Storage::Postgres

Inherits:
Rails::Sequel::Storage show all
Defined in:
lib/sequel-rails/storage.rb

Instance Attribute Summary

Attributes inherited from Rails::Sequel::Storage

#config

Instance Method Summary collapse

Methods inherited from Rails::Sequel::Storage

#charset, #create, create_all, create_environment, #database, #drop, drop_all, drop_environment, #host, #initialize, new, #owner, #password, #port, #username

Constructor Details

This class inherits a constructor from Rails::Sequel::Storage

Instance Method Details

#_createObject



160
161
162
163
164
165
166
167
168
169
170
171
# File 'lib/sequel-rails/storage.rb', line 160

def _create
  ENV["PGPASSWORD"] = password unless password.blank?
  commands = ["createdb", "--encoding", charset]
  commands << "--username" << username unless username.blank?
  commands << "--owner" << owner unless owner.blank?
  commands << "--port" << port unless port.blank?
  commands << "--host" << host unless host.blank?
  commands << database
  res = system(*commands)
  ENV["PGPASSWORD"] = nil
  res
end

#_dropObject



173
174
175
# File 'lib/sequel-rails/storage.rb', line 173

def _drop
  system("dropdb", "-U", username, database)
end