using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; namespace QRCodeService.Migrations { public partial class SetProperty : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.DropPrimaryKey( name: "PK_Link", table: "Link"); migrationBuilder.AlterColumn( name: "Id", table: "Link", type: "int", nullable: false, oldClrType: typeof(int), oldType: "int") .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); migrationBuilder.AlterColumn( name: "ShortCode", table: "Link", type: "varchar(11)", maxLength: 11, nullable: true, oldClrType: typeof(string), oldType: "varchar(255)"); migrationBuilder.AddPrimaryKey( name: "PK_Link", table: "Link", column: "Id"); migrationBuilder.CreateIndex( name: "IX_Link_ShortCode", table: "Link", column: "ShortCode", unique: true); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropPrimaryKey( name: "PK_Link", table: "Link"); migrationBuilder.DropIndex( name: "IX_Link_ShortCode", table: "Link"); migrationBuilder.AlterColumn( name: "ShortCode", table: "Link", type: "varchar(255)", nullable: false, defaultValue: "", oldClrType: typeof(string), oldType: "varchar(11)", oldMaxLength: 11, oldNullable: true); migrationBuilder.AlterColumn( name: "Id", table: "Link", type: "int", nullable: false, oldClrType: typeof(int), oldType: "int") .OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); migrationBuilder.AddPrimaryKey( name: "PK_Link", table: "Link", column: "ShortCode"); } } }