Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validate table name length when renaming #1080

Merged
merged 1 commit into from
Aug 17, 2023
Merged

Conversation

aidanharan
Copy link
Contributor

@aidanharan aidanharan commented Aug 17, 2023

Validate table name length when renaming. In SQL Server if you use more than 128 characters for the new name, only the first 128 characters are used and the rest is truncated.

Ref: https://learn.microsoft.com/en-us/sql/relational-databases/system-stored-procedures/sp-rename-transact-sql?view=sql-server-ver16

Fixes:

Failure:
ActiveRecord::Migration::RenameTableTest#test_rename_table_raises_for_long_table_names [/usr/local/bundle/bundler/gems/rails-7f8cdb1dc3ae/activerecord/test/cases/migration/rename_table_test.rb:58]:
ArgumentError expected but nothing was raised.

bin/rails test /usr/local/bundle/bundler/gems/rails-7f8cdb1dc3ae/activerecord/test/cases/migration/rename_table_test.rb:53

@aidanharan aidanharan marked this pull request as ready for review August 17, 2023 14:51
@aidanharan aidanharan merged commit 6cf056b into main Aug 17, 2023
0 of 8 checks passed
@aidanharan aidanharan deleted the rename-table-validation branch August 17, 2023 14:51
lavika pushed a commit to lavika/activerecord-sqlserver-adapter that referenced this pull request Sep 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant