using System; using Microsoft.EntityFrameworkCore.Migrations; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable namespace SVSim.Database.Migrations { /// public partial class AddViewerAcquireHistory : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "ViewerAcquireHistory", columns: table => new { Id = table.Column(type: "bigint", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), ViewerId = table.Column(type: "bigint", nullable: false), RewardType = table.Column(type: "integer", nullable: false), RewardDetailId = table.Column(type: "bigint", nullable: false), RewardCount = table.Column(type: "integer", nullable: false), AcquireType = table.Column(type: "integer", nullable: false), Message = table.Column(type: "character varying(64)", maxLength: 64, nullable: false), AcquireTime = table.Column(type: "timestamp with time zone", nullable: false) }, constraints: table => { table.PrimaryKey("PK_ViewerAcquireHistory", x => x.Id); table.ForeignKey( name: "FK_ViewerAcquireHistory_Viewers_ViewerId", column: x => x.ViewerId, principalTable: "Viewers", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_ViewerAcquireHistory_ViewerId_AcquireTime_Id", table: "ViewerAcquireHistory", columns: new[] { "ViewerId", "AcquireTime", "Id" }); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "ViewerAcquireHistory"); } } }