using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace GroupService.Infrastructure.Migrations
{
///
public partial class InitGroupDb : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterDatabase()
.Annotation("MySql:Charset", "utf8mb4");
migrationBuilder.CreateTable(
name: "group_members",
columns: table => new
{
Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
UserId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
GroupNickName = table.Column(type: "longtext", nullable: false)
.Annotation("MySql:Charset", "utf8mb4"),
Avatar = table.Column(type: "longtext", nullable: true)
.Annotation("MySql:Charset", "utf8mb4"),
GroupId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
Role = table.Column(type: "int", nullable: false),
IsDeleted = table.Column(type: "tinyint(1)", nullable: false),
CreationTime = table.Column(type: "datetime(6)", nullable: false),
Deletion = table.Column(type: "datetime(6)", nullable: true),
ModificationTime = table.Column(type: "datetime(6)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_group_members", x => x.Id);
})
.Annotation("MySql:Charset", "utf8mb4");
migrationBuilder.CreateTable(
name: "groups",
columns: table => new
{
Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
Name = table.Column(type: "longtext", nullable: false)
.Annotation("MySql:Charset", "utf8mb4"),
GroupMaster = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
Authority = table.Column(type: "int", nullable: false),
AllMembersBanned = table.Column(type: "tinyint(1)", nullable: false),
Status = table.Column(type: "int", nullable: false),
Announcement = table.Column(type: "longtext", nullable: false)
.Annotation("MySql:Charset", "utf8mb4"),
Avatar = table.Column(type: "longtext", nullable: true)
.Annotation("MySql:Charset", "utf8mb4"),
MaxSequenceId = table.Column(type: "bigint", nullable: false),
LastMessage = table.Column(type: "longtext", nullable: false)
.Annotation("MySql:Charset", "utf8mb4"),
LastSenderName = table.Column(type: "longtext", nullable: false)
.Annotation("MySql:Charset", "utf8mb4"),
IsDeleted = table.Column(type: "tinyint(1)", nullable: false),
CreationTime = table.Column(type: "datetime(6)", nullable: false),
Deletion = table.Column(type: "datetime(6)", nullable: true),
ModificationTime = table.Column(type: "datetime(6)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_groups", x => x.Id);
})
.Annotation("MySql:Charset", "utf8mb4");
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "group_members");
migrationBuilder.DropTable(
name: "groups");
}
}
}