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



179
180
181
182
183
184
185
186
187
188
189
190
# File 'lib/sequel-rails/storage.rb', line 179

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



192
193
194
195
196
197
198
199
200
201
202
203
# File 'lib/sequel-rails/storage.rb', line 192

def _drop
  ENV["PGPASSWORD"] = password unless password.blank?
  commands = "dropdb "
  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