INSERT INTO {databaseOwner}{objectQualifier}DMX_Addons (AddonKey, Availability, Description, Installed, Name)
VALUES ('Core', 'All', 'Core', GETDATE(), 'Core')

GO


INSERT INTO {databaseOwner}{objectQualifier}DMX_LogTypes (LogTypeKey, Phrase, Notification)
VALUES ('Add', 'Added', 1)

GO

INSERT INTO {databaseOwner}{objectQualifier}DMX_LogTypes (LogTypeKey, Phrase, Notification)
VALUES ('Approve', 'Approved', 1)

GO

INSERT INTO {databaseOwner}{objectQualifier}DMX_LogTypes (LogTypeKey, Phrase, Notification)
VALUES ('Delete', 'Deleted', 1)

GO

INSERT INTO {databaseOwner}{objectQualifier}DMX_LogTypes (LogTypeKey, Phrase, Notification)
VALUES ('Download', 'Downloaded', 0)

GO

INSERT INTO {databaseOwner}{objectQualifier}DMX_LogTypes (LogTypeKey, Phrase, Notification)
VALUES ('Edit', 'Edited', 1)

GO

INSERT INTO {databaseOwner}{objectQualifier}DMX_LogTypes (LogTypeKey, Phrase, Notification)
VALUES ('Import', 'Imported', 1)

GO

INSERT INTO {databaseOwner}{objectQualifier}DMX_LogTypes (LogTypeKey, Phrase, Notification)
VALUES ('Lock', 'Locked', 0)

GO

INSERT INTO {databaseOwner}{objectQualifier}DMX_LogTypes (LogTypeKey, Phrase, Notification)
VALUES ('Move', 'Moved', 1)

GO

INSERT INTO {databaseOwner}{objectQualifier}DMX_LogTypes (LogTypeKey, Phrase, Notification)
VALUES ('Rollback', 'Rolled back', 1)

GO

INSERT INTO {databaseOwner}{objectQualifier}DMX_LogTypes (LogTypeKey, Phrase, Notification)
VALUES ('Subscribe', 'Subscribed to', 0)

GO

INSERT INTO {databaseOwner}{objectQualifier}DMX_LogTypes (LogTypeKey, Phrase, Notification)
VALUES ('Undelete', 'Undeleted', 1)

GO

INSERT INTO {databaseOwner}{objectQualifier}DMX_LogTypes (LogTypeKey, Phrase, Notification)
VALUES ('Unlock', 'Unlocked', 0)

GO

INSERT INTO {databaseOwner}{objectQualifier}DMX_LogTypes (LogTypeKey, Phrase, Notification)
VALUES ('Unsubscribe', 'Unsubscribed to', 0)

GO

INSERT INTO {databaseOwner}{objectQualifier}DMX_LogTypes (LogTypeKey, Phrase, Notification)
VALUES ('Upload', 'Uploaded', 1)

GO


if not exists (select * from dbo.sysobjects where id = object_id(N'FK_{objectQualifier}DMX_Log_{objectQualifier}DMX_LogTypes') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE {databaseOwner}{objectQualifier}DMX_Log ADD CONSTRAINT
	FK_{objectQualifier}DMX_Log_{objectQualifier}DMX_LogTypes FOREIGN KEY
	(
    Operation
	) REFERENCES {databaseOwner}{objectQualifier}DMX_LogTypes
	(
    LogTypeKey
	) ON DELETE NO ACTION
	 NOT FOR REPLICATION

GO



DELETE
FROM {databaseOwner}{objectQualifier}ModuleControls
WHERE ((ControlKey is null) and (ControlSrc = 'DesktopModules/DMX/DMX.ascx'))

GO

DELETE
FROM {databaseOwner}{objectQualifier}ModuleControls
WHERE ((ControlKey = 'Download') and (ControlSrc = 'DesktopModules/DMX/DMXDownload.ascx'))

GO

DELETE
FROM {databaseOwner}{objectQualifier}ModuleControls
WHERE ((ControlKey = 'EditDoc') and (ControlSrc = 'DesktopModules/DMX/DMXEdit.ascx'))

GO

DELETE
FROM {databaseOwner}{objectQualifier}ModuleControls
WHERE ((ControlKey = 'EntryDetails') and (ControlSrc = 'DesktopModules/DMX/DMXEntry.ascx'))

GO

