using System; using Microsoft.EntityFrameworkCore.Migrations; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable namespace SVSim.Database.Migrations { /// public partial class AddPackCatalog : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "Packs", columns: table => new { Id = table.Column(type: "integer", nullable: false), BasePackId = table.Column(type: "integer", nullable: false), GachaType = table.Column(type: "integer", nullable: false), PackCategory = table.Column(type: "integer", nullable: false), PosterType = table.Column(type: "integer", nullable: false), CommenceDate = table.Column(type: "timestamp with time zone", nullable: false), CompleteDate = table.Column(type: "timestamp with time zone", nullable: false), SalesPeriodTime = table.Column(type: "timestamp with time zone", nullable: true), SleeveId = table.Column(type: "integer", nullable: false), SpecialSleeveId = table.Column(type: "integer", nullable: false), OverrideDrawEffectPackId = table.Column(type: "integer", nullable: false), OverrideUiEffectPackId = table.Column(type: "integer", nullable: false), GachaDetail = table.Column(type: "text", nullable: false), IsHide = table.Column(type: "boolean", nullable: false), IsNew = table.Column(type: "boolean", nullable: false), IsPreRelease = table.Column(type: "boolean", nullable: false), OpenCountLimit = table.Column(type: "integer", nullable: false), GachaPointConfig_ExchangeablePoint = table.Column(type: "integer", nullable: true), GachaPointConfig_IncreaseGachaPoint = table.Column(type: "integer", nullable: true), DateCreated = table.Column(type: "timestamp with time zone", nullable: false), DateUpdated = table.Column(type: "timestamp with time zone", nullable: true) }, constraints: table => { table.PrimaryKey("PK_Packs", x => x.Id); }); migrationBuilder.CreateTable( name: "ViewerPackOpenCount", columns: table => new { ViewerId = table.Column(type: "bigint", nullable: false), Id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), PackId = table.Column(type: "integer", nullable: false), OpenCount = table.Column(type: "integer", nullable: false), LastDailyFreeAt = table.Column(type: "timestamp with time zone", nullable: true) }, constraints: table => { table.PrimaryKey("PK_ViewerPackOpenCount", x => new { x.ViewerId, x.Id }); table.ForeignKey( name: "FK_ViewerPackOpenCount_Viewers_ViewerId", column: x => x.ViewerId, principalTable: "Viewers", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "PackBannerEntry", columns: table => new { PackConfigEntryId = table.Column(type: "integer", nullable: false), Id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), BannerName = table.Column(type: "text", nullable: false), DialogTitle = table.Column(type: "text", nullable: false) }, constraints: table => { table.PrimaryKey("PK_PackBannerEntry", x => new { x.PackConfigEntryId, x.Id }); table.ForeignKey( name: "FK_PackBannerEntry_Packs_PackConfigEntryId", column: x => x.PackConfigEntryId, principalTable: "Packs", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "PackChildGachaEntry", columns: table => new { PackConfigEntryId = table.Column(type: "integer", nullable: false), Id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), GachaId = table.Column(type: "integer", nullable: false), TypeDetail = table.Column(type: "integer", nullable: false), Cost = table.Column(type: "integer", nullable: false), CardCount = table.Column(type: "integer", nullable: false), ItemId = table.Column(type: "bigint", nullable: true), IsDailySingle = table.Column(type: "boolean", nullable: false), OverrideIncreaseGachaPoint = table.Column(type: "integer", nullable: false), PurchaseLimitCount = table.Column(type: "integer", nullable: false), FreeGachaCampaignId = table.Column(type: "integer", nullable: true), CampaignName = table.Column(type: "text", nullable: true) }, constraints: table => { table.PrimaryKey("PK_PackChildGachaEntry", x => new { x.PackConfigEntryId, x.Id }); table.ForeignKey( name: "FK_PackChildGachaEntry_Packs_PackConfigEntryId", column: x => x.PackConfigEntryId, principalTable: "Packs", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "PackBannerEntry"); migrationBuilder.DropTable( name: "PackChildGachaEntry"); migrationBuilder.DropTable( name: "ViewerPackOpenCount"); migrationBuilder.DropTable( name: "Packs"); } } }