CREATE TABLE TBPOWER_BI_PAINEL (
    ID INTEGER NOT NULL,
    DESCRICAO VARCHAR(200),
    URL VARCHAR(1500),
    STATUS INTEGER);

ALTER TABLE TBPOWER_BI_PAINEL
ADD CONSTRAINT PK_TBPOWER_BI_PAINEL
PRIMARY KEY (ID);

CREATE SEQUENCE GTBPOWER_BI_PAINEL;

SET TERM ^ ;

create trigger ttbpower_bi_painel_b01i for tbpower_bi_painel
active before insert position 0
as
begin
  if (new.id is null) then
    new.id = gen_id(gtbpower_bi_painel,1);
end
^

SET TERM ; ^

INSERT INTO TBPOWER_BI_PAINEL (ID, DESCRICAO, URL, STATUS)
                       VALUES (1, 'Vendas', 'https://app.powerbi.com/view?r=eyJrIjoiNmU3NThmODUtMzVmYS00ZmU0LWJhODEtM2EyMzA0N2EwZDA5IiwidCI6IjQ3MDFhNTA2LTllY2QtNGI0OS1hNjdmLWYyMzQxZWJhNTczZSJ9', 1);

CREATE TABLE TBPOWER_BI_PAINEL_USUARIO (
    ID INTEGER NOT NULL,
    USUARIO_ID INTEGER,
    POWER_BI_PAINEL_ID INTEGER);

ALTER TABLE TBPOWER_BI_PAINEL_USUARIO
ADD CONSTRAINT PK_TBPOWER_BI_PAINEL_USUARIO
PRIMARY KEY (ID);

CREATE SEQUENCE GTBPOWER_BI_PAINEL_USUARIO;

