-
Notifications
You must be signed in to change notification settings - Fork 125
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
Ensure id and *_id columns are bigint #248
Conversation
0f34e78
to
c6dd3e0
Compare
"network_ports.binding_host_id", | ||
"scan_histories.task_id", # <--WAT? | ||
"sessions.session_id" | ||
].freeze |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor, but maybe make this a Set, since we are doing continual lookups
As discussed, the tests fail and tell the user to remove the column from the exclusion list when they fix it. Also, the exclusions_list should be a constant like in the other PR> |
9c8c25f
to
264b7d0
Compare
264b7d0
to
971e9b5
Compare
Checked commit bdunne@971e9b5 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0 |
it "should be type bigint" do | ||
ActiveRecord::Base.connection.tables.each do |table| | ||
next if ManageIQ::Schema::SYSTEM_TABLES.include?(table) | ||
DatabaseHelper.columns_for_table(table).each do |column| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moving forward, perhaps this should move into a DatabaseHelper method...
def DatabaseHelper.each_table
ActiveRecord::Base.connection.tables.each do |table|
next if ManageIQ::Schema::SYSTEM_TABLES.include?(table)
yield table
end
end
def DatabaseHelper.each_column
each_table do |table|
columns_for_table(table).each do |column|
yield table, column
end
end
end
Then caller just does
DatabaseHelper.each_column do |table, column|
...
end
Based on changes in #245
Adding this as an automated code review to address #4 (comment)