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

[idea] improve length of constraint name for safe_change_column_null #291

Closed
Roguelazer opened this issue Jan 28, 2025 · 1 comment
Closed

Comments

@Roguelazer
Copy link
Contributor

Roguelazer commented Jan 28, 2025

The safe version of change_column_null automatically generates a constraint of the form "#{table}_#{column}_null"; for wordy table and column names, this can easily exceed the 64-character constraint name length limit enforced by PostgreSQL. Ideally, we could do one of the following:

  1. Always use a short constraint name (for example, strong_migrations_#{SecureRandom.uuid.delete "-"}); ideally this constraint shouldn't ever actually be seen or interacted with by a human
  2. OR allow the migration to specify a custom constraint name as a kwarg

Thoughts?

@Roguelazer Roguelazer changed the title improve length of constraint name for safe_change_column_null [idea] improve length of constraint name for safe_change_column_null Jan 28, 2025
@ankane ankane closed this as completed in 241631e Jan 29, 2025
@ankane
Copy link
Owner

ankane commented Jan 29, 2025

Hi @Roguelazer, thanks for reporting. I don't think this is common, but fixed in the commit above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants