CREATE TABLE TBPOLITICA_ARQ_METADATA (
    ID INTEGER NOT NULL,
    TIPO INTEGER NOT NULL,
    SUBTIPO INTEGER);

ALTER TABLE TBPOLITICA_ARQ_METADATA
ADD CONSTRAINT PK_TBPOLITICA_ARQ_METADATA
PRIMARY KEY (ID);

COMMENT ON COLUMN TBPOLITICA_ARQ_METADATA.TIPO IS
'1 -  Politicas Publicas; 2 - Políticas Internas';

COMMENT ON COLUMN TBPOLITICA_ARQ_METADATA.SUBTIPO IS
'1 - Politicas Publicas / RH; 2 - Politicas Publicas / SI';

CREATE SEQUENCE GTBPOLITICA_ARQ_METADATA;

SET TERM ^ ;

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

SET TERM ; ^

