--FARMAGOI-18213
IF OBJECT_ID('INTEGRA_PROPZ_EVENTOS') IS NULL
BEGIN 
CREATE TABLE INTEGRA_PROPZ_EVENTOS (
  ID			uniqueidentifier NOT NULL DEFAULT newid(),
  TABELA		nvarchar(128) NOT NULL,
  CD_EMP		int NULL,
  CD_FILIAL		int NULL,
  CD_REGISTRO	int NOT NULL,
  TP_EVENTO		int NOT NULL,
  HR_EVENTO		datetime NOT NULL DEFAULT getdate(),
  ST_EVENTO		int NOT NULL DEFAULT (0),
  DT_ULT_ALT	datetime NULL,
  CD_USU		int NULL,
  DT_DOCUMENTO	datetime NOT NULL,
  APP_NAME		varchar(100) NULL DEFAULT app_name(),
  IP_CLIENTE	varchar(100) NULL DEFAULT CONVERT(varchar, connectionproperty('client_net_address')),
  HOST_NAME		varchar(100) NULL DEFAULT host_name(),
  CONSTRAINT PK_INTEGRA_PROPZ_EVENTOS PRIMARY KEY CLUSTERED (ID ASC)
) ON [PRIMARY]
END 

GO

IF OBJECT_ID('INTEGRA_PROPZ_LOG') IS NULL
BEGIN 
CREATE TABLE [dbo].[INTEGRA_PROPZ_LOG] (
  [ID] [uniqueidentifier] NOT NULL DEFAULT newid(),
  [ID_EVENTO] [uniqueidentifier] NOT NULL,
  [DT_PROCESSAMENTO] [datetime] NOT NULL DEFAULT getdate(),
  [MENSAGEM] [text] NULL,
  [RESPOSTA] [text] NULL,
  CONSTRAINT [PK_INTEGRA_PROPZ_LOG] PRIMARY KEY CLUSTERED ([ID] ASC)
) ON [PRIMARY]
END 


