activerecord-oracle_enhanced-adapter 1.7.11 → 1.8.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/History.md +206 -4
- data/README.md +37 -1
- data/VERSION +1 -1
- data/lib/active_record/connection_adapters/emulation/oracle_adapter.rb +1 -1
- data/lib/active_record/connection_adapters/oracle_enhanced/column.rb +7 -59
- data/lib/active_record/connection_adapters/oracle_enhanced/column_dumper.rb +6 -50
- data/lib/active_record/connection_adapters/oracle_enhanced/connection.rb +11 -11
- data/lib/active_record/connection_adapters/oracle_enhanced/context_index.rb +117 -117
- data/lib/active_record/connection_adapters/oracle_enhanced/database_statements.rb +37 -27
- data/lib/active_record/connection_adapters/oracle_enhanced/database_tasks.rb +10 -10
- data/lib/active_record/connection_adapters/oracle_enhanced/jdbc_connection.rb +56 -71
- data/lib/active_record/connection_adapters/oracle_enhanced/jdbc_quoting.rb +0 -7
- data/lib/active_record/connection_adapters/oracle_enhanced/oci_connection.rb +51 -69
- data/lib/active_record/connection_adapters/oracle_enhanced/oci_quoting.rb +4 -4
- data/lib/active_record/connection_adapters/oracle_enhanced/procedures.rb +76 -76
- data/lib/active_record/connection_adapters/oracle_enhanced/quoting.rb +14 -43
- data/lib/active_record/connection_adapters/oracle_enhanced/schema_creation.rb +60 -64
- data/lib/active_record/connection_adapters/oracle_enhanced/schema_definitions.rb +33 -47
- data/lib/active_record/connection_adapters/oracle_enhanced/schema_dumper.rb +150 -160
- data/lib/active_record/connection_adapters/oracle_enhanced/schema_statements.rb +95 -133
- data/lib/active_record/connection_adapters/oracle_enhanced/schema_statements_ext.rb +3 -3
- data/lib/active_record/connection_adapters/oracle_enhanced/structure_dump.rb +66 -101
- data/lib/active_record/connection_adapters/oracle_enhanced/version.rb +1 -1
- data/lib/active_record/connection_adapters/oracle_enhanced_adapter.rb +290 -533
- data/lib/active_record/oracle_enhanced/type/boolean.rb +7 -10
- data/lib/active_record/oracle_enhanced/type/integer.rb +3 -4
- data/lib/active_record/oracle_enhanced/type/json.rb +8 -0
- data/lib/active_record/oracle_enhanced/type/national_character_string.rb +1 -1
- data/lib/active_record/oracle_enhanced/type/raw.rb +2 -3
- data/lib/active_record/oracle_enhanced/type/string.rb +2 -2
- data/lib/active_record/oracle_enhanced/type/text.rb +2 -2
- data/lib/active_record/oracle_enhanced/type/timestamptz.rb +23 -0
- data/lib/activerecord-oracle_enhanced-adapter.rb +2 -2
- data/spec/active_record/connection_adapters/oracle_enhanced_adapter_spec.rb +55 -162
- data/spec/active_record/connection_adapters/oracle_enhanced_connection_spec.rb +32 -34
- data/spec/active_record/connection_adapters/oracle_enhanced_context_index_spec.rb +44 -42
- data/spec/active_record/connection_adapters/oracle_enhanced_data_types_spec.rb +250 -357
- data/spec/active_record/connection_adapters/oracle_enhanced_database_tasks_spec.rb +14 -6
- data/spec/active_record/connection_adapters/oracle_enhanced_dbms_output_spec.rb +3 -5
- data/spec/active_record/connection_adapters/oracle_enhanced_dirty_spec.rb +115 -124
- data/spec/active_record/connection_adapters/oracle_enhanced_emulate_oracle_adapter_spec.rb +2 -3
- data/spec/active_record/connection_adapters/oracle_enhanced_procedures_spec.rb +68 -72
- data/spec/active_record/connection_adapters/oracle_enhanced_schema_dump_spec.rb +64 -80
- data/spec/active_record/connection_adapters/oracle_enhanced_schema_statements_spec.rb +223 -329
- data/spec/active_record/connection_adapters/oracle_enhanced_structure_dump_spec.rb +18 -20
- data/spec/spec_config.yaml.template +11 -0
- data/spec/spec_helper.rb +59 -59
- data/spec/support/alter_system_user_password.sql +2 -0
- data/spec/support/create_oracle_enhanced_users.sql +31 -0
- metadata +25 -25
- data/.rspec +0 -2
- data/Gemfile +0 -22
- data/RUNNING_TESTS.md +0 -83
- data/Rakefile +0 -45
- data/activerecord-oracle_enhanced-adapter.gemspec +0 -94
- data/lib/active_record/connection_adapters/oracle_enhanced/cpk.rb +0 -19
- data/spec/active_record/connection_adapters/oracle_enhanced_cpk_spec.rb +0 -113
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "digest/sha1"
|
2
2
|
|
3
3
|
module ActiveRecord
|
4
4
|
module ConnectionAdapters
|
@@ -80,10 +80,10 @@ module ActiveRecord
|
|
80
80
|
if supports_comments? && !supports_comments_in_create?
|
81
81
|
change_table_comment(table_name, comment) if comment
|
82
82
|
td.columns.each do |column|
|
83
|
-
change_column_comment(table_name, column.name, column.comment) if column.comment
|
83
|
+
change_column_comment(table_name, column.name, column.comment) if column.comment.present?
|
84
84
|
end
|
85
85
|
end
|
86
|
-
td.indexes.each { |c,o| add_index table_name, c, o }
|
86
|
+
td.indexes.each { |c, o| add_index table_name, c, o }
|
87
87
|
|
88
88
|
rebuild_primary_key_index_to_default_tablespace(table_name, options)
|
89
89
|
end
|
@@ -113,12 +113,8 @@ module ActiveRecord
|
|
113
113
|
self.all_schema_indexes = nil
|
114
114
|
end
|
115
115
|
|
116
|
-
def dump_schema_information #:nodoc:
|
117
|
-
super
|
118
|
-
end
|
119
|
-
|
120
116
|
def insert_versions_sql(versions) # :nodoc:
|
121
|
-
sm_table = quote_table_name(ActiveRecord::
|
117
|
+
sm_table = quote_table_name(ActiveRecord::SchemaMigration.table_name)
|
122
118
|
|
123
119
|
if supports_multi_insert?
|
124
120
|
versions.inject("INSERT ALL\n") { |sql, version|
|
@@ -137,18 +133,10 @@ module ActiveRecord
|
|
137
133
|
end
|
138
134
|
end
|
139
135
|
|
140
|
-
def initialize_schema_migrations_table
|
141
|
-
super
|
142
|
-
end
|
143
|
-
|
144
|
-
def update_table_definition(table_name, base) #:nodoc:
|
145
|
-
OracleEnhanced::Table.new(table_name, base)
|
146
|
-
end
|
147
|
-
|
148
136
|
def add_index(table_name, column_name, options = {}) #:nodoc:
|
149
137
|
index_name, index_type, quoted_column_names, tablespace, index_options = add_index_options(table_name, column_name, options)
|
150
138
|
execute "CREATE #{index_type} INDEX #{quote_column_name(index_name)} ON #{quote_table_name(table_name)} (#{quoted_column_names})#{tablespace} #{index_options}"
|
151
|
-
if index_type ==
|
139
|
+
if index_type == "UNIQUE"
|
152
140
|
unless quoted_column_names =~ /\(.*\)/
|
153
141
|
execute "ALTER TABLE #{quote_table_name(table_name)} ADD CONSTRAINT #{quote_column_name(index_name)} #{index_type} (#{quoted_column_names})"
|
154
142
|
end
|
@@ -173,29 +161,18 @@ module ActiveRecord
|
|
173
161
|
if index_name.to_s.length > max_index_length
|
174
162
|
raise ArgumentError, "Index name '#{index_name}' on table '#{table_name}' is too long; the limit is #{max_index_length} characters"
|
175
163
|
end
|
176
|
-
if index_name_exists?(table_name, index_name
|
164
|
+
if table_exists?(table_name) && index_name_exists?(table_name, index_name)
|
177
165
|
raise ArgumentError, "Index name '#{index_name}' on table '#{table_name}' already exists"
|
178
166
|
end
|
179
167
|
|
180
168
|
quoted_column_names = column_names.map { |e| quote_column_name_or_expression(e) }.join(", ")
|
181
|
-
|
169
|
+
[index_name, index_type, quoted_column_names, tablespace, index_options]
|
182
170
|
end
|
183
171
|
|
184
172
|
# Remove the given index from the table.
|
185
173
|
# Gives warning if index does not exist
|
186
174
|
def remove_index(table_name, options = {}) #:nodoc:
|
187
175
|
index_name = index_name_for_remove(table_name, options)
|
188
|
-
unless index_name_exists?(table_name, index_name, true)
|
189
|
-
# sometimes options can be String or Array with column names
|
190
|
-
options = {} unless options.is_a?(Hash)
|
191
|
-
if options.has_key? :name
|
192
|
-
options_without_column = options.dup
|
193
|
-
options_without_column.delete :column
|
194
|
-
index_name_without_column = index_name(table_name, options_without_column)
|
195
|
-
return index_name_without_column if index_name_exists?(table_name, index_name_without_column, false)
|
196
|
-
end
|
197
|
-
raise ArgumentError, "Index name '#{index_name}' on table '#{table_name}' does not exist"
|
198
|
-
end
|
199
176
|
#TODO: It should execute only when index_type == "UNIQUE"
|
200
177
|
execute "ALTER TABLE #{quote_table_name(table_name)} DROP CONSTRAINT #{quote_column_name(index_name)}" rescue nil
|
201
178
|
execute "DROP INDEX #{quote_column_name(index_name)}"
|
@@ -216,11 +193,11 @@ module ActiveRecord
|
|
216
193
|
|
217
194
|
# leave just first three letters from each word
|
218
195
|
if shortened_name.length > identifier_max_length
|
219
|
-
shortened_name = shortened_name.split(
|
196
|
+
shortened_name = shortened_name.split("_").map { |w| w[0, 3] }.join("_")
|
220
197
|
end
|
221
198
|
# generate unique name using hash function
|
222
199
|
if shortened_name.length > identifier_max_length
|
223
|
-
shortened_name =
|
200
|
+
shortened_name = "i" + Digest::SHA1.hexdigest(default_name)[0, identifier_max_length - 1]
|
224
201
|
end
|
225
202
|
@logger.warn "#{adapter_name} shortened default index name #{default_name} to #{shortened_name}" if @logger
|
226
203
|
shortened_name
|
@@ -232,7 +209,12 @@ module ActiveRecord
|
|
232
209
|
# as there's no way to determine the correct answer in that case.
|
233
210
|
#
|
234
211
|
# Will always query database and not index cache.
|
235
|
-
def index_name_exists?(table_name, index_name, default)
|
212
|
+
def index_name_exists?(table_name, index_name, default = nil)
|
213
|
+
unless default.nil?
|
214
|
+
ActiveSupport::Deprecation.warn(<<-MSG.squish)
|
215
|
+
Passing default to #index_name_exists? is deprecated without replacement.
|
216
|
+
MSG
|
217
|
+
end
|
236
218
|
(owner, table_name, db_link) = @connection.describe(table_name)
|
237
219
|
result = select_value(<<-SQL)
|
238
220
|
SELECT 1 FROM all_indexes#{db_link} i
|
@@ -245,31 +227,23 @@ module ActiveRecord
|
|
245
227
|
end
|
246
228
|
|
247
229
|
def rename_index(table_name, old_name, new_name) #:nodoc:
|
248
|
-
|
249
|
-
raise ArgumentError, "Index name '#{old_name}' on table '#{table_name}' does not exist"
|
250
|
-
end
|
251
|
-
if new_name.length > allowed_index_name_length
|
252
|
-
raise ArgumentError, "Index name '#{new_name}' on table '#{table_name}' is too long; the limit is #{allowed_index_name_length} characters"
|
253
|
-
end
|
230
|
+
validate_index_length!(table_name, new_name)
|
254
231
|
execute "ALTER INDEX #{quote_column_name(old_name)} rename to #{quote_column_name(new_name)}"
|
255
232
|
ensure
|
256
233
|
self.all_schema_indexes = nil
|
257
234
|
end
|
258
235
|
|
236
|
+
def add_reference(table_name, *args)
|
237
|
+
ActiveRecord::ConnectionAdapters::OracleEnhanced::ReferenceDefinition.new(*args).add_to(update_table_definition(table_name, self))
|
238
|
+
end
|
239
|
+
|
259
240
|
def add_column(table_name, column_name, type, options = {}) #:nodoc:
|
260
|
-
if type.to_sym == :virtual
|
261
|
-
type = options[:type]
|
262
|
-
end
|
263
241
|
type = aliased_types(type.to_s, type)
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
add_column_sql << tablespace_for((type_to_sql(type).downcase.to_sym), nil, table_name, column_name) if type
|
270
|
-
|
271
|
-
execute(add_column_sql)
|
272
|
-
|
242
|
+
at = create_alter_table table_name
|
243
|
+
at.add_column(column_name, type, options)
|
244
|
+
add_column_sql = schema_creation.accept at
|
245
|
+
add_column_sql << tablespace_for((type_to_sql(type).downcase.to_sym), nil, table_name, column_name)
|
246
|
+
execute add_column_sql
|
273
247
|
create_sequence_and_trigger(table_name, options) if type && type.to_sym == :primary_key
|
274
248
|
change_column_comment(table_name, column_name, options[:comment]) if options.key?(:comment)
|
275
249
|
ensure
|
@@ -294,7 +268,7 @@ module ActiveRecord
|
|
294
268
|
execute("UPDATE #{quote_table_name(table_name)} SET #{quote_column_name(column_name)}=#{quote(default)} WHERE #{quote_column_name(column_name)} IS NULL")
|
295
269
|
end
|
296
270
|
|
297
|
-
change_column table_name, column_name, column.sql_type, :
|
271
|
+
change_column table_name, column_name, column.sql_type, null: null
|
298
272
|
end
|
299
273
|
|
300
274
|
def change_column(table_name, column_name, type, options = {}) #:nodoc:
|
@@ -308,14 +282,15 @@ module ActiveRecord
|
|
308
282
|
if type.to_sym == :virtual
|
309
283
|
type = options[:type]
|
310
284
|
end
|
311
|
-
change_column_sql = "ALTER TABLE #{quote_table_name(table_name)} MODIFY #{quote_column_name(column_name)} "
|
312
|
-
change_column_sql << "#{type_to_sql(type, options[:limit], options[:precision], options[:scale])}" if type
|
313
|
-
|
314
|
-
add_column_options!(change_column_sql, options.merge(:type=>type, :column_name=>column_name, :table_name=>table_name))
|
315
|
-
|
316
|
-
change_column_sql << tablespace_for((type_to_sql(type).downcase.to_sym), nil, options[:table_name], options[:column_name]) if type
|
317
285
|
|
286
|
+
td = create_table_definition(table_name)
|
287
|
+
cd = td.new_column_definition(column.name, type, options)
|
288
|
+
change_column_stmt = schema_creation.accept cd
|
289
|
+
change_column_stmt << tablespace_for((type_to_sql(type).downcase.to_sym), nil, options[:table_name], options[:column_name]) if type
|
290
|
+
change_column_sql = "ALTER TABLE #{quote_table_name(table_name)} MODIFY #{change_column_stmt}"
|
318
291
|
execute(change_column_sql)
|
292
|
+
|
293
|
+
change_column_comment(table_name, column_name, options[:comment]) if options.key?(:comment)
|
319
294
|
ensure
|
320
295
|
clear_table_columns_cache(table_name)
|
321
296
|
end
|
@@ -366,9 +341,9 @@ module ActiveRecord
|
|
366
341
|
end
|
367
342
|
|
368
343
|
# Maps logical Rails types to Oracle-specific data types.
|
369
|
-
def type_to_sql(type, limit
|
344
|
+
def type_to_sql(type, limit: nil, precision: nil, scale: nil, **) #:nodoc:
|
370
345
|
# Ignore options for :text and :binary columns
|
371
|
-
return super(type
|
346
|
+
return super(type) if ["text", "binary"].include?(type.to_s)
|
372
347
|
|
373
348
|
super
|
374
349
|
end
|
@@ -382,28 +357,11 @@ module ActiveRecord
|
|
382
357
|
SQL
|
383
358
|
end
|
384
359
|
|
385
|
-
def add_foreign_key(from_table, to_table, options = {})
|
386
|
-
if options[:dependent]
|
387
|
-
ActiveSupport::Deprecation.warn "`:dependent` option will be deprecated. Please use `:on_delete` option"
|
388
|
-
end
|
389
|
-
case options[:dependent]
|
390
|
-
when :delete then options[:on_delete] = :cascade
|
391
|
-
when :nullify then options[:on_delete] = :nullify
|
392
|
-
else
|
393
|
-
end
|
394
|
-
|
395
|
-
super
|
396
|
-
end
|
397
|
-
|
398
|
-
def remove_foreign_key(from_table, options_or_to_table = {})
|
399
|
-
super
|
400
|
-
end
|
401
|
-
|
402
360
|
# get table foreign keys for schema dump
|
403
361
|
def foreign_keys(table_name) #:nodoc:
|
404
362
|
(owner, desc_table_name, db_link) = @connection.describe(table_name)
|
405
363
|
|
406
|
-
fk_info = select_all(<<-SQL,
|
364
|
+
fk_info = select_all(<<-SQL, "Foreign Keys")
|
407
365
|
SELECT r.table_name to_table
|
408
366
|
,rc.column_name references_column
|
409
367
|
,cc.column_name
|
@@ -412,7 +370,7 @@ module ActiveRecord
|
|
412
370
|
FROM all_constraints#{db_link} c, all_cons_columns#{db_link} cc,
|
413
371
|
all_constraints#{db_link} r, all_cons_columns#{db_link} rc
|
414
372
|
WHERE c.owner = '#{owner}'
|
415
|
-
AND c.table_name = '#{desc_table_name}'
|
373
|
+
AND c.table_name = q'[#{desc_table_name}]'
|
416
374
|
AND c.constraint_type = 'R'
|
417
375
|
AND cc.owner = c.owner
|
418
376
|
AND cc.constraint_name = c.constraint_name
|
@@ -426,19 +384,19 @@ module ActiveRecord
|
|
426
384
|
|
427
385
|
fk_info.map do |row|
|
428
386
|
options = {
|
429
|
-
column: oracle_downcase(row[
|
430
|
-
name: oracle_downcase(row[
|
431
|
-
primary_key: oracle_downcase(row[
|
387
|
+
column: oracle_downcase(row["column_name"]),
|
388
|
+
name: oracle_downcase(row["name"]),
|
389
|
+
primary_key: oracle_downcase(row["references_column"])
|
432
390
|
}
|
433
|
-
options[:on_delete] = extract_foreign_key_action(row[
|
434
|
-
|
391
|
+
options[:on_delete] = extract_foreign_key_action(row["delete_rule"])
|
392
|
+
ActiveRecord::ConnectionAdapters::ForeignKeyDefinition.new(oracle_downcase(table_name), oracle_downcase(row["to_table"]), options)
|
435
393
|
end
|
436
394
|
end
|
437
395
|
|
438
396
|
def extract_foreign_key_action(specifier) # :nodoc:
|
439
397
|
case specifier
|
440
|
-
when
|
441
|
-
when
|
398
|
+
when "CASCADE"; :cascade
|
399
|
+
when "SET NULL"; :nullify
|
442
400
|
end
|
443
401
|
end
|
444
402
|
|
@@ -465,48 +423,52 @@ module ActiveRecord
|
|
465
423
|
end
|
466
424
|
end
|
467
425
|
|
468
|
-
private
|
469
|
-
|
470
426
|
def create_alter_table(name)
|
471
|
-
OracleEnhanced::AlterTable.new create_table_definition(name, false, {})
|
427
|
+
ActiveRecord::ConnectionAdapters::OracleEnhanced::AlterTable.new create_table_definition(name, false, {})
|
472
428
|
end
|
473
429
|
|
474
|
-
def
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
430
|
+
def update_table_definition(table_name, base)
|
431
|
+
ActiveRecord::ConnectionAdapters::OracleEnhanced::Table.new(table_name, base)
|
432
|
+
end
|
433
|
+
|
434
|
+
private
|
435
|
+
|
436
|
+
def tablespace_for(obj_type, tablespace_option, table_name = nil, column_name = nil)
|
437
|
+
tablespace_sql = ""
|
438
|
+
if tablespace = (tablespace_option || default_tablespace_for(obj_type))
|
439
|
+
if [:blob, :clob].include?(obj_type.to_sym)
|
440
|
+
tablespace_sql << " LOB (#{quote_column_name(column_name)}) STORE AS #{column_name.to_s[0..10]}_#{table_name.to_s[0..14]}_ls (TABLESPACE #{tablespace})"
|
441
|
+
else
|
442
|
+
tablespace_sql << " TABLESPACE #{tablespace}"
|
443
|
+
end
|
481
444
|
end
|
445
|
+
tablespace_sql
|
482
446
|
end
|
483
|
-
tablespace_sql
|
484
|
-
end
|
485
447
|
|
486
|
-
|
487
|
-
|
488
|
-
|
448
|
+
def default_tablespace_for(type)
|
449
|
+
(default_tablespaces[type] || default_tablespaces[native_database_types[type][:name]]) rescue nil
|
450
|
+
end
|
489
451
|
|
490
|
-
|
491
|
-
|
492
|
-
|
452
|
+
def column_for(table_name, column_name)
|
453
|
+
unless column = columns(table_name).find { |c| c.name == column_name.to_s }
|
454
|
+
raise "No such column: #{table_name}.#{column_name}"
|
455
|
+
end
|
456
|
+
column
|
493
457
|
end
|
494
|
-
column
|
495
|
-
end
|
496
458
|
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
459
|
+
def create_sequence_and_trigger(table_name, options)
|
460
|
+
seq_name = options[:sequence_name] || default_sequence_name(table_name)
|
461
|
+
seq_start_value = options[:sequence_start_value] || default_sequence_start_value
|
462
|
+
execute "CREATE SEQUENCE #{quote_table_name(seq_name)} START WITH #{seq_start_value}"
|
501
463
|
|
502
|
-
|
503
|
-
|
464
|
+
create_primary_key_trigger(table_name, options) if options[:primary_key_trigger]
|
465
|
+
end
|
504
466
|
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
467
|
+
def create_primary_key_trigger(table_name, options)
|
468
|
+
seq_name = options[:sequence_name] || default_sequence_name(table_name)
|
469
|
+
trigger_name = options[:trigger_name] || default_trigger_name(table_name)
|
470
|
+
primary_key = options[:primary_key] || Base.get_primary_key(table_name.to_s.singularize)
|
471
|
+
execute compress_lines(<<-SQL)
|
510
472
|
CREATE OR REPLACE TRIGGER #{quote_table_name(trigger_name)}
|
511
473
|
BEFORE INSERT ON #{quote_table_name(table_name)} FOR EACH ROW
|
512
474
|
BEGIN
|
@@ -517,28 +479,28 @@ module ActiveRecord
|
|
517
479
|
END IF;
|
518
480
|
END;
|
519
481
|
SQL
|
520
|
-
|
482
|
+
end
|
521
483
|
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
484
|
+
def default_trigger_name(table_name)
|
485
|
+
# truncate table name if necessary to fit in max length of identifier
|
486
|
+
"#{table_name.to_s[0, table_name_length - 4]}_pkt"
|
487
|
+
end
|
526
488
|
|
527
|
-
|
528
|
-
|
489
|
+
def rebuild_primary_key_index_to_default_tablespace(table_name, options)
|
490
|
+
tablespace = default_tablespace_for(:index)
|
529
491
|
|
530
|
-
|
492
|
+
return unless tablespace
|
531
493
|
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
494
|
+
index_name = Base.connection.select_value(
|
495
|
+
"SELECT index_name FROM all_constraints
|
496
|
+
WHERE table_name = #{quote(table_name.upcase)}
|
497
|
+
AND constraint_type = 'P'
|
498
|
+
AND owner = SYS_CONTEXT('userenv', 'current_schema')")
|
537
499
|
|
538
|
-
|
500
|
+
return unless index_name
|
539
501
|
|
540
|
-
|
541
|
-
|
502
|
+
execute("ALTER INDEX #{quote_column_name(index_name)} REBUILD TABLESPACE #{tablespace}")
|
503
|
+
end
|
542
504
|
end
|
543
505
|
end
|
544
506
|
end
|
@@ -16,7 +16,7 @@ module ActiveRecord
|
|
16
16
|
# # ...
|
17
17
|
# end
|
18
18
|
#
|
19
|
-
def add_primary_key_trigger(table_name, options={})
|
19
|
+
def add_primary_key_trigger(table_name, options = {})
|
20
20
|
# call the same private method that is used for create_table :primary_key_trigger => true
|
21
21
|
create_primary_key_trigger(table_name, options)
|
22
22
|
end
|
@@ -50,8 +50,8 @@ module ActiveRecord
|
|
50
50
|
# get synonyms for schema dump
|
51
51
|
def synonyms #:nodoc:
|
52
52
|
select_all("SELECT synonym_name, table_owner, table_name, db_link FROM all_synonyms where owner = SYS_CONTEXT('userenv', 'session_user')").collect do |row|
|
53
|
-
OracleEnhanced::SynonymDefinition.new(oracle_downcase(row[
|
54
|
-
oracle_downcase(row[
|
53
|
+
OracleEnhanced::SynonymDefinition.new(oracle_downcase(row["synonym_name"]),
|
54
|
+
oracle_downcase(row["table_owner"]), oracle_downcase(row["table_name"]), oracle_downcase(row["db_link"]))
|
55
55
|
end
|
56
56
|
end
|
57
57
|
end
|