using System; using Microsoft.EntityFrameworkCore.Migrations; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable namespace QuestShare.Server.Migrations { /// public partial class RefactorQuests : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "Quests"); migrationBuilder.AddColumn( name: "SharedQuestId", table: "QuestShares", type: "bigint", nullable: false, defaultValue: 0L); migrationBuilder.AddColumn( name: "SharedQuestStep", table: "QuestShares", type: "smallint", nullable: false, defaultValue: (byte)0); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropColumn( name: "SharedQuestId", table: "QuestShares"); migrationBuilder.DropColumn( name: "SharedQuestStep", table: "QuestShares"); migrationBuilder.CreateTable( name: "Quests", columns: table => new { QuestObjId = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), ShareId1 = table.Column(type: "uuid", nullable: false), CurrentStep = table.Column(type: "smallint", nullable: false), IsActive = table.Column(type: "boolean", nullable: false), QuestId = table.Column(type: "bigint", nullable: false), ShareId = table.Column(type: "uuid", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Quests", x => x.QuestObjId); table.ForeignKey( name: "FK_Quests_QuestShares_ShareId", column: x => x.ShareId, principalTable: "QuestShares", principalColumn: "ShareId", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_Quests_QuestShares_ShareId1", column: x => x.ShareId1, principalTable: "QuestShares", principalColumn: "ShareId", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_Quests_ShareId", table: "Quests", column: "ShareId"); migrationBuilder.CreateIndex( name: "IX_Quests_ShareId1", table: "Quests", column: "ShareId1"); } } }