impress/db/migrate/20241116041926_increase_id_limits.rb
Emi Matchu 1d1dc15320 Remove some more incorrect limits on ID fields in the database
I'm running into this with the automated tests and the fixtures I think
sometimes using large auto-generated IDs?

But the point is, our tables generally use Rails's default `:integer`
size for its IDs, and then columns that reference them are *smaller*,
which is… not correct stuff, y'know?

So I figure, let's just expand the columns. We don't have enough data
that being real picky about the integer sizes matters, so let's keep it
simple and more obviously correct.
2024-11-15 20:39:38 -08:00

21 lines
952 B
Ruby

class IncreaseIdLimits < ActiveRecord::Migration[7.2]
def change
reversible do |direction|
direction.up do
change_column :parents_swf_assets, :parent_id, :integer, null: false
change_column :parents_swf_assets, :swf_asset_id, :integer, null: false
change_column :pet_states, :pet_type_id, :integer, null: false
change_column :pets, :pet_type_id, :integer, null: false
change_column :swf_assets, :zone_id, :integer, null: false
end
direction.down do
change_column :parents_swf_assets, :parent_id, :integer, limit: 3, null: false
change_column :parents_swf_assets, :swf_asset_id, :integer, limit: 3, null: false
change_column :pet_states, :pet_type_id, :integer, limit: 3, null: false
change_column :pets, :pet_type_id, :integer, limit: 3, null: false
change_column :swf_assets, :zone_id, :integer, limit: 1, null: false
end
end
end
end