CREATE TABLE `ur_ingest_session_udi_pgp_sql` (
`ur_ingest_session_udi_pgp_sql_id` text PRIMARY KEY NOT NULL,
`sql` text NOT NULL,
`nature` text NOT NULL,
`content` blob,
`behaviour` text,
`query_error` text,
`uniform_resource_id` text,
`ingest_session_id` text,
`created_at` TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP,
`created_by` text DEFAULT 'UNKNOWN',
`updated_at` TIMESTAMPTZ,
`updated_by` text,
`deleted_at` TIMESTAMPTZ,
`deleted_by` text,
`activity_log` text,
FOREIGN KEY (`uniform_resource_id`) REFERENCES `uniform_resource`(`uniform_resource_id`) ON UPDATE no action ON DELETE no action,
FOREIGN KEY (`ingest_session_id`) REFERENCES `ur_ingest_session`(`ur_ingest_session_id`) ON UPDATE no action ON DELETE no action,
CONSTRAINT "behaviour_check_valid_json" CHECK(json_valid("ur_ingest_session_udi_pgp_sql"."behaviour") OR "ur_ingest_session_udi_pgp_sql"."behaviour" IS NULL)
)