using System; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; namespace LINGYUN.Abp.MessageService.Migrations { public partial class AddChatMessageEntites : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AlterColumn( name: "ReadStatus", table: "AppUserNotifications", nullable: false, oldClrType: typeof(sbyte), oldType: "tinyint"); migrationBuilder.CreateTable( name: "AppChatGroupAdmins", columns: table => new { Id = table.Column(nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), CreationTime = table.Column(nullable: false), CreatorId = table.Column(nullable: true), LastModificationTime = table.Column(nullable: true), LastModifierId = table.Column(nullable: true), TenantId = table.Column(nullable: true), GroupId = table.Column(nullable: false), UserId = table.Column(nullable: false), IsSuperAdmin = table.Column(nullable: false), AllowSilence = table.Column(nullable: false), AllowKickPeople = table.Column(nullable: false), AllowAddPeople = table.Column(nullable: false), AllowSendNotice = table.Column(nullable: false), AllowDissolveGroup = table.Column(nullable: false) }, constraints: table => { table.PrimaryKey("PK_AppChatGroupAdmins", x => x.Id); }); migrationBuilder.CreateTable( name: "AppChatGroups", columns: table => new { Id = table.Column(nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), CreationTime = table.Column(nullable: false), CreatorId = table.Column(nullable: true), LastModificationTime = table.Column(nullable: true), LastModifierId = table.Column(nullable: true), TenantId = table.Column(nullable: true), GroupId = table.Column(nullable: false), Name = table.Column(maxLength: 20, nullable: false), Tag = table.Column(maxLength: 512, nullable: true), Address = table.Column(maxLength: 256, nullable: true), Notice = table.Column(maxLength: 64, nullable: true), MaxUserCount = table.Column(nullable: false), AllowAnonymous = table.Column(nullable: false), AllowSendMessage = table.Column(nullable: false), Description = table.Column(maxLength: 128, nullable: true) }, constraints: table => { table.PrimaryKey("PK_AppChatGroups", x => x.Id); }); migrationBuilder.CreateTable( name: "AppGroupChatBlacks", columns: table => new { Id = table.Column(nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), CreationTime = table.Column(nullable: false), CreatorId = table.Column(nullable: true), TenantId = table.Column(nullable: true), GroupId = table.Column(nullable: false), ShieldUserId = table.Column(nullable: false) }, constraints: table => { table.PrimaryKey("PK_AppGroupChatBlacks", x => x.Id); }); migrationBuilder.CreateTable( name: "AppGroupMessages", columns: table => new { Id = table.Column(nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), CreationTime = table.Column(nullable: false), CreatorId = table.Column(nullable: true), TenantId = table.Column(nullable: true), MessageId = table.Column(nullable: false), SendUserName = table.Column(maxLength: 64, nullable: false), Content = table.Column(maxLength: 1048576, nullable: false), Type = table.Column(nullable: false), SendState = table.Column(nullable: false), GroupId = table.Column(nullable: false) }, constraints: table => { table.PrimaryKey("PK_AppGroupMessages", x => x.Id); }); migrationBuilder.CreateTable( name: "AppUserChatBlacks", columns: table => new { Id = table.Column(nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), CreationTime = table.Column(nullable: false), CreatorId = table.Column(nullable: true), TenantId = table.Column(nullable: true), UserId = table.Column(nullable: false), ShieldUserId = table.Column(nullable: false) }, constraints: table => { table.PrimaryKey("PK_AppUserChatBlacks", x => x.Id); }); migrationBuilder.CreateTable( name: "AppUserChatGroups", columns: table => new { Id = table.Column(nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), CreationTime = table.Column(nullable: false), CreatorId = table.Column(nullable: true), TenantId = table.Column(nullable: true), UserId = table.Column(nullable: false), GroupId = table.Column(nullable: false) }, constraints: table => { table.PrimaryKey("PK_AppUserChatGroups", x => x.Id); }); migrationBuilder.CreateTable( name: "AppUserChatSettings", columns: table => new { Id = table.Column(nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), TenantId = table.Column(nullable: true), UserId = table.Column(nullable: false), AllowAnonymous = table.Column(nullable: false), AllowAddFriend = table.Column(nullable: false), RequireAddFriendValition = table.Column(nullable: false), AllowReceiveMessage = table.Column(nullable: false), AllowSendMessage = table.Column(nullable: false) }, constraints: table => { table.PrimaryKey("PK_AppUserChatSettings", x => x.Id); }); migrationBuilder.CreateTable( name: "AppUserMessages", columns: table => new { Id = table.Column(nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), CreationTime = table.Column(nullable: false), CreatorId = table.Column(nullable: true), TenantId = table.Column(nullable: true), MessageId = table.Column(nullable: false), SendUserName = table.Column(maxLength: 64, nullable: false), Content = table.Column(maxLength: 1048576, nullable: false), Type = table.Column(nullable: false), SendState = table.Column(nullable: false), ReceiveUserId = table.Column(nullable: false) }, constraints: table => { table.PrimaryKey("PK_AppUserMessages", x => x.Id); }); migrationBuilder.CreateTable( name: "AppUserSpecialFocuss", columns: table => new { Id = table.Column(nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), CreationTime = table.Column(nullable: false), CreatorId = table.Column(nullable: true), TenantId = table.Column(nullable: true), UserId = table.Column(nullable: false), FocusUserId = table.Column(nullable: false) }, constraints: table => { table.PrimaryKey("PK_AppUserSpecialFocuss", x => x.Id); }); migrationBuilder.CreateIndex( name: "IX_AppChatGroupAdmins_TenantId_GroupId", table: "AppChatGroupAdmins", columns: new[] { "TenantId", "GroupId" }); migrationBuilder.CreateIndex( name: "IX_AppChatGroups_TenantId_Name", table: "AppChatGroups", columns: new[] { "TenantId", "Name" }); migrationBuilder.CreateIndex( name: "IX_AppGroupChatBlacks_TenantId_GroupId", table: "AppGroupChatBlacks", columns: new[] { "TenantId", "GroupId" }); migrationBuilder.CreateIndex( name: "IX_AppGroupMessages_TenantId_GroupId", table: "AppGroupMessages", columns: new[] { "TenantId", "GroupId" }); migrationBuilder.CreateIndex( name: "IX_AppUserChatBlacks_TenantId_UserId", table: "AppUserChatBlacks", columns: new[] { "TenantId", "UserId" }); migrationBuilder.CreateIndex( name: "IX_AppUserChatGroups_TenantId_GroupId_UserId", table: "AppUserChatGroups", columns: new[] { "TenantId", "GroupId", "UserId" }); migrationBuilder.CreateIndex( name: "IX_AppUserChatSettings_TenantId_UserId", table: "AppUserChatSettings", columns: new[] { "TenantId", "UserId" }); migrationBuilder.CreateIndex( name: "IX_AppUserMessages_TenantId_ReceiveUserId", table: "AppUserMessages", columns: new[] { "TenantId", "ReceiveUserId" }); migrationBuilder.CreateIndex( name: "IX_AppUserSpecialFocuss_TenantId_UserId", table: "AppUserSpecialFocuss", columns: new[] { "TenantId", "UserId" }); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "AppChatGroupAdmins"); migrationBuilder.DropTable( name: "AppChatGroups"); migrationBuilder.DropTable( name: "AppGroupChatBlacks"); migrationBuilder.DropTable( name: "AppGroupMessages"); migrationBuilder.DropTable( name: "AppUserChatBlacks"); migrationBuilder.DropTable( name: "AppUserChatGroups"); migrationBuilder.DropTable( name: "AppUserChatSettings"); migrationBuilder.DropTable( name: "AppUserMessages"); migrationBuilder.DropTable( name: "AppUserSpecialFocuss"); migrationBuilder.AlterColumn( name: "ReadStatus", table: "AppUserNotifications", type: "tinyint", nullable: false, oldClrType: typeof(int)); } } }