Heureka database upgrade script 0.5.4.4: Difference between revisions
Jump to navigation
Jump to search
New page: Back to scripts <pre> </pre> Category:Database |
No edit summary |
||
| (3 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
[[ | [[:Category:database scripts | Back to scripts]] | ||
<pre> | <pre> | ||
IF (SELECT COUNT(*) FROM VERSION WHERE ApplicationVersion = '0.5.4.3') = 0 | |||
BEGIN | |||
PRINT 'Wrong Version of database. You must upgrade to version 0.5.4.3 before running this script.'; | |||
SELECT ApplicationVersion FROM VERSION; | |||
END | |||
ELSE | |||
BEGIN | |||
-- 2. Update columns in Stratification | |||
IF EXISTS(SELECT * FROM Stratification WHERE ModifiedDate IS NULL) | |||
BEGIN | |||
UPDATE [dbo].[Stratification] SET | |||
ModifiedDate = CreatedDate, | |||
ModifiedBy = CreatedBy | |||
ALTER TABLE [dbo].[Stratification] ALTER COLUMN [ModifiedDate] [datetime] NOT NULL; | |||
ALTER TABLE [dbo].[Stratification] ALTER COLUMN [ModifiedBy] [varchar](50) NOT NULL; | |||
END | |||
-- Update version | |||
UPDATE Version SET ApplicationVersion = '0.5.4.4'; | |||
PRINT 'Success! Database upgrade to version 0.5.4.4'; | |||
END | |||
</pre> | </pre> | ||
[[Category:Database]] | [[Category:Database scripts]] | ||
Latest revision as of 14:44, 14 July 2009
IF (SELECT COUNT(*) FROM VERSION WHERE ApplicationVersion = '0.5.4.3') = 0 BEGIN PRINT 'Wrong Version of database. You must upgrade to version 0.5.4.3 before running this script.'; SELECT ApplicationVersion FROM VERSION; END ELSE BEGIN -- 2. Update columns in Stratification IF EXISTS(SELECT * FROM Stratification WHERE ModifiedDate IS NULL) BEGIN UPDATE [dbo].[Stratification] SET ModifiedDate = CreatedDate, ModifiedBy = CreatedBy ALTER TABLE [dbo].[Stratification] ALTER COLUMN [ModifiedDate] [datetime] NOT NULL; ALTER TABLE [dbo].[Stratification] ALTER COLUMN [ModifiedBy] [varchar](50) NOT NULL; END -- Update version UPDATE Version SET ApplicationVersion = '0.5.4.4'; PRINT 'Success! Database upgrade to version 0.5.4.4'; END