118 lines
5.2 KiB
C#
118 lines
5.2 KiB
C#
|
using System;
|
|||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|||
|
|
|||
|
#nullable disable
|
|||
|
|
|||
|
namespace Bunny.Common.Migrations
|
|||
|
{
|
|||
|
/// <inheritdoc />
|
|||
|
public partial class InitialCreate : Migration
|
|||
|
{
|
|||
|
/// <inheritdoc />
|
|||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|||
|
{
|
|||
|
migrationBuilder.CreateTable(
|
|||
|
name: "Blogs",
|
|||
|
columns: table => new
|
|||
|
{
|
|||
|
Id = table.Column<string>(type: "TEXT", nullable: false),
|
|||
|
Url = table.Column<string>(type: "TEXT", nullable: false),
|
|||
|
CreateTime = table.Column<DateTime>(type: "TEXT", nullable: false),
|
|||
|
UpdateTime = table.Column<DateTime>(type: "TEXT", nullable: false),
|
|||
|
CreateUserId = table.Column<long>(type: "INTEGER", nullable: false),
|
|||
|
UpdateUserId = table.Column<long>(type: "INTEGER", nullable: false)
|
|||
|
},
|
|||
|
constraints: table =>
|
|||
|
{
|
|||
|
table.PrimaryKey("PK_Blogs", x => x.Id);
|
|||
|
});
|
|||
|
|
|||
|
migrationBuilder.CreateTable(
|
|||
|
name: "Products",
|
|||
|
columns: table => new
|
|||
|
{
|
|||
|
Id = table.Column<string>(type: "TEXT", nullable: false),
|
|||
|
CustomerId = table.Column<string>(type: "TEXT", nullable: true),
|
|||
|
CustomerName = table.Column<string>(type: "TEXT", nullable: true),
|
|||
|
PackageType = table.Column<string>(type: "TEXT", nullable: true),
|
|||
|
CreateTime = table.Column<DateTime>(type: "TEXT", nullable: false),
|
|||
|
UpdateTime = table.Column<DateTime>(type: "TEXT", nullable: false),
|
|||
|
CreateUserId = table.Column<long>(type: "INTEGER", nullable: false),
|
|||
|
UpdateUserId = table.Column<long>(type: "INTEGER", nullable: false)
|
|||
|
},
|
|||
|
constraints: table =>
|
|||
|
{
|
|||
|
table.PrimaryKey("PK_Products", x => x.Id);
|
|||
|
});
|
|||
|
|
|||
|
migrationBuilder.CreateTable(
|
|||
|
name: "Users",
|
|||
|
columns: table => new
|
|||
|
{
|
|||
|
Id = table.Column<string>(type: "TEXT", nullable: false),
|
|||
|
UserName = table.Column<string>(type: "TEXT", nullable: true),
|
|||
|
Password = table.Column<string>(type: "TEXT", nullable: true),
|
|||
|
Email = table.Column<string>(type: "TEXT", nullable: true),
|
|||
|
Phone = table.Column<string>(type: "TEXT", nullable: true),
|
|||
|
QrCode = table.Column<string>(type: "TEXT", nullable: true),
|
|||
|
CompanyCode = table.Column<string>(type: "TEXT", nullable: true),
|
|||
|
DeptCode = table.Column<string>(type: "TEXT", nullable: true),
|
|||
|
CreateTime = table.Column<DateTime>(type: "TEXT", nullable: false),
|
|||
|
UpdateTime = table.Column<DateTime>(type: "TEXT", nullable: false),
|
|||
|
CreateUserId = table.Column<long>(type: "INTEGER", nullable: false),
|
|||
|
UpdateUserId = table.Column<long>(type: "INTEGER", nullable: false)
|
|||
|
},
|
|||
|
constraints: table =>
|
|||
|
{
|
|||
|
table.PrimaryKey("PK_Users", x => x.Id);
|
|||
|
});
|
|||
|
|
|||
|
migrationBuilder.CreateTable(
|
|||
|
name: "Posts",
|
|||
|
columns: table => new
|
|||
|
{
|
|||
|
Id = table.Column<string>(type: "TEXT", nullable: false),
|
|||
|
PostId = table.Column<int>(type: "INTEGER", nullable: false),
|
|||
|
Title = table.Column<string>(type: "TEXT", nullable: true),
|
|||
|
Content = table.Column<string>(type: "TEXT", nullable: true),
|
|||
|
BlogId = table.Column<int>(type: "INTEGER", nullable: false),
|
|||
|
BlogId1 = table.Column<string>(type: "TEXT", nullable: true),
|
|||
|
CreateTime = table.Column<DateTime>(type: "TEXT", nullable: false),
|
|||
|
UpdateTime = table.Column<DateTime>(type: "TEXT", nullable: false),
|
|||
|
CreateUserId = table.Column<long>(type: "INTEGER", nullable: false),
|
|||
|
UpdateUserId = table.Column<long>(type: "INTEGER", nullable: false)
|
|||
|
},
|
|||
|
constraints: table =>
|
|||
|
{
|
|||
|
table.PrimaryKey("PK_Posts", x => x.Id);
|
|||
|
table.ForeignKey(
|
|||
|
name: "FK_Posts_Blogs_BlogId1",
|
|||
|
column: x => x.BlogId1,
|
|||
|
principalTable: "Blogs",
|
|||
|
principalColumn: "Id");
|
|||
|
});
|
|||
|
|
|||
|
migrationBuilder.CreateIndex(
|
|||
|
name: "IX_Posts_BlogId1",
|
|||
|
table: "Posts",
|
|||
|
column: "BlogId1");
|
|||
|
}
|
|||
|
|
|||
|
/// <inheritdoc />
|
|||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|||
|
{
|
|||
|
migrationBuilder.DropTable(
|
|||
|
name: "Posts");
|
|||
|
|
|||
|
migrationBuilder.DropTable(
|
|||
|
name: "Products");
|
|||
|
|
|||
|
migrationBuilder.DropTable(
|
|||
|
name: "Users");
|
|||
|
|
|||
|
migrationBuilder.DropTable(
|
|||
|
name: "Blogs");
|
|||
|
}
|
|||
|
}
|
|||
|
}
|