Sha256: cc907dad8afe6b3bcf3b36185b2374cd167d39eaf765017539f3811ed6d44603

Contents?: true

Size: 1017 Bytes

Versions: 10

Compression:

Stored size: 1017 Bytes

Contents

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

namespace :mysql do
  desc 'Build the MySQL test databases'
  task :build_databases => :load_connection do 
    options_str = connection_string
    # creates something like "-u#{username} -p#{password} -S#{socket}"
    sh %{ mysqladmin #{options_str} create "#{SPEC['database']}" }

    schema = File.join(PROJECT_ROOT, 'test', 'fixtures', 'db_definitions', 'mysql.sql')
    sh %{ mysql #{options_str} "#{SPEC['database']}" < #{schema} }
  end

  desc 'Drop the MySQL test databases'
  task :drop_databases => :load_connection do 
    options_str = connection_string
    sh %{ mysqladmin #{options_str} -f drop "#{SPEC['database']}" }
  end

  desc 'Rebuild the MySQL test databases'
  task :rebuild_databases => [:drop_databases, :build_databases]
  
  task :load_connection do
    require File.join(PROJECT_ROOT, "test", "connections", "native_mysql", "connection")
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
composite_primary_keys-5.0.0.rc1 tasks/databases/mysql.rake
composite_primary_keys-4.1.2 tasks/databases/mysql.rake
composite_primary_keys-4.1.1 tasks/databases/mysql.rake
composite_primary_keys-4.0.0 tasks/databases/mysql.rake
composite_primary_keys-4.0.0.beta9 tasks/databases/mysql.rake
composite_primary_keys-4.0.0.beta8 tasks/databases/mysql.rake
composite_primary_keys-4.0.0.beta7 tasks/databases/mysql.rake
composite_primary_keys-4.0.0.beta6 tasks/databases/mysql.rake
composite_primary_keys-4.0.0.beta5 tasks/databases/mysql.rake
composite_primary_keys-4.0.0.beta4 tasks/databases/mysql.rake