Sha256: da1cb38718784b8beec87e583422946f2fecebf550efa1e36f3327d189cc6027

Contents?: true

Size: 1.45 KB

Versions: 3

Compression:

Stored size: 1.45 KB

Contents

require File.join(PROJECT_ROOT, 'lib', 'composite_primary_keys')
require File.join(PROJECT_ROOT, 'test', 'connections', 'connection_spec')

require 'rbconfig'
if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
  sql_cmd = "osql"
else
  sql_cmd = sqsh
end

namespace :sqlserver do
  desc 'Build the SQL Server test database'
  task :build_database => :load_connection do
    options_str = connection_string

    schema = File.join(PROJECT_ROOT, 'test', 'fixtures', 'db_definitions',
                       'sqlserver.sql').gsub(File::SEPARATOR,
                                             File::ALT_SEPARATOR ||
                                             File::SEPARATOR)
    sh %( #{sql_cmd} #{options_str} -i #{schema} )
  end

  desc 'Drop the SQL Server test database'
  task :drop_database => :load_connection do
    options_str = connection_string

    schema = File.join(PROJECT_ROOT, 'test', 'fixtures', 'db_definitions',
                       'sqlserver.drop.sql').gsub(File::SEPARATOR,
                                                  File::ALT_SEPARATOR ||
                                                  File::SEPARATOR)
    sh %( #{sql_cmd} #{options_str} -i #{schema} )
  end

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

  task :load_connection do
    require File.join(PROJECT_ROOT, "test", "connections", "native_sqlserver", "connection")
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
composite_primary_keys-7.0.16 tasks/databases/sqlserver.rake
composite_primary_keys-7.0.15 tasks/databases/sqlserver.rake
composite_primary_keys-7.0.14 tasks/databases/sqlserver.rake