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

New cop that detects foreign key-like columns with incorrect types #1264

Open
fatkodima opened this issue Mar 28, 2024 · 0 comments
Open

New cop that detects foreign key-like columns with incorrect types #1264

fatkodima opened this issue Mar 28, 2024 · 0 comments

Comments

@fatkodima
Copy link
Contributor

Fortunately, rails since 5.1 adds foreign key columns (like post_id) with bigint types (or the type explicitly configured by the application). This works implicitly when adding them by add_reference helper. But people sometimes add columns via add_column or t.column or t.integer, so this can lead to incorrect (like integer) types columns. I saw a couple of offences in my application.

I want to propose a cop that detects such cases based on the configured type (bigint by default), but can be configured via some cop's option.

@koic Are you open for this?

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

1 participant