mirror of
https://github.com/usetrmnl/terminus.git
synced 2026-08-13 14:29:27 -07:00
Added screen template migration
Necessary to manage screen templates (i.e. HTML source) code associated with a screen. This will allow folks to save various iterations of their designs to produce different screens. Issue: 321 Milestone: minor
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
ROM::SQL.migration do
|
||||
change do
|
||||
create_table :screen_template do
|
||||
primary_key :id
|
||||
|
||||
column :name, String, unique: true, index: true, null: false
|
||||
column :label, String, unique: true, null: false
|
||||
column :content, :text, null: false
|
||||
column :created_at, :timestamp, null: false, default: Sequel::CURRENT_TIMESTAMP
|
||||
column :updated_at, :timestamp, null: false, default: Sequel::CURRENT_TIMESTAMP
|
||||
end
|
||||
end
|
||||
end
|
||||
+61
-1
@@ -776,6 +776,34 @@ ALTER TABLE public.screen ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
|
||||
);
|
||||
|
||||
|
||||
--
|
||||
-- Name: screen_template; Type: TABLE; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE TABLE public.screen_template (
|
||||
id integer NOT NULL,
|
||||
name text NOT NULL,
|
||||
label text NOT NULL,
|
||||
content text NOT NULL,
|
||||
created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
||||
updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL
|
||||
);
|
||||
|
||||
|
||||
--
|
||||
-- Name: screen_template_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE public.screen_template ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
|
||||
SEQUENCE NAME public.screen_template_id_seq
|
||||
START WITH 1
|
||||
INCREMENT BY 1
|
||||
NO MINVALUE
|
||||
NO MAXVALUE
|
||||
CACHE 1
|
||||
);
|
||||
|
||||
|
||||
--
|
||||
-- Name: user; Type: TABLE; Schema: public; Owner: -
|
||||
--
|
||||
@@ -1134,6 +1162,30 @@ ALTER TABLE ONLY public.screen
|
||||
ADD CONSTRAINT screen_pkey PRIMARY KEY (id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: screen_template screen_template_label_key; Type: CONSTRAINT; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.screen_template
|
||||
ADD CONSTRAINT screen_template_label_key UNIQUE (label);
|
||||
|
||||
|
||||
--
|
||||
-- Name: screen_template screen_template_name_key; Type: CONSTRAINT; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.screen_template
|
||||
ADD CONSTRAINT screen_template_name_key UNIQUE (name);
|
||||
|
||||
|
||||
--
|
||||
-- Name: screen_template screen_template_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.screen_template
|
||||
ADD CONSTRAINT screen_template_pkey PRIMARY KEY (id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: user_active_session_key user_active_session_key_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
||||
--
|
||||
@@ -1416,6 +1468,13 @@ CREATE INDEX screen_image_data_index ON public.screen USING gin (image_data);
|
||||
CREATE UNIQUE INDEX screen_model_id_name_index ON public.screen USING btree (model_id, name);
|
||||
|
||||
|
||||
--
|
||||
-- Name: screen_template_name_index; Type: INDEX; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE INDEX screen_template_name_index ON public.screen_template USING btree (name);
|
||||
|
||||
|
||||
--
|
||||
-- Name: user_email_index; Type: INDEX; Schema: public; Owner: -
|
||||
--
|
||||
@@ -1715,4 +1774,5 @@ INSERT INTO schema_migrations (filename) VALUES
|
||||
('20260602112926_add_device_profile_and_compatibility_columns.rb'),
|
||||
('20260608161124_add_device_wifi_band_column.rb'),
|
||||
('20260609142235_add_screen_device_id_and_kind_columns.rb'),
|
||||
('20260610103052_remove_device_api_key_and_friendly_id_columns.rb');
|
||||
('20260610103052_remove_device_api_key_and_friendly_id_columns.rb'),
|
||||
('20260615094348_create_screen_template.rb');
|
||||
|
||||
Reference in New Issue
Block a user