
CREATE TABLE l2s_chat_canal
(
  cnl_codigo serial NOT NULL,
  cnl_nome character varying(40) NOT NULL,
  cnl_provedor character varying(30) NOT NULL,
  cnl_servidor character varying(150),
  cnl_numero_telefone character varying(20) NOT NULL,
  cnl_usuario character varying(120),
  cnl_senha character varying(120),
  cnl_token_acesso character varying(200),
  CONSTRAINT l2s_chat_canal_pkey PRIMARY KEY (cnl_codigo)
)
WITH (
  OIDS=FALSE
);

CREATE TABLE l2s_chat_conversa
(
  con_codigo serial NOT NULL,
  con_origem character varying(120) NOT NULL,
  con_ultima_mensagem_recebida text,
  con_ultima_mensagem_enviada text,
  con_dh_ultima_recebida timestamp without time zone NOT NULL,
  rob_codigo integer NOT NULL,
  cnl_codigo integer NOT NULL,
  con_robo_sessao character varying(200) NOT NULL,
  CONSTRAINT l2s_chat_conversa_pkey PRIMARY KEY (con_codigo)
)
WITH (
  OIDS=FALSE
);

CREATE TABLE l2s_chat_robo_automacao
(
  rob_codigo serial NOT NULL,
  rob_nome character varying(60) NOT NULL,
  rob_provedor character varying(40) NOT NULL,
  rob_servidor character varying(120),
  rob_client_id character varying(150) NOT NULL,
  rob_client_secret character varying(150) NOT NULL,
  rob_projeto character varying(80),
  rob_refresh_token character varying(200),
  rob_access_token character varying(200),
  rob_expira_em timestamp without time zone,
  CONSTRAINT l2s_chat_robo_automacao_pkey PRIMARY KEY (rob_codigo)
)
WITH (
  OIDS=FALSE
);