Sha256: 66c17a53321971a249faf5c3c862ee2c0c5b044d590e9b21e240008d6d7a7c3d

Contents?: true

Size: 1.53 KB

Versions: 29

Compression:

Stored size: 1.53 KB

Contents

require 'shellwords'

module ActiveRecord
  module Tasks # :nodoc:
    class SqlserverDatabaseTasks # :nodoc:
      delegate :connection, :establish_connection, to: ActiveRecord::Base

      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

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

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

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

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

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

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

      private

      def configuration
        @configuration
      end
    end
  end
end

Version data entries

29 entries across 29 versions & 2 rubygems

Version Path
activerecord-4.0.13 lib/active_record/tasks/sqlserver_database_tasks.rb
activerecord-4.0.13.rc1 lib/active_record/tasks/sqlserver_database_tasks.rb
activerecord-4.0.11.1 lib/active_record/tasks/sqlserver_database_tasks.rb
activerecord-4.0.12 lib/active_record/tasks/sqlserver_database_tasks.rb
activerecord-4.0.11 lib/active_record/tasks/sqlserver_database_tasks.rb
activerecord-4.0.10 lib/active_record/tasks/sqlserver_database_tasks.rb
activerecord-4.0.10.rc2 lib/active_record/tasks/sqlserver_database_tasks.rb
activerecord-4.0.10.rc1 lib/active_record/tasks/sqlserver_database_tasks.rb
activerecord-4.0.9 lib/active_record/tasks/sqlserver_database_tasks.rb
activerecord-4.0.8 lib/active_record/tasks/sqlserver_database_tasks.rb
activerecord-4.0.7 lib/active_record/tasks/sqlserver_database_tasks.rb
activerecord-4.0.6 lib/active_record/tasks/sqlserver_database_tasks.rb
activerecord-4.0.6.rc3 lib/active_record/tasks/sqlserver_database_tasks.rb
activerecord-4.0.6.rc2 lib/active_record/tasks/sqlserver_database_tasks.rb
activerecord-4.0.6.rc1 lib/active_record/tasks/sqlserver_database_tasks.rb
activerecord-4.0.5 lib/active_record/tasks/sqlserver_database_tasks.rb
activerecord-4.0.4 lib/active_record/tasks/sqlserver_database_tasks.rb
activerecord-4.0.4.rc1 lib/active_record/tasks/sqlserver_database_tasks.rb
activerecord-4.0.3 lib/active_record/tasks/sqlserver_database_tasks.rb
activerecord-4.0.2 lib/active_record/tasks/sqlserver_database_tasks.rb