-
Notifications
You must be signed in to change notification settings - Fork 255
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into feature/bookmark-800-82
- Loading branch information
Showing
15 changed files
with
9,326 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
CSETWebApi/CSETWeb_Api/CSETWebCore.UpgradeLibrary/VersionUpgrader/ConvertDatabase12026.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
//////////////////////////////// | ||
// | ||
// Copyright 2023 Battelle Energy Alliance, LLC | ||
// | ||
// | ||
//////////////////////////////// | ||
using System; | ||
using Microsoft.Data.SqlClient; | ||
using System.IO; | ||
namespace UpgradeLibrary.Upgrade | ||
{ | ||
internal class ConvertDatabase12026 : ConvertSqlDatabase | ||
{ | ||
public ConvertDatabase12026(string path) : base(path) | ||
{ | ||
myVersion = new Version("12.0.2.6"); | ||
} | ||
|
||
/// <summary> | ||
/// Runs the database update script | ||
/// </summary> | ||
/// <param name="conn"></param> | ||
public override void Execute(SqlConnection conn) | ||
{ | ||
try | ||
{ | ||
RunFile(Path.Combine(this.applicationPath, "VersionUpgrader", "SQL", "12025_to_12026.sql"), conn); | ||
RunFile(Path.Combine(this.applicationPath, "VersionUpgrader", "SQL", "12025_to_12026_data.sql"), conn); | ||
|
||
this.UpgradeToVersionLocalDB(conn, myVersion); | ||
} | ||
catch (Exception e) | ||
{ | ||
throw new DatabaseUpgradeException("Error in upgrading database version 12.0.2.5 to 12.0.2.6: " + e.Message); | ||
} | ||
} | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
CSETWebApi/CSETWeb_Api/CSETWebCore.UpgradeLibrary/VersionUpgrader/ConvertDatabase12027.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
//////////////////////////////// | ||
// | ||
// Copyright 2023 Battelle Energy Alliance, LLC | ||
// | ||
// | ||
//////////////////////////////// | ||
using System; | ||
using Microsoft.Data.SqlClient; | ||
using System.IO; | ||
namespace UpgradeLibrary.Upgrade | ||
{ | ||
internal class ConvertDatabase12027 : ConvertSqlDatabase | ||
{ | ||
public ConvertDatabase12027(string path) : base(path) | ||
{ | ||
myVersion = new Version("12.0.2.7"); | ||
} | ||
|
||
/// <summary> | ||
/// Runs the database update script | ||
/// </summary> | ||
/// <param name="conn"></param> | ||
public override void Execute(SqlConnection conn) | ||
{ | ||
try | ||
{ | ||
RunFile(Path.Combine(this.applicationPath, "VersionUpgrader", "SQL", "12026_to_12027_data.sql"), conn); | ||
|
||
this.UpgradeToVersionLocalDB(conn, myVersion); | ||
} | ||
catch (Exception e) | ||
{ | ||
throw new DatabaseUpgradeException("Error in upgrading database version 12.0.2.6 to 12.0.2.7: " + e.Message); | ||
} | ||
} | ||
} | ||
} |
109 changes: 109 additions & 0 deletions
109
CSETWebApi/CSETWeb_Api/CSETWebCore.UpgradeLibrary/VersionUpgrader/SQL/12025_to_12026.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
/* | ||
Run this script on: | ||
(localdb)\INLLocalDb2022.CSETWeb12025 - This database will be modified | ||
to synchronize it with: | ||
(localdb)\INLLocalDb2022.CSETWeb12026 | ||
You are recommended to back up your database before running this script | ||
Script created by SQL Compare version 14.10.9.22680 from Red Gate Software Ltd at 8/14/2023 5:25:17 PM | ||
*/ | ||
SET NUMERIC_ROUNDABORT OFF | ||
GO | ||
SET ANSI_PADDING, ANSI_WARNINGS, CONCAT_NULL_YIELDS_NULL, ARITHABORT, QUOTED_IDENTIFIER, ANSI_NULLS ON | ||
GO | ||
SET XACT_ABORT ON | ||
GO | ||
SET TRANSACTION ISOLATION LEVEL Serializable | ||
GO | ||
BEGIN TRANSACTION | ||
GO | ||
IF @@ERROR <> 0 SET NOEXEC ON | ||
GO | ||
PRINT N'Altering [dbo].[SECTOR]' | ||
GO | ||
IF @@ERROR <> 0 SET NOEXEC ON | ||
GO | ||
ALTER TABLE [dbo].[SECTOR] ADD | ||
[Is_NIPP] [bit] NOT NULL CONSTRAINT [DF__SECTOR__Is_NIPP__4C214075] DEFAULT ((0)), | ||
[NIPP_sector] [int] NULL | ||
GO | ||
IF @@ERROR <> 0 SET NOEXEC ON | ||
GO | ||
PRINT N'Altering [dbo].[SECTOR_INDUSTRY]' | ||
GO | ||
IF @@ERROR <> 0 SET NOEXEC ON | ||
GO | ||
ALTER TABLE [dbo].[SECTOR_INDUSTRY] ADD | ||
[Is_NIPP] [bit] NOT NULL CONSTRAINT [DF__SECTOR_IN__Is_NI__4D1564AE] DEFAULT ((0)), | ||
[Is_Other] [bit] NOT NULL CONSTRAINT [DF__SECTOR_IN__Is_Ot__4E0988E7] DEFAULT ((0)), | ||
[NIPP_subsector] [int] NULL | ||
GO | ||
IF @@ERROR <> 0 SET NOEXEC ON | ||
GO | ||
PRINT N'Creating [dbo].[DETAILS_DEMOGRAPHICS]' | ||
GO | ||
CREATE TABLE [dbo].[DETAILS_DEMOGRAPHICS] | ||
( | ||
[Assessment_Id] [int] NOT NULL, | ||
[DataItemName] [nvarchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, | ||
[StringValue] [nvarchar] (max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, | ||
[IntValue] [int] NULL, | ||
[FloatValue] [float] NULL, | ||
[BoolValue] [bit] NULL, | ||
[DateTimeValue] [datetime] NULL | ||
) | ||
GO | ||
IF @@ERROR <> 0 SET NOEXEC ON | ||
GO | ||
PRINT N'Creating primary key [PK_DETAILS_DEMOGRAPHICS] on [dbo].[DETAILS_DEMOGRAPHICS]' | ||
GO | ||
ALTER TABLE [dbo].[DETAILS_DEMOGRAPHICS] ADD CONSTRAINT [PK_DETAILS_DEMOGRAPHICS] PRIMARY KEY CLUSTERED ([Assessment_Id], [DataItemName]) | ||
GO | ||
IF @@ERROR <> 0 SET NOEXEC ON | ||
GO | ||
PRINT N'Creating [dbo].[DETAILS_DEMOGRAPHICS_OPTIONS]' | ||
GO | ||
CREATE TABLE [dbo].[DETAILS_DEMOGRAPHICS_OPTIONS] | ||
( | ||
[Option_Id] [int] NOT NULL IDENTITY(1, 1), | ||
[DataItemName] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, | ||
[Sequence] [int] NOT NULL, | ||
[OptionValue] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, | ||
[OptionText] [nvarchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL | ||
) | ||
GO | ||
IF @@ERROR <> 0 SET NOEXEC ON | ||
GO | ||
PRINT N'Creating primary key [PK_DETAIL_DEMOG_OPTIONS] on [dbo].[DETAILS_DEMOGRAPHICS_OPTIONS]' | ||
GO | ||
ALTER TABLE [dbo].[DETAILS_DEMOGRAPHICS_OPTIONS] ADD CONSTRAINT [PK_DETAIL_DEMOG_OPTIONS] PRIMARY KEY CLUSTERED ([Option_Id]) | ||
GO | ||
IF @@ERROR <> 0 SET NOEXEC ON | ||
GO | ||
COMMIT TRANSACTION | ||
GO | ||
IF @@ERROR <> 0 SET NOEXEC ON | ||
GO | ||
-- This statement writes to the SQL Server Log so SQL Monitor can show this deployment. | ||
IF HAS_PERMS_BY_NAME(N'sys.xp_logevent', N'OBJECT', N'EXECUTE') = 1 | ||
BEGIN | ||
DECLARE @databaseName AS nvarchar(2048), @eventMessage AS nvarchar(2048) | ||
SET @databaseName = REPLACE(REPLACE(DB_NAME(), N'\', N'\\'), N'"', N'\"') | ||
SET @eventMessage = N'Redgate SQL Compare: { "deployment": { "description": "Redgate SQL Compare deployed to ' + @databaseName + N'", "database": "' + @databaseName + N'" }}' | ||
EXECUTE sys.xp_logevent 55000, @eventMessage | ||
END | ||
GO | ||
DECLARE @Success AS BIT | ||
SET @Success = 1 | ||
SET NOEXEC OFF | ||
IF (@Success = 1) PRINT 'The database update succeeded' | ||
ELSE BEGIN | ||
IF @@TRANCOUNT > 0 ROLLBACK TRANSACTION | ||
PRINT 'The database update failed' | ||
END | ||
GO |
Oops, something went wrong.