From 50920263679b9ed02092f6f8c854c4ef730d7a17 Mon Sep 17 00:00:00 2001 From: Alex Jackson Date: Mon, 8 Nov 2021 14:20:08 +0000 Subject: [PATCH] HEEDLS-631 Add migration to reduce the GroupDescription column length --- ...1225_ReduceGroupsGroupDescriptionLength.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 DigitalLearningSolutions.Data.Migrations/202111081225_ReduceGroupsGroupDescriptionLength.cs diff --git a/DigitalLearningSolutions.Data.Migrations/202111081225_ReduceGroupsGroupDescriptionLength.cs b/DigitalLearningSolutions.Data.Migrations/202111081225_ReduceGroupsGroupDescriptionLength.cs new file mode 100644 index 0000000000..2706d0b3e7 --- /dev/null +++ b/DigitalLearningSolutions.Data.Migrations/202111081225_ReduceGroupsGroupDescriptionLength.cs @@ -0,0 +1,19 @@ +namespace DigitalLearningSolutions.Data.Migrations +{ + using FluentMigrator; + + [Migration(202111081225)] + public class ReduceGroupsGroupDescriptionLength : Migration + { + public override void Up() + { + Execute.Sql("UPDATE Groups SET GroupDescription = LEFT(GroupDescription, 1000)"); + Alter.Table("Groups").AlterColumn("GroupDescription").AsString(1000).Nullable(); + } + + public override void Down() + { + Alter.Table("Groups").AlterColumn("GroupDescription").AsString(int.MaxValue).Nullable(); + } + } +}