Add new migration
This commit is contained in:
@ -0,0 +1,84 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
namespace Hcs.WebApp.Data.Hcs.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class UpdateHouseEntity : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Houses_FiasId",
|
||||
table: "Houses");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "ThirdPartyId",
|
||||
table: "Houses",
|
||||
type: "nvarchar(max)",
|
||||
nullable: true,
|
||||
oldClrType: typeof(int),
|
||||
oldType: "int");
|
||||
|
||||
migrationBuilder.AlterColumn<Guid>(
|
||||
name: "FiasId",
|
||||
table: "Houses",
|
||||
type: "uniqueidentifier",
|
||||
nullable: true,
|
||||
oldClrType: typeof(Guid),
|
||||
oldType: "uniqueidentifier");
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "HcsId",
|
||||
table: "Houses",
|
||||
type: "uniqueidentifier",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Houses_FiasId",
|
||||
table: "Houses",
|
||||
column: "FiasId",
|
||||
unique: true,
|
||||
filter: "[FiasId] IS NOT NULL");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Houses_FiasId",
|
||||
table: "Houses");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "HcsId",
|
||||
table: "Houses");
|
||||
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "ThirdPartyId",
|
||||
table: "Houses",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
defaultValue: 0,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "nvarchar(max)",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<Guid>(
|
||||
name: "FiasId",
|
||||
table: "Houses",
|
||||
type: "uniqueidentifier",
|
||||
nullable: false,
|
||||
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
|
||||
oldClrType: typeof(Guid),
|
||||
oldType: "uniqueidentifier",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Houses_FiasId",
|
||||
table: "Houses",
|
||||
column: "FiasId",
|
||||
unique: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user