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.
This commit is contained in:
parent
b6c21dfe40
commit
1d1dc15320
2 changed files with 27 additions and 6 deletions
21
db/migrate/20241116041926_increase_id_limits.rb
Normal file
21
db/migrate/20241116041926_increase_id_limits.rb
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
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
|
12
db/schema.rb
12
db/schema.rb
|
@ -10,7 +10,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema[7.2].define(version: 2024_11_16_031655) do
|
ActiveRecord::Schema[7.2].define(version: 2024_11_16_041926) do
|
||||||
create_table "alt_styles", charset: "utf8mb4", collation: "utf8mb4_unicode_520_ci", force: :cascade do |t|
|
create_table "alt_styles", charset: "utf8mb4", collation: "utf8mb4_unicode_520_ci", force: :cascade do |t|
|
||||||
t.integer "species_id", null: false
|
t.integer "species_id", null: false
|
||||||
t.integer "color_id", null: false
|
t.integer "color_id", null: false
|
||||||
|
@ -196,8 +196,8 @@ ActiveRecord::Schema[7.2].define(version: 2024_11_16_031655) do
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "parents_swf_assets", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_520_ci", force: :cascade do |t|
|
create_table "parents_swf_assets", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_520_ci", force: :cascade do |t|
|
||||||
t.integer "parent_id", limit: 3, null: false
|
t.integer "parent_id", null: false
|
||||||
t.integer "swf_asset_id", limit: 3, null: false
|
t.integer "swf_asset_id", null: false
|
||||||
t.string "parent_type", limit: 8, null: false
|
t.string "parent_type", limit: 8, null: false
|
||||||
t.index ["parent_id", "parent_type"], name: "index_parents_swf_assets_on_parent_id_and_parent_type"
|
t.index ["parent_id", "parent_type"], name: "index_parents_swf_assets_on_parent_id_and_parent_type"
|
||||||
t.index ["parent_id", "swf_asset_id"], name: "unique_parents_swf_assets", unique: true
|
t.index ["parent_id", "swf_asset_id"], name: "unique_parents_swf_assets", unique: true
|
||||||
|
@ -211,7 +211,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_11_16_031655) do
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "pet_states", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_520_ci", force: :cascade do |t|
|
create_table "pet_states", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_520_ci", force: :cascade do |t|
|
||||||
t.integer "pet_type_id", limit: 3, null: false
|
t.integer "pet_type_id", null: false
|
||||||
t.text "swf_asset_ids", size: :medium, null: false
|
t.text "swf_asset_ids", size: :medium, null: false
|
||||||
t.boolean "female"
|
t.boolean "female"
|
||||||
t.integer "mood_id"
|
t.integer "mood_id"
|
||||||
|
@ -240,7 +240,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_11_16_031655) do
|
||||||
|
|
||||||
create_table "pets", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_520_ci", force: :cascade do |t|
|
create_table "pets", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_520_ci", force: :cascade do |t|
|
||||||
t.string "name", limit: 20, null: false
|
t.string "name", limit: 20, null: false
|
||||||
t.integer "pet_type_id", limit: 3, null: false
|
t.integer "pet_type_id", null: false
|
||||||
t.index ["name"], name: "pets_name", unique: true
|
t.index ["name"], name: "pets_name", unique: true
|
||||||
t.index ["pet_type_id"], name: "pets_pet_type_id"
|
t.index ["pet_type_id"], name: "pets_pet_type_id"
|
||||||
end
|
end
|
||||||
|
@ -253,7 +253,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_11_16_031655) do
|
||||||
t.string "type", limit: 7, null: false
|
t.string "type", limit: 7, null: false
|
||||||
t.integer "remote_id", limit: 3, null: false
|
t.integer "remote_id", limit: 3, null: false
|
||||||
t.text "url", size: :long, null: false
|
t.text "url", size: :long, null: false
|
||||||
t.integer "zone_id", limit: 1, null: false
|
t.integer "zone_id", null: false
|
||||||
t.text "zones_restrict", size: :medium, null: false
|
t.text "zones_restrict", size: :medium, null: false
|
||||||
t.datetime "created_at", precision: nil, null: false
|
t.datetime "created_at", precision: nil, null: false
|
||||||
t.integer "body_id", limit: 2, null: false
|
t.integer "body_id", limit: 2, null: false
|
||||||
|
|
Loading…
Reference in a new issue