using System; using Microsoft.EntityFrameworkCore.Migrations; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable namespace SVSim.Database.Migrations { /// public partial class AddGachaPointExchange : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "ViewerGachaPointBalance", 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), Points = table.Column(type: "integer", nullable: false) }, constraints: table => { table.PrimaryKey("PK_ViewerGachaPointBalance", x => new { x.ViewerId, x.Id }); table.ForeignKey( name: "FK_ViewerGachaPointBalance_Viewers_ViewerId", column: x => x.ViewerId, principalTable: "Viewers", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "ViewerGachaPointReceived", 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), CardId = table.Column(type: "bigint", nullable: false), ReceivedAt = table.Column(type: "timestamp with time zone", nullable: false) }, constraints: table => { table.PrimaryKey("PK_ViewerGachaPointReceived", x => new { x.ViewerId, x.Id }); table.ForeignKey( name: "FK_ViewerGachaPointReceived_Viewers_ViewerId", column: x => x.ViewerId, principalTable: "Viewers", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_ViewerGachaPointBalance_ViewerId_PackId", table: "ViewerGachaPointBalance", columns: new[] { "ViewerId", "PackId" }, unique: true); migrationBuilder.CreateIndex( name: "IX_ViewerGachaPointReceived_ViewerId_PackId_CardId", table: "ViewerGachaPointReceived", columns: new[] { "ViewerId", "PackId", "CardId" }, unique: true); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "ViewerGachaPointBalance"); migrationBuilder.DropTable( name: "ViewerGachaPointReceived"); } } }