using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Bunny.Common.Migrations
{
///
public partial class InitialCreate : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Blog",
columns: table => new
{
Id = table.Column(type: "nvarchar(450)", nullable: false),
BlogUrl = table.Column(type: "varchar(600)", nullable: false),
CreateTime = table.Column(type: "datetime2", nullable: false),
UpdateTime = table.Column(type: "datetime2", nullable: false),
CreateUserId = table.Column(type: "bigint", nullable: false),
UpdateUserId = table.Column(type: "bigint", nullable: false),
IsDeleted = table.Column(type: "bit", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Blog", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Products",
columns: table => new
{
Id = table.Column(type: "nvarchar(450)", nullable: false),
CustomerId = table.Column(type: "nvarchar(max)", nullable: true),
CustomerName = table.Column(type: "nvarchar(max)", nullable: true),
PackageType = table.Column(type: "nvarchar(max)", nullable: true),
CreateTime = table.Column(type: "datetime2", nullable: false),
UpdateTime = table.Column(type: "datetime2", nullable: false),
CreateUserId = table.Column(type: "bigint", nullable: false),
UpdateUserId = table.Column(type: "bigint", nullable: false),
IsDeleted = table.Column(type: "bit", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Products", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Users",
columns: table => new
{
Id = table.Column(type: "nvarchar(450)", nullable: false),
UserName = table.Column(type: "nvarchar(max)", nullable: true),
Password = table.Column(type: "nvarchar(max)", nullable: true),
Email = table.Column(type: "nvarchar(max)", nullable: true),
Phone = table.Column(type: "nvarchar(max)", nullable: true),
QrCode = table.Column(type: "nvarchar(max)", nullable: true),
CompanyCode = table.Column(type: "nvarchar(max)", nullable: true),
DeptCode = table.Column(type: "nvarchar(max)", nullable: true),
CreateTime = table.Column(type: "datetime2", nullable: false),
UpdateTime = table.Column(type: "datetime2", nullable: false),
CreateUserId = table.Column(type: "bigint", nullable: false),
UpdateUserId = table.Column(type: "bigint", nullable: false),
IsDeleted = table.Column(type: "bit", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Users", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Posts",
columns: table => new
{
Id = table.Column(type: "nvarchar(450)", nullable: false),
Title = table.Column(type: "nvarchar(600)", maxLength: 600, nullable: true),
Content = table.Column(type: "nvarchar(max)", nullable: true),
BlogId = table.Column(type: "nvarchar(450)", nullable: true),
CreateTime = table.Column(type: "datetime2", nullable: false),
UpdateTime = table.Column(type: "datetime2", nullable: false),
CreateUserId = table.Column(type: "bigint", nullable: false),
UpdateUserId = table.Column(type: "bigint", nullable: false),
IsDeleted = table.Column(type: "bit", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Posts", x => x.Id);
table.ForeignKey(
name: "FK_Posts_Blog_BlogId",
column: x => x.BlogId,
principalTable: "Blog",
principalColumn: "Id");
});
migrationBuilder.CreateIndex(
name: "IX_Posts_BlogId",
table: "Posts",
column: "BlogId");
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Posts");
migrationBuilder.DropTable(
name: "Products");
migrationBuilder.DropTable(
name: "Users");
migrationBuilder.DropTable(
name: "Blog");
}
}
}