CREATE TABLE CHAT (
ID_CHAT INTEGER NOT NULL PRIMARY KEY,
ID_USUARIO_ENVIO VARCHAR(10),
ID_USUARIO_RECEB VARCHAR(10),
MENSAGEM VARCHAR(250),
DATA DATE,
HORA TIME,
LIDA CHAR(1)
);

CREATE GENERATOR GEN_ID_CHAT;

SET TERM ^;

CREATE TRIGGER TRIG_GEN_ID_CHAT FOR CHAT
ACTIVE BEFORE INSERT POSITION 0
AS
BEGIN
   NEW.ID_CHAT = gen_id(GEN_ID_CHAT,1);
END
^

COMMIT WORK^
SET TERM;^

UPDATE PARAMETROS SET SCRIPT = '095';
