Sha256: 274182bbfad0ec4bb5480f44d0d62dd11eea80c849889da50e111e9f62ad15d0

Contents?: true

Size: 902 Bytes

Versions: 43

Compression:

Stored size: 902 Bytes

Contents

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

namespace :sqlite3 do
  desc 'Build the sqlite test database'
  task :build_database => :load_connection do
    schema = File.join(PROJECT_ROOT, 'test', 'fixtures', 'db_definitions', 'sqlite.sql')
    dbfile = File.join(PROJECT_ROOT, connection_string)
    FileUtils.mkdir_p(File.dirname(dbfile))
    cmd = "sqlite3 #{dbfile} < #{schema}"
    puts cmd
    sh %{ #{cmd} }
  end

  desc 'Drop the sqlite test database'
  task :drop_database => :load_connection do 
    dbfile = connection_string
    sh %{ rm -f #{dbfile} }
  end

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

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

Version data entries

43 entries across 43 versions & 1 rubygems

Version Path
composite_primary_keys-5.0.9 tasks/databases/sqlite3.rake
composite_primary_keys-5.0.8 tasks/databases/sqlite3.rake
composite_primary_keys-5.0.6 tasks/databases/sqlite3.rake