/******************************************************************************/
/****              Generated by IBExpert 25/08/2021 11:17:47               ****/
/******************************************************************************/

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



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


CREATE GENERATOR GTBPERFIL_PEDIDO_COLUNAS;

CREATE TABLE TBPERFIL_PEDIDO_COLUNAS (
    PERFIL          VARCHAR(10),
    ID              INTEGER NOT NULL,
    SALDO_FATURAR   VARCHAR(1) DEFAULT '1',
    PRODUZIR        VARCHAR(1) DEFAULT '1',
    EMPRODUCAO      VARCHAR(1) DEFAULT '1',
    ALOCADO         VARCHAR(1) DEFAULT '1',
    QTD_AGP         VARCHAR(1) DEFAULT '1',
    EST_MIN   		VARCHAR(1) DEFAULT '1',
    CODIGO_EDI  	VARCHAR(1) DEFAULT '1',
	LOCALIZACAO 	VARCHAR(1) DEFAULT '1',
	VALOR_ACRESCIMO	VARCHAR(1) DEFAULT '1',
	VALOR_IPI 		VARCHAR(1) DEFAULT '1',
	VALOR_DESCONTO  VARCHAR(1) DEFAULT '1',
	EAN				VARCHAR(1) DEFAULT '1',
	PERFIL_SKU		VARCHAR(1) DEFAULT '1'
);

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

ALTER TABLE TBPERFIL_PEDIDO_COLUNAS ADD PRIMARY KEY (ID);

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