This commit is contained in:
Magnus Åhall 2025-07-16 10:50:31 +02:00
parent b7fa4c5c94
commit ba7375fe15
2 changed files with 53 additions and 0 deletions

18
sql/0010.sql Normal file
View file

@ -0,0 +1,18 @@
CREATE TABLE public.script (
id serial NOT NULL,
name varchar NOT NULL,
"source" text NOT NULL,
updated timestamptz DEFAULT NOW() NOT NULL,
CONSTRAINT script_pk PRIMARY KEY (id),
CONSTRAINT script_unique_name UNIQUE (name)
);
CREATE TABLE public."execute" (
id serial NOT NULL,
node_id int4 NOT NULL,
script_id int4 NOT NULL,
ssh varchar DEFAULT '' NOT NULL,
CONSTRAINT execute_pk PRIMARY KEY (id),
CONSTRAINT execute_node_fk FOREIGN KEY (node_id) REFERENCES public.node(id) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT execute_script_fk FOREIGN KEY (script_id) REFERENCES public.script(id) ON DELETE CASCADE ON UPDATE CASCADE
);