]> git.openstreetmap.org Git - rails.git/blob - vendor/gems/composite_primary_keys-1.1.0/tasks/databases/oracle.rake
Freezing composite primary key so that we can apply TomH's patch to it, and that...
[rails.git] / vendor / gems / composite_primary_keys-1.1.0 / tasks / databases / oracle.rake
1 namespace :oracle do
2   desc 'Build the Oracle test databases'
3   task :build_databases => :load_connection do 
4     puts File.join(SCHEMA_PATH, 'oracle.sql')
5     options_str = ENV['cpk_adapter_options_str']
6     sh %( sqlplus #{options_str} < #{File.join(SCHEMA_PATH, 'oracle.sql')} )
7   end
8
9   desc 'Drop the Oracle test databases'
10   task :drop_databases => :load_connection do 
11     puts File.join(SCHEMA_PATH, 'oracle.drop.sql')
12     options_str = ENV['cpk_adapter_options_str']
13     sh %( sqlplus #{options_str} < #{File.join(SCHEMA_PATH, 'oracle.drop.sql')} )
14   end
15
16   desc 'Rebuild the Oracle test databases'
17   task :rebuild_databases => [:drop_databases, :build_databases]
18   
19   task :load_connection do
20     require File.join(PROJECT_ROOT, %w[lib adapter_helper oracle])
21     spec = AdapterHelper::Oracle.load_connection_from_env
22     ENV['cpk_adapter_options_str'] = "#{spec[:username]}/#{spec[:password]}@#{spec[:host]}"
23   end
24   
25 end