81 lines
2.5 KiB
C#
81 lines
2.5 KiB
C#
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<int>(
|
|
name: "Id",
|
|
table: "Link",
|
|
type: "int",
|
|
nullable: false,
|
|
oldClrType: typeof(int),
|
|
oldType: "int")
|
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
|
|
|
|
migrationBuilder.AlterColumn<string>(
|
|
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<string>(
|
|
name: "ShortCode",
|
|
table: "Link",
|
|
type: "varchar(255)",
|
|
nullable: false,
|
|
defaultValue: "",
|
|
oldClrType: typeof(string),
|
|
oldType: "varchar(11)",
|
|
oldMaxLength: 11,
|
|
oldNullable: true);
|
|
|
|
migrationBuilder.AlterColumn<int>(
|
|
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");
|
|
}
|
|
}
|
|
}
|