CREATE TABLE public.script (
	id serial NOT NULL,
	"group" varchar 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
);
