Sha256: be907c5f7f81b6a17216799a1de10b8857e707579cc7d6aa2b1e8f323be08488

Contents?: true

Size: 1.25 KB

Versions: 39

Compression:

Stored size: 1.25 KB

Contents

namespace :oracle do
  task :setup do
    require 'bundler'
    Bundler.require(:default, :oracle)
  end

  desc 'Build the Oracle test database'
  task :build_database => :setup do
    spec = CompositePrimaryKeys::ConnectionSpec['oracle']
    ActiveRecord::Base.clear_all_connections!
    ActiveRecord::Base.establish_connection(spec)

    schema = File.join(PROJECT_ROOT, 'test', 'fixtures', 'db_definitions', 'oracle.sql')
    sql = File.read(schema)

    sql.split(';').each do |command|
      ActiveRecord::Base.connection.execute(command) unless command.blank?
    end

    ActiveRecord::Base.clear_all_connections!
  end

  desc 'Drop the Oracle test database'
  task :drop_database => :setup do
    spec = CompositePrimaryKeys::ConnectionSpec['oracle']
    ActiveRecord::Base.clear_all_connections!
    ActiveRecord::Base.establish_connection(spec)

    schema = File.join(PROJECT_ROOT, 'test', 'fixtures', 'db_definitions', 'oracle.drop.sql')
    sql = File.read(schema)

    sql.split(';').each do |command|
      ActiveRecord::Base.connection.execute(command)
    end

    ActiveRecord::Base.clear_all_connections!
  end

  desc 'Rebuild the Oracle test database'
  task :rebuild_database => [:drop_database, :build_database]
end

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
composite_primary_keys-11.0.3 tasks/databases/oracle.rake
composite_primary_keys-11.0.2 tasks/databases/oracle.rake
composite_primary_keys-10.0.5 tasks/databases/oracle.rake
composite_primary_keys-9.0.10 tasks/databases/oracle.rake
composite_primary_keys-11.0.1 tasks/databases/oracle.rake
composite_primary_keys-11.0.0 tasks/databases/oracle.rake
composite_primary_keys-10.0.4 tasks/databases/oracle.rake
composite_primary_keys-9.0.9 tasks/databases/oracle.rake
composite_primary_keys-10.0.3 tasks/databases/oracle.rake
composite_primary_keys-11.0.0.rc1 tasks/databases/oracle.rake
composite_primary_keys-11.0.0.beta4 tasks/databases/oracle.rake
composite_primary_keys-11.0.0.beta3 tasks/databases/oracle.rake
composite_primary_keys-11.0.0.beta2 tasks/databases/oracle.rake
composite_primary_keys-11.0.0.beta1 tasks/databases/oracle.rake
composite_primary_keys-10.0.2 tasks/databases/oracle.rake
composite_primary_keys-10.0.1 tasks/databases/oracle.rake
composite_primary_keys-9.0.8 tasks/databases/oracle.rake
composite_primary_keys-10.0.0 tasks/databases/oracle.rake
composite_primary_keys-9.0.7 tasks/databases/oracle.rake