mirror of
https://github.com/usetrmnl/terminus.git
synced 2026-08-13 14:29:27 -07:00
Added migration for screen extension ID foreign key
Necessary to improve referential integrity by associating extensions with screens. Issue: 360 Milestone: minor
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
ROM::SQL.migration do
|
||||
change do
|
||||
alter_table :screen do
|
||||
add_foreign_key :extension_id, :extension, on_update: :cascade, on_delete: :set_null
|
||||
end
|
||||
end
|
||||
end
|
||||
+12
-2
@@ -761,7 +761,8 @@ CREATE TABLE public.screen (
|
||||
updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
||||
device_id integer,
|
||||
kind public.screen_kind_enum DEFAULT 'general'::public.screen_kind_enum NOT NULL,
|
||||
template_id integer
|
||||
template_id integer,
|
||||
extension_id integer
|
||||
);
|
||||
|
||||
|
||||
@@ -1657,6 +1658,14 @@ ALTER TABLE ONLY public.screen
|
||||
ADD CONSTRAINT screen_device_id_fkey FOREIGN KEY (device_id) REFERENCES public.device(id) ON UPDATE CASCADE ON DELETE SET NULL;
|
||||
|
||||
|
||||
--
|
||||
-- Name: screen screen_extension_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.screen
|
||||
ADD CONSTRAINT screen_extension_id_fkey FOREIGN KEY (extension_id) REFERENCES public.extension(id) ON UPDATE CASCADE ON DELETE SET NULL;
|
||||
|
||||
|
||||
--
|
||||
-- Name: screen screen_model_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
||||
--
|
||||
@@ -1806,4 +1815,5 @@ INSERT INTO schema_migrations (filename) VALUES
|
||||
('20260714090149_add_device_api_key_column.rb'),
|
||||
('20260721160734_add_device_command_column.rb'),
|
||||
('20260721160742_rename_device_log_function_columan_as_command.rb'),
|
||||
('20260805142625_alter_screen_device_id_constraint.rb');
|
||||
('20260805142625_alter_screen_device_id_constraint.rb'),
|
||||
('20260810100653_add_screen_extension_id_column.rb');
|
||||
|
||||
Reference in New Issue
Block a user