using System; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace DeluxeNET.Migrations { /// public partial class roomsAdd : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AlterColumn( name: "accountId", table: "Settings", type: "bigint", nullable: true, oldClrType: typeof(long), oldType: "bigint"); migrationBuilder.CreateTable( name: "Rooms", columns: table => new { RoomId = table.Column(type: "bigint", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), Accessibility = table.Column(type: "int", nullable: false), CloningAllowed = table.Column(type: "tinyint(1)", nullable: false), CreatedAt = table.Column(type: "datetime(6)", nullable: false), CreatorAccountId = table.Column(type: "int", nullable: false), CustomWarning = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), Description = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), DisableMicAutoMute = table.Column(type: "tinyint(1)", nullable: false), DisableRoomComments = table.Column(type: "tinyint(1)", nullable: false), EncryptVoiceChat = table.Column(type: "tinyint(1)", nullable: false), ImageName = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), IsDeveloperOwned = table.Column(type: "tinyint(1)", nullable: false), IsDorm = table.Column(type: "tinyint(1)", nullable: false), IsRRO = table.Column(type: "tinyint(1)", nullable: false), LoadScreenLocked = table.Column(type: "tinyint(1)", nullable: false), MaxPlayerCalculationMode = table.Column(type: "int", nullable: false), MaxPlayers = table.Column(type: "int", nullable: false), MinLevel = table.Column(type: "int", nullable: false), Name = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), State = table.Column(type: "int", nullable: false), SupportsJuniors = table.Column(type: "tinyint(1)", nullable: false), SupportsLevelVoting = table.Column(type: "tinyint(1)", nullable: false), SupportsMobile = table.Column(type: "tinyint(1)", nullable: false), SupportsQuest2 = table.Column(type: "tinyint(1)", nullable: false), SupportsScreens = table.Column(type: "tinyint(1)", nullable: false), SupportsTeleportVR = table.Column(type: "tinyint(1)", nullable: false), SupportsVRLow = table.Column(type: "tinyint(1)", nullable: false), SupportsWalkVR = table.Column(type: "tinyint(1)", nullable: false), Tags = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), Version = table.Column(type: "int", nullable: false), WarningMask = table.Column(type: "int", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Rooms", x => x.RoomId); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateTable( name: "RoomRoles", columns: table => new { Id = table.Column(type: "bigint", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), RoomId = table.Column(type: "bigint", nullable: false), AccountId = table.Column(type: "int", nullable: false), InvitedRole = table.Column(type: "int", nullable: false), Role = table.Column(type: "int", nullable: false) }, constraints: table => { table.PrimaryKey("PK_RoomRoles", x => x.Id); table.ForeignKey( name: "FK_RoomRoles_Rooms_RoomId", column: x => x.RoomId, principalTable: "Rooms", principalColumn: "RoomId", onDelete: ReferentialAction.Cascade); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateTable( name: "RoomStats", columns: table => new { Id = table.Column(type: "bigint", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), RoomId = table.Column(type: "bigint", nullable: false), CheerCount = table.Column(type: "int", nullable: false), FavoriteCount = table.Column(type: "int", nullable: false), VisitCount = table.Column(type: "int", nullable: false), VisitorCount = table.Column(type: "int", nullable: false) }, constraints: table => { table.PrimaryKey("PK_RoomStats", x => x.Id); table.ForeignKey( name: "FK_RoomStats_Rooms_RoomId", column: x => x.RoomId, principalTable: "Rooms", principalColumn: "RoomId", onDelete: ReferentialAction.Cascade); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateTable( name: "SubRooms", columns: table => new { SubRoomId = table.Column(type: "int", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), RoomId = table.Column(type: "bigint", nullable: false), Accessibility = table.Column(type: "int", nullable: false), IsSandbox = table.Column(type: "tinyint(1)", nullable: false), MaxPlayers = table.Column(type: "int", nullable: false), Name = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), UnitySceneId = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4") }, constraints: table => { table.PrimaryKey("PK_SubRooms", x => x.SubRoomId); table.ForeignKey( name: "FK_SubRooms_Rooms_RoomId", column: x => x.RoomId, principalTable: "Rooms", principalColumn: "RoomId", onDelete: ReferentialAction.Cascade); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateTable( name: "SubRoomSaves", columns: table => new { Id = table.Column(type: "bigint", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), RoomId = table.Column(type: "bigint", nullable: false), SubRoomId = table.Column(type: "int", nullable: false), SubRoomDataSaveId = table.Column(type: "int", nullable: false), DataBlob = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), SavedByAccountId = table.Column(type: "int", nullable: false), Description = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), CreatedAt = table.Column(type: "datetime(6)", nullable: false), UnityAssetId = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), SubRoomId1 = table.Column(type: "int", nullable: true) }, constraints: table => { table.PrimaryKey("PK_SubRoomSaves", x => x.Id); table.ForeignKey( name: "FK_SubRoomSaves_Rooms_RoomId", column: x => x.RoomId, principalTable: "Rooms", principalColumn: "RoomId", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_SubRoomSaves_SubRooms_SubRoomId", column: x => x.SubRoomId, principalTable: "SubRooms", principalColumn: "SubRoomId", onDelete: ReferentialAction.Restrict); table.ForeignKey( name: "FK_SubRoomSaves_SubRooms_SubRoomId1", column: x => x.SubRoomId1, principalTable: "SubRooms", principalColumn: "SubRoomId"); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateIndex( name: "IX_RoomRoles_RoomId", table: "RoomRoles", column: "RoomId"); migrationBuilder.CreateIndex( name: "IX_RoomStats_RoomId", table: "RoomStats", column: "RoomId", unique: true); migrationBuilder.CreateIndex( name: "IX_SubRooms_RoomId", table: "SubRooms", column: "RoomId"); migrationBuilder.CreateIndex( name: "IX_SubRoomSaves_RoomId", table: "SubRoomSaves", column: "RoomId"); migrationBuilder.CreateIndex( name: "IX_SubRoomSaves_SubRoomId", table: "SubRoomSaves", column: "SubRoomId", unique: true); migrationBuilder.CreateIndex( name: "IX_SubRoomSaves_SubRoomId1", table: "SubRoomSaves", column: "SubRoomId1"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "RoomRoles"); migrationBuilder.DropTable( name: "RoomStats"); migrationBuilder.DropTable( name: "SubRoomSaves"); migrationBuilder.DropTable( name: "SubRooms"); migrationBuilder.DropTable( name: "Rooms"); migrationBuilder.AlterColumn( name: "accountId", table: "Settings", type: "bigint", nullable: false, defaultValue: 0L, oldClrType: typeof(long), oldType: "bigint", oldNullable: true); } } }