abp new Meowb.Blog
abp new Meowb.Blog -aspnet-core 3.1
Microsoft.EntityFrameworkCore.Internal.SemanticVersionComparer
Add-Migration Initial -c MeowvBlogMigrationsDbContext
Update-Database -context MeowvBlogMigrationsDbContext
using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Meowv.Blog.Migrations
{
public partial class Initial : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: “meowv_Catagories”,
columns: table => new
{
Id = table.Column(type: “int”, nullable: false)
.Annotation(“MySql:ValueGenerationStrategy”, MySqlValueGenerationStrategy.IdentityColumn),
CategoryName = table.Column(type: “varchar(50) CHARACTER SET utf8mb4”, maxLength: 50, nullable: false),
DisplayName = table.Column(type: “varchar(50) CHARACTER SET utf8mb4”, maxLength: 50, nullable: false)
},
constraints: table =>
{
table.PrimaryKey(“PK_meowv_Catagories”, x => x.Id);
});
migrationBuilder.CreateTable(
name: "meowv_FriendLinks",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
Title = table.Column<string>(type: "varchar(20) CHARACTER SET utf8mb4", maxLength: 20, nullable: false),
LinkUrl = table.Column<string>(type: "varchar(100) CHARACTER SET utf8mb4", maxLength: 100, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_meowv_FriendLinks", x => x.Id);
});
migrationBuilder.CreateTable(
name: "meowv_Post_Tags",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
PostId = table.Column<int>(type: "int", nullable: false),
TagId = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_meowv_Post_Tags", x => x.Id);
});
migrationBuilder.CreateTable(
name: "meowv_Posts",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
Title = table.Column<string>(type: "varchar(200) CHARACTER SET utf8mb4", maxLength: 200, nullable: false),
Author = table.Column<string>(type: "varchar(10) CHARACTER SET utf8mb4", maxLength: 10, nullable: true),
Url = table.Column<string>(type: "varchar(100) CHARACTER SET utf8mb4", maxLength: 100, nullable: false),
Html = table.Column<string>(type: "longtext", nullable: false),
Markdown = table.Column<string>(type: "longtext", nullable: false),
CategoryId = table.Column<int>(type: "int", nullable: false),
CreationTime = table.Column<DateTime>(type: "datetime", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_meowv_Posts", x => x.Id);
});
migrationBuilder.CreateTable(
name: "meowv_Tags",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
TagName = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false),
DisplayName = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_meowv_Tags", x => x.Id);
});
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "meowv_Catagories");
migrationBuilder.DropTable(
name: "meowv_FriendLinks");
migrationBuilder.DropTable(
name: "meowv_Post_Tags");
migrationBuilder.DropTable(
name: "meowv_Posts");
migrationBuilder.DropTable(
name: "meowv_Tags");
}
}
}