CREATE TABLE public.script_log ( id serial NOT NULL, md5sum char(32) NOT NULL, source text NOT NULL, CONSTRAINT script_log_pk PRIMARY KEY (id) ); CREATE TABLE public.execution ( id serial NOT NULL, time_start timestamptz NULL, script_log_id int4 NOT NULL, "data" jsonb NOT NULL, ssh varchar NOT NULL, time_end timestamptz NULL, output_stdout text NULL, output_stderr text NULL, exitcode int NULL, CONSTRAINT execution_pk PRIMARY KEY (id), CONSTRAINT execution_script_log_fk FOREIGN KEY (script_log_id) REFERENCES public.script_log(id) ON DELETE RESTRICT ON UPDATE RESTRICT );