Skip to content

Commit

Permalink
Fix rename_table
Browse files Browse the repository at this point in the history
  • Loading branch information
JesseChavez committed Aug 6, 2024
1 parent 23bf16c commit 68fbc0b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/arjdbc/mssql/schema_statements.rb
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,12 @@ def drop_table(table_name, **options)
end
end

def rename_table(table_name, new_table_name)
execute "EXEC sp_rename '#{table_name}', '#{new_table_name}'"
rename_table_indexes(table_name, new_table_name)
def rename_table(table_name, new_name, **options)
validate_table_length!(new_name) unless options[:_uses_legacy_table_name]
schema_cache.clear_data_source_cache!(table_name.to_s)
schema_cache.clear_data_source_cache!(new_name.to_s)
execute "EXEC sp_rename '#{table_name}', '#{new_name}'"
rename_table_indexes(table_name, new_name)
end

# This is the same as the abstract method
Expand Down

0 comments on commit 68fbc0b

Please sign in to comment.