diff --git a/config/db/migrate/20260126141642_alter_device_table_model_id_as_non_null.rb b/config/db/migrate/20260126141642_alter_device_table_model_id_as_non_null.rb new file mode 100644 index 00000000..31cd30ea --- /dev/null +++ b/config/db/migrate/20260126141642_alter_device_table_model_id_as_non_null.rb @@ -0,0 +1,6 @@ +# frozen_string_literal: true + +ROM::SQL.migration do + up { alter_table(:device) { set_column_not_null :model_id } } + down { alter_table(:device) { set_column_allow_null :model_id } } +end diff --git a/config/db/structure.sql b/config/db/structure.sql index f42f3c10..fac0b2ff 100644 --- a/config/db/structure.sql +++ b/config/db/structure.sql @@ -236,7 +236,7 @@ CREATE TABLE public.device ( firmware_update boolean DEFAULT true CONSTRAINT devices_firmware_update_not_null NOT NULL, sleep_start_at time without time zone, sleep_stop_at time without time zone, - model_id integer, + model_id integer NOT NULL, playlist_id integer ); @@ -1316,4 +1316,5 @@ INSERT INTO schema_migrations (filename) VALUES ('20251201105349_alter_model_firmware_columns.rb'), ('20251211152911_drop_model_published_at_column.rb'), ('20251215154654_add_playlist_mode_enum.rb'), -('20260106144016_alter_firmware_kind.rb'); +('20260106144016_alter_firmware_kind.rb'), +('20260126141642_alter_device_table_model_id_as_non_null.rb');