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



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

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.to_s unless port.blank?
  commands << "--host" << host unless host.blank?
  commands << database
  res = system(*commands)
  ENV["PGPASSWORD"] = nil
  res
end

#_dropObject



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

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