/******************************************************************************/
/****              Generated by IBExpert 06/03/2024 08:08:01               ****/
/******************************************************************************/

/******************************************************************************/
/****     Following SET SQL DIALECT is just for the Database Comparer      ****/
/******************************************************************************/
SET SQL DIALECT 3;



/******************************************************************************/
/****                                Tables                                ****/
/******************************************************************************/


CREATE GENERATOR GTBPERFIL_PEDIDO_CAMPOS;

CREATE TABLE TBPERFIL_PEDIDO_CAMPOS (
    PERFIL           			VARCHAR(10),
    ID               			INTEGER NOT NULL,
    PREVISAO_PRODUCAO			VARCHAR(1) DEFAULT '1',
    VENDEDOR					VARCHAR(1) DEFAULT '1',
    VENDEDOR_COMISSAO			VARCHAR(1) DEFAULT '1',
    MOEDA						VARCHAR(1) DEFAULT '1',
    VALOR_FRETE					VARCHAR(1) DEFAULT '1',
    PROGRAMADO					VARCHAR(1) DEFAULT '1',
    DATA_CLIENTE				VARCHAR(1) DEFAULT '1',
    CODIGO_RASTREIO				VARCHAR(1) DEFAULT '1',
    CTE							VARCHAR(1) DEFAULT '1',
    EMAIL_XML					VARCHAR(1) DEFAULT '1',
    OBSERVACAO					VARCHAR(1) DEFAULT '1',
    CIDADE						VARCHAR(1) DEFAULT '1',
    CLIENTE_AMOSTRA				VARCHAR(1) DEFAULT '1',
    CORRETOR					VARCHAR(1) DEFAULT '1',
    CANAL_VENDAS				VARCHAR(1) DEFAULT '1',
    COMISSAO_SUPERVISOR			VARCHAR(1) DEFAULT '1',
    EXIBIR_DATA_BASE_VENCIMENTO	VARCHAR(1) DEFAULT '1',
    STATUS_LIBERACAO			VARCHAR(1) DEFAULT '1',
    PRIORIDADE_ATENDIMENTO		VARCHAR(1) DEFAULT '0'
);




/******************************************************************************/
/****                             Primary keys                             ****/
/******************************************************************************/

ALTER TABLE TBPERFIL_PEDIDO_CAMPOS ADD PRIMARY KEY (ID);


/******************************************************************************/
/****                               Triggers                               ****/
/******************************************************************************/



SET TERM ^ ;



/******************************************************************************/
/****                         Triggers for tables                          ****/
/******************************************************************************/



/* Trigger: TTBPERFIL_PEDIDO_CAMPOS_B0I */
CREATE OR ALTER TRIGGER TTBPERFIL_PEDIDO_CAMPOS_B0I FOR TBPERFIL_PEDIDO_CAMPOS
ACTIVE BEFORE INSERT POSITION 2
AS
BEGIN
  IF (NEW.ID IS NULL) THEN
  BEGIN
    NEW.ID = GEN_ID(GTBPERFIL_PEDIDO_CAMPOS,1);
  END
END
^

SET TERM ; ^



/******************************************************************************/
/****                              Privileges                              ****/
/******************************************************************************/


/* Privileges of users */
GRANT SELECT ON MON$ATTACHMENTS TO PUBLIC;
GRANT SELECT ON MON$CALL_STACK TO PUBLIC;
GRANT SELECT ON MON$CONTEXT_VARIABLES TO PUBLIC;
GRANT SELECT ON MON$DATABASE TO PUBLIC;
GRANT SELECT ON MON$IO_STATS TO PUBLIC;
GRANT SELECT ON MON$MEMORY_USAGE TO PUBLIC;
GRANT SELECT ON MON$RECORD_STATS TO PUBLIC;
GRANT SELECT ON MON$STATEMENTS TO PUBLIC;
GRANT SELECT ON MON$TABLE_STATS TO PUBLIC;
GRANT SELECT ON MON$TRANSACTIONS TO PUBLIC;