Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this specify the number of characters or the number of bytes?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it'll set it to a nvarchar(1000)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Grand. Are you confident you can fit a 1000-character string in there? I'm slightly hazy on this, especially where character encodings are concerned, but if you're confident / have tested then merge away.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I've put a 1000 character string xxxxxxxxx... into mine, and it truncated the longer one down.

}

public override void Down()
{
Alter.Table("Groups").AlterColumn("GroupDescription").AsString(int.MaxValue).Nullable();
}
}
}