添加项目文件。
This commit is contained in:
@@ -0,0 +1,84 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace ContactService.Infrastructure.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class InitDb : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterDatabase()
|
||||
.Annotation("MySql:Charset", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "friend_requests",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
OwnerId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
TargetId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
Description = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:Charset", "utf8mb4"),
|
||||
State = table.Column<int>(type: "int", nullable: false),
|
||||
RemarkName = table.Column<string>(type: "longtext", nullable: true)
|
||||
.Annotation("MySql:Charset", "utf8mb4"),
|
||||
IsDeleted = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
||||
CreationTime = table.Column<DateTimeOffset>(type: "datetime(6)", nullable: false),
|
||||
Deletion = table.Column<DateTimeOffset>(type: "datetime(6)", nullable: true),
|
||||
ModificationTime = table.Column<DateTimeOffset>(type: "datetime(6)", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_friend_requests", x => x.Id);
|
||||
})
|
||||
.Annotation("MySql:Charset", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "friends",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
OwnerId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
OwnerNickName = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:Charset", "utf8mb4"),
|
||||
OwnerAvatarUrl = table.Column<string>(type: "longtext", nullable: true)
|
||||
.Annotation("MySql:Charset", "utf8mb4"),
|
||||
TargetId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
TargetNickName = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:Charset", "utf8mb4"),
|
||||
TargetAvatarUrl = table.Column<string>(type: "longtext", nullable: true)
|
||||
.Annotation("MySql:Charset", "utf8mb4"),
|
||||
RemarkName = table.Column<string>(type: "longtext", nullable: true)
|
||||
.Annotation("MySql:Charset", "utf8mb4"),
|
||||
Status = table.Column<int>(type: "int", nullable: false),
|
||||
IsDeleted = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
||||
CreationTime = table.Column<DateTimeOffset>(type: "datetime(6)", nullable: false),
|
||||
Deletion = table.Column<DateTimeOffset>(type: "datetime(6)", nullable: true),
|
||||
ModificationTime = table.Column<DateTimeOffset>(type: "datetime(6)", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_friends", x => x.Id);
|
||||
})
|
||||
.Annotation("MySql:Charset", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_friend_requests_OwnerId_TargetId",
|
||||
table: "friend_requests",
|
||||
columns: new[] { "OwnerId", "TargetId" });
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "friend_requests");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "friends");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user