Class: ActiveRecord::Tasks::SqlserverDatabaseTasks

Inherits:
Object
  • Object
show all
Defined in:
lib/active_record/tasks/sqlserver_database_tasks.rb

Overview

:nodoc:

Instance Method Summary collapse

Constructor Details

#initialize(configuration) ⇒ SqlserverDatabaseTasks

Returns a new instance of SqlserverDatabaseTasks.



8
9
10
11
# File 'lib/active_record/tasks/sqlserver_database_tasks.rb', line 8

def initialize(configuration)
  ActiveSupport::Deprecation.warn "This database tasks were deprecated, because this tasks should be served by the 3rd party adapter."
  @configuration = configuration
end

Instance Method Details

#charsetObject



29
30
31
# File 'lib/active_record/tasks/sqlserver_database_tasks.rb', line 29

def charset
  $stderr.puts 'sorry, your database adapter is not supported yet, feel free to submit a patch'
end

#createObject



13
14
15
# File 'lib/active_record/tasks/sqlserver_database_tasks.rb', line 13

def create
  $stderr.puts 'sorry, your database adapter is not supported yet, feel free to submit a patch'
end

#dropObject



17
18
19
# File 'lib/active_record/tasks/sqlserver_database_tasks.rb', line 17

def drop
  $stderr.puts 'sorry, your database adapter is not supported yet, feel free to submit a patch'
end

#purgeObject



21
22
23
24
25
26
27
# File 'lib/active_record/tasks/sqlserver_database_tasks.rb', line 21

def purge
  test = configuration.deep_dup
  test_database = test['database']
  test['database'] = 'master'
  establish_connection(test)
  connection.recreate_database!(test_database)
end

#structure_dump(filename) ⇒ Object



33
34
35
# File 'lib/active_record/tasks/sqlserver_database_tasks.rb', line 33

def structure_dump(filename)
  Kernel.system("smoscript -s #{configuration['host']} -d #{configuration['database']} -u #{configuration['username']} -p #{configuration['password']} -f #{filename} -A -U")
end

#structure_load(filename) ⇒ Object



37
38
39
# File 'lib/active_record/tasks/sqlserver_database_tasks.rb', line 37

def structure_load(filename)
  Kernel.system("sqlcmd -S #{configuration['host']} -d #{configuration['database']} -U #{configuration['username']} -P #{configuration['password']} -i #{filename}")
end