-- dbo._hdc_ph_Log
IF OBJECT_ID(N'dbo._hdc_ph_Log', N'U') IS NULL
 CREATE TABLE dbo._hdc_ph_Log (
  ID int IDENTITY(1, 1) NOT NULL,
  LogText nvarchar(500) NULL,
  Typ tinyint NULL,
  IntValue int NULL,
  NumValue numeric(19, 6) NULL,
  StrValue nvarchar(255) NULL,
  DatValue datetime NULL,
  ForMail BIT NOT NULL DEFAULT 0,
  MailSent DATETIME NULL,
  IdJsonData INT NULL,
  Autor nvarchar(80) DEFAULT suser_sname() NOT NULL,
  DatPorizeni datetime DEFAULT getdate() NOT NULL,
  PRIMARY KEY (ID DESC)
 )


/* 14.11.2023 */
IF COL_LENGTH(N'dbo._hdc_ph_Log', N'ForMail') IS NULL ALTER TABLE dbo._hdc_ph_Log ADD ForMail BIT NOT NULL DEFAULT 0
IF COL_LENGTH(N'dbo._hdc_ph_Log', N'MailSent') IS NULL ALTER TABLE dbo._hdc_ph_Log ADD MailSent DATETIME NULL
IF COL_LENGTH(N'dbo._hdc_ph_Log', N'IdJsonData') IS NULL ALTER TABLE dbo._hdc_ph_Log ADD IdJsonData INT NULL

