-- CREATION OF TBTESTE_CALENDARIO TABLE 09/01/2024
CREATE TABLE TBTESTE_CALENDARIO (
    ID INTEGER NOT NULL,
    DESCRICAO VARCHAR(50),
    STATUS INTEGER DEFAULT 1,
    OBSERVACAO VARCHAR(100),
    VALOR INTEGER,
    QUANTIDADE NUMERIC(15,2),
    DATA DATE);

ALTER TABLE TBTESTE_CALENDARIO
ADD CONSTRAINT PK_TBTESTE_CALENDARIO
PRIMARY KEY (ID);

CREATE SEQUENCE GTBTESTE_CALENDARIO;

SET TERM ^ ;

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

SET TERM ; ^

-- ALTERATION OF TBTESTE_CALENDARIO TABLE ADDING ROLES_ID COLUMN/FIELD 11/01/2024
ALTER TABLE TBTESTE_CALENDARIO
    ADD ROLES_ID VARCHAR(50);


-- ALTERATION OF TBTESTE_CALENDARIO TABLE CASTING THE ROLES_ID COLUMN/FIELD LIKE AN INTEGER 11/01/2024
ALTER TABLE TBTESTE_CALENDARIO
    ADD ROLES_ID INTEGER;



