添加数据库迁移
This commit is contained in:
80
QRCodeService/Migrations/20210224015858_SetProperty.cs
Normal file
80
QRCodeService/Migrations/20210224015858_SetProperty.cs
Normal file
@@ -0,0 +1,80 @@
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user