CREATE TABLE TBREDE_MERCHANT (
    ID INTEGER NOT NULL,
    MERCHANT_ID INTEGER,
    REGISTER_ID INTEGER,
    STATUS VARCHAR(10),
    ADQUIRENTE_ID INTEGER,
    DATA TIMESTAMP,
    ACCESS_TOKEN VARCHAR(300),
    AUTHORIZATION_CODE VARCHAR(300),
    REFRESH_TOKEN VARCHAR(300),
    EXPIRES_IN TIMESTAMP);

ALTER TABLE TBREDE_MERCHANT
ADD CONSTRAINT PK_TBREDE_MERCHANT
PRIMARY KEY (ID);

CREATE SEQUENCE GTBREDE_MERCHANT;

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

ALTER TABLE TBCIELO_MERCHANT
    ADD ACCESS_TOKEN VARCHAR(300),
    ADD AUTHORIZATION_CODE VARCHAR(300),
    ADD REFRESH_TOKEN VARCHAR(300),
    ADD EXPIRES_IN TIMESTAMP;

ALTER TABLE TBCIELO_MERCHANT ADD CLIENTE_ID INTEGER;

