Files
qrcodeService/QRCodeService/Migrations/20210224015439_AddConfiguration.cs
2021-02-24 10:00:37 +08:00

103 lines
3.1 KiB
C#

using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
namespace QRCodeService.Migrations
{
public partial class AddConfiguration : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropPrimaryKey(
name: "PK_Links",
table: "Links");
migrationBuilder.DropPrimaryKey(
name: "PK_Apps",
table: "Apps");
migrationBuilder.RenameTable(
name: "Links",
newName: "Link");
migrationBuilder.RenameTable(
name: "Apps",
newName: "App");
migrationBuilder.AlterColumn<string>(
name: "ShortCode",
table: "Link",
type: "varchar(255)",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "longtext",
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");
migrationBuilder.AddPrimaryKey(
name: "PK_App",
table: "App",
column: "Id");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropPrimaryKey(
name: "PK_Link",
table: "Link");
migrationBuilder.DropPrimaryKey(
name: "PK_App",
table: "App");
migrationBuilder.RenameTable(
name: "Link",
newName: "Links");
migrationBuilder.RenameTable(
name: "App",
newName: "Apps");
migrationBuilder.AlterColumn<int>(
name: "Id",
table: "Links",
type: "int",
nullable: false,
oldClrType: typeof(int),
oldType: "int")
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
migrationBuilder.AlterColumn<string>(
name: "ShortCode",
table: "Links",
type: "longtext",
nullable: true,
oldClrType: typeof(string),
oldType: "varchar(255)");
migrationBuilder.AddPrimaryKey(
name: "PK_Links",
table: "Links",
column: "Id");
migrationBuilder.AddPrimaryKey(
name: "PK_Apps",
table: "Apps",
column: "Id");
}
}
}