CREATE TABLE `orchestration_session` (
`orchestration_session_id` text PRIMARY KEY NOT NULL,
`device_id` text NOT NULL,
`orchestration_nature_id` text NOT NULL,
`version` text NOT NULL,
`orch_started_at` TIMESTAMPTZ,
`orch_finished_at` TIMESTAMPTZ,
`elaboration` text,
`args_json` text,
`diagnostics_json` text,
`diagnostics_md` text,
FOREIGN KEY (`device_id`) REFERENCES `device`(`device_id`) ON UPDATE no action ON DELETE no action,
FOREIGN KEY (`orchestration_nature_id`) REFERENCES `orchestration_nature`(`orchestration_nature_id`) ON UPDATE no action ON DELETE no action,
CONSTRAINT "elaboration_check_valid_json" CHECK(json_valid("orchestration_session"."elaboration") OR "orchestration_session"."elaboration" IS NULL),
CONSTRAINT "args_json_check_valid_json" CHECK(json_valid("orchestration_session"."args_json") OR "orchestration_session"."args_json" IS NULL),
CONSTRAINT "diagnostics_json_check_valid_json" CHECK(json_valid("orchestration_session"."diagnostics_json") OR "orchestration_session"."diagnostics_json" IS NULL)
)