1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Timeline.Migrations
{
public partial class AddUserDetail : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "user_details",
columns: table => new
{
id = table.Column<long>(nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
nickname = table.Column<string>(maxLength: 15, nullable: true),
qq = table.Column<string>(maxLength: 15, nullable: true),
email = table.Column<string>(maxLength: 50, nullable: true),
phone_number = table.Column<string>(maxLength: 15, nullable: true),
description = table.Column<string>(nullable: true),
UserId = table.Column<long>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_user_details", x => x.id);
table.ForeignKey(
name: "FK_user_details_users_UserId",
column: x => x.UserId,
principalTable: "users",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_user_details_UserId",
table: "user_details",
column: "UserId",
unique: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "user_details");
}
}
}
|