ALTER TABLE TBAPI
    ADD CLIENTE_TIPO_ID INTEGER,
    ADD CLIENTE_SUB_TIPO_ID INTEGER;

ALTER TABLE TBAPI
    ADD REPRESENTANTE_ID INTEGER;

CREATE TABLE TBAPI_DE_PARA (
    ID INTEGER NOT NULL,
    API_ID INTEGER,
    TABELA VARCHAR(50),
    DE VARCHAR(50),
    PARA VARCHAR(50),
    TIPO INTEGER);

ALTER TABLE TBAPI_DE_PARA
ADD CONSTRAINT PK_TBAPI_DE_PARA
PRIMARY KEY (ID);

CREATE SEQUENCE GTBAPI_DE_PARA;

create trigger ttbapi_de_para_b01i for tbapi_de_para
active before insert position 0
as
begin
  if (new.id is null) then
    new.id = gen_id(gtbapi_de_para,1);
end;
