From 5ef25fd0b6bb4b1024dd82c2bfa016dad5708462 Mon Sep 17 00:00:00 2001 From: Brooke Kuhlmann Date: Wed, 1 Apr 2026 16:28:01 -0600 Subject: [PATCH] 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 --- ...632_alter_model_width_and_height_defaults.rb | 17 +++++++++++++++++ config/db/structure.sql | 7 ++++--- 2 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 config/db/migrate/20260401162632_alter_model_width_and_height_defaults.rb diff --git a/config/db/migrate/20260401162632_alter_model_width_and_height_defaults.rb b/config/db/migrate/20260401162632_alter_model_width_and_height_defaults.rb new file mode 100644 index 00000000..6e48ae5e --- /dev/null +++ b/config/db/migrate/20260401162632_alter_model_width_and_height_defaults.rb @@ -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 diff --git a/config/db/structure.sql b/config/db/structure.sql index 242f403a..98117271 100644 --- a/config/db/structure.sql +++ b/config/db/structure.sql @@ -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');