File tree Expand file tree Collapse file tree 2 files changed +38
-2
lines changed
lib/active_record/connection_adapters/oracle_enhanced
spec/active_record/connection_adapters/oracle_enhanced Expand file tree Collapse file tree 2 files changed +38
-2
lines changed Original file line number Diff line number Diff line change @@ -252,7 +252,7 @@ def primary_key(*args)
252
252
rebuild_primary_key_index_to_default_tablespace ( table_name , options )
253
253
end
254
254
255
- def rename_table ( table_name , new_name ) # :nodoc:
255
+ def rename_table ( table_name , new_name , ** options ) # :nodoc:
256
256
if new_name . to_s . length > DatabaseLimits ::IDENTIFIER_MAX_LENGTH
257
257
raise ArgumentError , "New table name '#{ new_name } ' is too long; the limit is #{ DatabaseLimits ::IDENTIFIER_MAX_LENGTH } characters"
258
258
end
@@ -261,7 +261,7 @@ def rename_table(table_name, new_name) # :nodoc:
261
261
execute "RENAME #{ quote_table_name ( table_name ) } TO #{ quote_table_name ( new_name ) } "
262
262
execute "RENAME #{ quote_table_name ( "#{ table_name } _seq" ) } TO #{ default_sequence_name ( new_name ) } " rescue nil
263
263
264
- rename_table_indexes ( table_name , new_name )
264
+ rename_table_indexes ( table_name , new_name , ** options )
265
265
end
266
266
267
267
def drop_table ( table_name , **options ) # :nodoc:
Original file line number Diff line number Diff line change
1
+ # frozen_string_literal: true
2
+
3
+ describe "compatibility migrations" do
4
+ include SchemaSpecHelper
5
+
6
+ before ( :all ) do
7
+ ActiveRecord ::Base . establish_connection ( CONNECTION_PARAMS )
8
+ @conn = ActiveRecord ::Base . connection
9
+ schema_define do
10
+ create_table :test_employees , force : true
11
+ end
12
+ end
13
+
14
+ after ( :all ) do
15
+ schema_define do
16
+ drop_table :test_employees , if_exists : true
17
+ drop_table :new_test_employees , if_exists : true
18
+ end
19
+ end
20
+
21
+ it "should rename table on 7_0 and below" do
22
+ migration = Class . new ( ActiveRecord ::Migration [ 7.0 ] ) {
23
+ def change
24
+ rename_table :test_employees , :new_test_employees
25
+ end
26
+ } . new
27
+
28
+ migration . migrate ( :up )
29
+ expect ( @conn . table_exists? ( :new_test_employees ) ) . to be_truthy
30
+ expect ( @conn . table_exists? ( :test_employees ) ) . not_to be_truthy
31
+
32
+ migration . migrate ( :down )
33
+ expect ( @conn . table_exists? ( :new_test_employees ) ) . not_to be_truthy
34
+ expect ( @conn . table_exists? ( :test_employees ) ) . to be_truthy
35
+ end
36
+ end
You can’t perform that action at this time.
0 commit comments