Class: ActiveRecord::Tasks::SqlserverDatabaseTasks
- Inherits:
-
Object
- Object
- ActiveRecord::Tasks::SqlserverDatabaseTasks
- Defined in:
- lib/active_record/tasks/sqlserver_database_tasks.rb
Overview
:nodoc:
Instance Method Summary collapse
- #charset ⇒ Object
- #create ⇒ Object
- #drop ⇒ Object
-
#initialize(configuration) ⇒ SqlserverDatabaseTasks
constructor
A new instance of SqlserverDatabaseTasks.
- #purge ⇒ Object
- #structure_dump(filename) ⇒ Object
- #structure_load(filename) ⇒ Object
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
#charset ⇒ Object
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 |
#create ⇒ Object
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 |
#drop ⇒ Object
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 |
#purge ⇒ Object
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 |