using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace GameDatabase.Migrations { /// public partial class AddChallengeCompete : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "ChallengeCompeteData", columns: table => new { CompId = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), CompeteMode = table.Column(type: "INTEGER", nullable: false), Baid = table.Column(type: "INTEGER", nullable: false), CompeteName = table.Column(type: "TEXT", nullable: false), CompeteDescribe = table.Column(type: "TEXT", nullable: false), MaxParticipant = table.Column(type: "INTEGER", nullable: false), CreateTime = table.Column(type: "datetime", nullable: false), ExpireTime = table.Column(type: "datetime", nullable: false), RequireTitle = table.Column(type: "INTEGER", nullable: false), Share = table.Column(type: "INTEGER", nullable: false), CompeteTarget = table.Column(type: "INTEGER", nullable: false) }, constraints: table => { table.PrimaryKey("PK_ChallengeCompeteData", x => x.CompId); }); migrationBuilder.CreateTable( name: "ChallengeCompeteParticipantData", columns: table => new { CompId = table.Column(type: "INTEGER", nullable: false), Baid = table.Column(type: "INTEGER", nullable: false), IsActive = table.Column(type: "INTEGER", nullable: false) }, constraints: table => { table.PrimaryKey("PK_ChallengeCompeteParticipantData", x => new { x.CompId, x.Baid }); table.ForeignKey( name: "FK_ChallengeCompeteParticipantData_ChallengeCompeteData_CompId", column: x => x.CompId, principalTable: "ChallengeCompeteData", principalColumn: "CompId", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_ChallengeCompeteParticipantData_UserData_Baid", column: x => x.Baid, principalTable: "UserData", principalColumn: "Baid", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "ChallengeCompeteSongData", columns: table => new { CompId = table.Column(type: "INTEGER", nullable: false), SongId = table.Column(type: "INTEGER", nullable: false), Difficulty = table.Column(type: "INTEGER", nullable: false), SongOpt = table.Column(type: "INTEGER", nullable: false) }, constraints: table => { table.PrimaryKey("PK_ChallengeCompeteSongData", x => new { x.CompId, x.SongId }); table.ForeignKey( name: "FK_ChallengeCompeteSongData_ChallengeCompeteData_CompId", column: x => x.CompId, principalTable: "ChallengeCompeteData", principalColumn: "CompId", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "ChallengeCompeteBestData", columns: table => new { CompId = table.Column(type: "INTEGER", nullable: false), Baid = table.Column(type: "INTEGER", nullable: false), SongId = table.Column(type: "INTEGER", nullable: false), Difficulty = table.Column(type: "INTEGER", nullable: false), Crown = table.Column(type: "INTEGER", nullable: false), Score = table.Column(type: "INTEGER", nullable: false), ScoreRate = table.Column(type: "INTEGER", nullable: false), ScoreRank = table.Column(type: "INTEGER", nullable: false), GoodCount = table.Column(type: "INTEGER", nullable: false), OkCount = table.Column(type: "INTEGER", nullable: false), MissCount = table.Column(type: "INTEGER", nullable: false), ComboCount = table.Column(type: "INTEGER", nullable: false), HitCount = table.Column(type: "INTEGER", nullable: false), DrumrollCount = table.Column(type: "INTEGER", nullable: false), Skipped = table.Column(type: "INTEGER", nullable: false) }, constraints: table => { table.PrimaryKey("PK_ChallengeCompeteBestData", x => new { x.CompId, x.Baid, x.SongId }); table.ForeignKey( name: "FK_ChallengeCompeteBestData_ChallengeCompeteSongData_CompId_SongId", columns: x => new { x.CompId, x.SongId }, principalTable: "ChallengeCompeteSongData", principalColumns: new[] { "CompId", "SongId" }, onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_ChallengeCompeteBestData_UserData_Baid", column: x => x.Baid, principalTable: "UserData", principalColumn: "Baid", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_ChallengeCompeteBestData_Baid", table: "ChallengeCompeteBestData", column: "Baid"); migrationBuilder.CreateIndex( name: "IX_ChallengeCompeteBestData_CompId_SongId", table: "ChallengeCompeteBestData", columns: new[] { "CompId", "SongId" }); migrationBuilder.CreateIndex( name: "IX_ChallengeCompeteParticipantData_Baid", table: "ChallengeCompeteParticipantData", column: "Baid"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "ChallengeCompeteBestData"); migrationBuilder.DropTable( name: "ChallengeCompeteParticipantData"); migrationBuilder.DropTable( name: "ChallengeCompeteSongData"); migrationBuilder.DropTable( name: "ChallengeCompeteData"); } } }