IF NOT EXISTS (SELECT 1 FROM sys.columns WHERE name = N'UpdateTimestamp' AND Object_ID = Object_ID(N'LD0P0DocumentTranscripts')
BEGIN
ALTER TABLE LD0P0DocumentTranscripts
ADD UpdateTimestamp DATETIME2 NULL
END
GO

IF NOT EXISTS (SELECT 1 FROM sys.columns WHERE name = N'Notify' AND Object_ID = Object_ID(N'LD0P0DocumentTranscripts'))
BEGIN
ALTER TABLE LD0P0DocumentTranscripts ADD Notify DATETIME2 NULL CONSTRAINT [LD0D0DocumentTranscr_Notify] DEFAULT 0 NOT NULL
END


GO
IF NOT EXISTS (SELECT 1 FROM sys.columns WHERE name = N'TranscriptStatus' AND Object_ID = Object_ID(N'LD0P0DocumentTranscripts'))
BEGIN
ALTER TABLE LD0P0DocumentTranscripts ADD TranscriptStatus DATETIME2 NULL CONSTRAINT [LD0D0DocumentTranscr_TranscriptStatus] DEFAULT 0 NOT NULL
END
GO
CREATE OR ALTER VIEW LD0V0DocumentTranscripts AS
SELECT Id
      ,DOKUMENTNR
      ,AudioId
      ,Transcript
      ,CreateTimestamp
	  ,Summary
      ,UpdateTimestamp
      ,Notify
      ,TranscriptStatus
  FROM LD0P0DocumentTranscripts
  