CREATE SCHEMA if not exists ueba_analysis_schema;
CREATE TABLE if not EXISTS ueba_analysis_schema.logs (
    id SERIAL,
    menu VARCHAR(50),
	interface VARCHAR(300),
    ip INET,
    account VARCHAR(30),
    jobnum VARCHAR(30), 
    count int,
    logdate date NOT NULL,
    company VARCHAR(30),
    data_type int)
	PARTITION BY RANGE (logdate);
CREATE TABLE if not EXISTS ueba_analysis_schema.jobs (
        job_id VARCHAR(50),
        start_time TIMESTAMP ,
        end_time TIMESTAMP ,
        status int,
        run_count int,
        created_at TIMESTAMP  DEFAULT  NOW(),
        complate_time TIMESTAMP,
        err text
    );
CREATE INDEX if not exists idx_logdate_data_type ON ueba_analysis_schema.logs (logdate,data_type);
CREATE INDEX if not exists idx_job_id ON ueba_analysis_schema.jobs (job_id);
