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