/
oracle_database_tasks.rb
44 lines (35 loc) · 1.19 KB
/
oracle_database_tasks.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
module ActiveRecord
module Tasks # :nodoc:
class OracleDatabaseTasks # :nodoc:
delegate :connection, :establish_connection, to: ActiveRecord::Base
def initialize(configuration)
@configuration = configuration
end
def create
$stderr.puts 'sorry, your database adapter is not supported yet, feel free to submit a patch'
end
def drop
$stderr.puts 'sorry, your database adapter is not supported yet, feel free to submit a patch'
end
def purge
establish_connection(:test)
connection.structure_drop.split(";\n\n").each { |ddl| connection.execute(ddl) }
end
def charset
$stderr.puts 'sorry, your database adapter is not supported yet, feel free to submit a patch'
end
def structure_dump(filename)
establish_connection(configuration)
File.open(filename, "w:utf-8") { |f| f << connection.structure_dump }
end
def structure_load(filename)
establish_connection(configuration)
IO.read(filename).split(";\n\n").each { |ddl| connection.execute(ddl) }
end
private
def configuration
@configuration
end
end
end
end