Skip to content

Instantly share code, notes, and snippets.

@afcapel
Created November 8, 2018 20:06
Show Gist options
  • Save afcapel/5111895daafedb087171bfc8a3b56fa2 to your computer and use it in GitHub Desktop.
Save afcapel/5111895daafedb087171bfc8a3b56fa2 to your computer and use it in GitHub Desktop.
Rails.application.eager_load!
ActiveRecord::Base.descendants.each do |model|
next unless model.table_exists?
model.columns.each do |col|
next unless col.name =~ /_?id\Z/
if col.type == :integer && col.sql_type != "bigint"
puts "#{model.table_name} #{col.name} is of type #{col.sql_type} but should be bigint"
end
end
end; nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment