85 lines
3.1 KiB
C#
85 lines
3.1 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
|
|
|
#nullable disable
|
|
|
|
namespace QuestShare.Server.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class RefactorQuests : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "Quests");
|
|
|
|
migrationBuilder.AddColumn<long>(
|
|
name: "SharedQuestId",
|
|
table: "QuestShares",
|
|
type: "bigint",
|
|
nullable: false,
|
|
defaultValue: 0L);
|
|
|
|
migrationBuilder.AddColumn<byte>(
|
|
name: "SharedQuestStep",
|
|
table: "QuestShares",
|
|
type: "smallint",
|
|
nullable: false,
|
|
defaultValue: (byte)0);
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
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<int>(type: "integer", nullable: false)
|
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
ShareId1 = table.Column<Guid>(type: "uuid", nullable: false),
|
|
CurrentStep = table.Column<byte>(type: "smallint", nullable: false),
|
|
IsActive = table.Column<bool>(type: "boolean", nullable: false),
|
|
QuestId = table.Column<long>(type: "bigint", nullable: false),
|
|
ShareId = table.Column<Guid>(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");
|
|
}
|
|
}
|
|
}
|