CREATE TABLE commandlog (

cmdid integer NOT NULL,

cmdtime bigint NOT NULL,

cmdstatus character varying(20),

commandname character varying(100),

commandowner character varying(50),

commandtype character varying(20),

devicename character varying(100),

devicetype character varying(50),

loginid integer DEFAULT (-1) NOT NULL

);



CREATE SEQUENCE commandlog_cmdid_seq

START WITH 1

INCREMENT BY 1

NO MINVALUE

NO MAXVALUE

CACHE 1;


ALTER TABLE ONLY commandlog ALTER COLUMN cmdid SET DEFAULT nextval('commandlog_cmdid_seq'::regclass);

SELECT pg_catalog.setval('commandlog_cmdid_seq', 1, true);

ALTER TABLE ONLY commandlog
ADD CONSTRAINT commandlog_pkey PRIMARY KEY (cmdid);
