232 lines
10 KiB
C#
232 lines
10 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Metadata;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
namespace Yi.Framework.Model.Migrations
|
|
{
|
|
public partial class yi1 : Migration
|
|
{
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.AlterDatabase()
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "mould",
|
|
columns: table => new
|
|
{
|
|
id = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
|
mould_name = table.Column<string>(type: "longtext", nullable: true)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
url = table.Column<string>(type: "longtext", nullable: true)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
is_delete = table.Column<int>(type: "int", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_mould", x => x.id);
|
|
})
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "role",
|
|
columns: table => new
|
|
{
|
|
id = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
|
role_name = table.Column<string>(type: "longtext", nullable: true)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
introduce = table.Column<string>(type: "longtext", nullable: true)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
is_delete = table.Column<int>(type: "int", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_role", x => x.id);
|
|
})
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "user",
|
|
columns: table => new
|
|
{
|
|
id = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
|
username = table.Column<string>(type: "longtext", nullable: true)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
password = table.Column<string>(type: "longtext", nullable: true)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
icon = table.Column<string>(type: "longtext", nullable: true)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
nick = table.Column<string>(type: "longtext", nullable: true)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
email = table.Column<string>(type: "longtext", nullable: true)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
ip = table.Column<string>(type: "longtext", nullable: true)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
age = table.Column<int>(type: "int", nullable: true),
|
|
introduction = table.Column<string>(type: "longtext", nullable: true)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
address = table.Column<string>(type: "longtext", nullable: true)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
phone = table.Column<string>(type: "longtext", nullable: true)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
is_delete = table.Column<int>(type: "int", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_user", x => x.id);
|
|
})
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "visit",
|
|
columns: table => new
|
|
{
|
|
id = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
|
time = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
|
num = table.Column<int>(type: "int", nullable: false),
|
|
is_delete = table.Column<int>(type: "int", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_visit", x => x.id);
|
|
})
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "menu",
|
|
columns: table => new
|
|
{
|
|
id = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
|
icon = table.Column<string>(type: "longtext", nullable: true)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
router = table.Column<string>(type: "longtext", nullable: true)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
menu_name = table.Column<string>(type: "longtext", nullable: true)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
mouldid = table.Column<int>(type: "int", nullable: true),
|
|
menuid = table.Column<int>(type: "int", nullable: true),
|
|
is_delete = table.Column<int>(type: "int", nullable: false),
|
|
is_top = table.Column<int>(type: "int", nullable: false),
|
|
sort = table.Column<int>(type: "int", nullable: false),
|
|
is_show = table.Column<int>(type: "int", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_menu", x => x.id);
|
|
table.ForeignKey(
|
|
name: "FK_menu_menu_menuid",
|
|
column: x => x.menuid,
|
|
principalTable: "menu",
|
|
principalColumn: "id",
|
|
onDelete: ReferentialAction.Restrict);
|
|
table.ForeignKey(
|
|
name: "FK_menu_mould_mouldid",
|
|
column: x => x.mouldid,
|
|
principalTable: "mould",
|
|
principalColumn: "id",
|
|
onDelete: ReferentialAction.Restrict);
|
|
})
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "roleuser",
|
|
columns: table => new
|
|
{
|
|
rolesid = table.Column<int>(type: "int", nullable: false),
|
|
usersid = table.Column<int>(type: "int", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_roleuser", x => new { x.rolesid, x.usersid });
|
|
table.ForeignKey(
|
|
name: "FK_roleuser_role_rolesid",
|
|
column: x => x.rolesid,
|
|
principalTable: "role",
|
|
principalColumn: "id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
table.ForeignKey(
|
|
name: "FK_roleuser_user_usersid",
|
|
column: x => x.usersid,
|
|
principalTable: "user",
|
|
principalColumn: "id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
})
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "menurole",
|
|
columns: table => new
|
|
{
|
|
menusid = table.Column<int>(type: "int", nullable: false),
|
|
rolesid = table.Column<int>(type: "int", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_menurole", x => new { x.menusid, x.rolesid });
|
|
table.ForeignKey(
|
|
name: "FK_menurole_menu_menusid",
|
|
column: x => x.menusid,
|
|
principalTable: "menu",
|
|
principalColumn: "id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
table.ForeignKey(
|
|
name: "FK_menurole_role_rolesid",
|
|
column: x => x.rolesid,
|
|
principalTable: "role",
|
|
principalColumn: "id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
})
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_menu_menuid",
|
|
table: "menu",
|
|
column: "menuid");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_menu_mouldid",
|
|
table: "menu",
|
|
column: "mouldid");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_menurole_rolesid",
|
|
table: "menurole",
|
|
column: "rolesid");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_roleuser_usersid",
|
|
table: "roleuser",
|
|
column: "usersid");
|
|
}
|
|
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "menurole");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "roleuser");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "visit");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "menu");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "role");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "user");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "mould");
|
|
}
|
|
}
|
|
}
|