using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace ContactService.Infrastructure.Migrations { /// public partial class InitDb : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AlterDatabase() .Annotation("MySql:Charset", "utf8mb4"); migrationBuilder.CreateTable( name: "friend_requests", columns: table => new { Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), OwnerId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), TargetId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), Description = table.Column(type: "longtext", nullable: false) .Annotation("MySql:Charset", "utf8mb4"), State = table.Column(type: "int", nullable: false), RemarkName = table.Column(type: "longtext", nullable: true) .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_friend_requests", x => x.Id); }) .Annotation("MySql:Charset", "utf8mb4"); migrationBuilder.CreateTable( name: "friends", columns: table => new { Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), OwnerId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), OwnerNickName = table.Column(type: "longtext", nullable: false) .Annotation("MySql:Charset", "utf8mb4"), OwnerAvatarUrl = table.Column(type: "longtext", nullable: true) .Annotation("MySql:Charset", "utf8mb4"), TargetId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), TargetNickName = table.Column(type: "longtext", nullable: false) .Annotation("MySql:Charset", "utf8mb4"), TargetAvatarUrl = table.Column(type: "longtext", nullable: true) .Annotation("MySql:Charset", "utf8mb4"), RemarkName = table.Column(type: "longtext", nullable: true) .Annotation("MySql:Charset", "utf8mb4"), Status = 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_friends", x => x.Id); }) .Annotation("MySql:Charset", "utf8mb4"); migrationBuilder.CreateIndex( name: "IX_friend_requests_OwnerId_TargetId", table: "friend_requests", columns: new[] { "OwnerId", "TargetId" }); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "friend_requests"); migrationBuilder.DropTable( name: "friends"); } } }