CREATE TABLE `surveilr_osquery_ms_distributed_query` (
`query_id` text PRIMARY KEY NOT NULL,
`node_key` text NOT NULL,
`query_name` text NOT NULL,
`query_sql` text NOT NULL,
`discovery_query` text,
`status` text NOT NULL,
`elaboration` text,
`interval` integer NOT NULL,
`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 (`node_key`) REFERENCES `surveilr_osquery_ms_node`(`node_key`) ON UPDATE no action ON DELETE no action
)