43 lines
1.3 KiB
C#
43 lines
1.3 KiB
C#
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace RazorPagesMovie.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class MakeContactMessageSubjectRequired : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.Sql("UPDATE ContactMessage SET Subject = '' WHERE Subject IS NULL;");
|
|
|
|
migrationBuilder.AlterColumn<string>(
|
|
name: "Subject",
|
|
table: "ContactMessage",
|
|
type: "nvarchar(150)",
|
|
maxLength: 150,
|
|
nullable: false,
|
|
defaultValue: "",
|
|
oldClrType: typeof(string),
|
|
oldType: "nvarchar(150)",
|
|
oldMaxLength: 150,
|
|
oldNullable: true);
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.AlterColumn<string>(
|
|
name: "Subject",
|
|
table: "ContactMessage",
|
|
type: "nvarchar(150)",
|
|
maxLength: 150,
|
|
nullable: true,
|
|
oldClrType: typeof(string),
|
|
oldType: "nvarchar(150)",
|
|
oldMaxLength: 150);
|
|
}
|
|
}
|
|
}
|