Added model migration for updated width and height defaults

Instead of _not_ having defaults for these values, we'll use zeros for width and height which ensures the types remains valid while also indicating these values need updating. The down migration ensures zeros are used in order to preserve the type as well.

Milestone: minor
This commit is contained in:
Brooke Kuhlmann
2026-04-02 08:25:43 -06:00
parent efe820d76d
commit 5ef25fd0b6
2 changed files with 21 additions and 3 deletions
@@ -0,0 +1,17 @@
# frozen_string_literal: true
ROM::SQL.migration do
up do
alter_table :model do
set_column_default :width, 0
set_column_default :height, 0
end
end
down do
alter_table :model do
set_column_default :width, 0
set_column_default :height, 0
end
end
end
+4 -3
View File
@@ -523,8 +523,8 @@ CREATE TABLE public.model (
name text NOT NULL,
label text NOT NULL,
description text,
width integer NOT NULL,
height integer NOT NULL,
width integer DEFAULT 0 NOT NULL,
height integer DEFAULT 0 NOT NULL,
mime_type text DEFAULT 'image/png'::text NOT NULL,
colors integer DEFAULT 2 NOT NULL,
bit_depth integer DEFAULT 1 NOT NULL,
@@ -1542,4 +1542,5 @@ INSERT INTO schema_migrations (filename) VALUES
('20260318132419_add_palette.rb'),
('20260330115025_add_extension_mode_column.rb'),
('20260330145138_alter_device_battery_columns.rb'),
('20260331102522_add_device_wake_reason_column.rb');
('20260331102522_add_device_wake_reason_column.rb'),
('20260401162632_alter_model_width_and_height_defaults.rb');