USE [VIGIL-VA]
GO

-- Update table schema and database parameters here.

IF (SELECT version FROM table_version WHERE entity = 'vacounter') < 1
	ALTER TABLE vacounter ADD details nvarchar(2000) NULL
GO

IF (SELECT version FROM table_version WHERE entity = 'va_alarms') < 1
	ALTER TABLE va_alarms ADD details nvarchar(2000) NULL
GO

DROP VIEW [dbo].[vw_vacounter]
GO

CREATE VIEW [dbo].[vw_vacounter] AS SELECT * FROM vacounter
GO

DROP VIEW [dbo].[vw_va_alarms]
GO

CREATE VIEW [dbo].[vw_va_alarms] AS SELECT * FROM va_alarms
GO


-- Update login
IF (SELECT version FROM table_version WHERE entity = 'db') < 11000000
BEGIN
	ALTER LOGIN [va] WITH PASSWORD = 0x0200C54FF874013CEC11629503E30FE0FEB96A6D7307C9AFAFFC528E6C0BF462DD6D93EC92FE01A43CEF3332BAE5163E641F69687F551D5EE5DB1BB6E25A61D486D79C822F51 HASHED
END
GO
