using System;
using System.Net;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace QuestShare.Server.Migrations
{
///
public partial class InitialCreate : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Bans",
columns: table => new
{
BanId = table.Column(type: "text", nullable: false),
BanIp = table.Column(type: "inet", nullable: false),
BanCharacterId = table.Column(type: "numeric(20,0)", nullable: false),
BanReason = table.Column(type: "text", nullable: false),
BanIssuer = table.Column(type: "text", nullable: false),
BanDate = table.Column(type: "timestamp with time zone", nullable: false),
BanExpiry = table.Column(type: "timestamp with time zone", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Bans", x => x.BanId);
});
migrationBuilder.CreateTable(
name: "Clients",
columns: table => new
{
ClientId = table.Column(type: "uuid", nullable: false),
CharacterId = table.Column(type: "numeric(20,0)", nullable: false),
ConnectionId = table.Column(type: "text", nullable: false),
Token = table.Column(type: "text", nullable: false),
ConnectedShareCode = table.Column(type: "text", nullable: false),
Created = table.Column(type: "timestamp with time zone", nullable: false, defaultValueSql: "current_timestamp"),
LastUpdated = table.Column(type: "timestamp with time zone", nullable: false, defaultValueSql: "current_timestamp")
},
constraints: table =>
{
table.PrimaryKey("PK_Clients", x => x.ClientId);
});
migrationBuilder.CreateTable(
name: "QuestShares",
columns: table => new
{
ShareId = table.Column(type: "uuid", nullable: false),
ShareHostClientId = table.Column(type: "uuid", nullable: false),
ShareCode = table.Column(type: "text", nullable: false),
BroadcastParty = table.Column(type: "boolean", nullable: false),
Created = table.Column(type: "timestamp with time zone", nullable: false, defaultValueSql: "current_timestamp"),
LastUpdated = table.Column(type: "timestamp with time zone", nullable: false, defaultValueSql: "current_timestamp")
},
constraints: table =>
{
table.PrimaryKey("PK_QuestShares", x => x.ShareId);
table.ForeignKey(
name: "FK_QuestShares_Clients_ShareHostClientId",
column: x => x.ShareHostClientId,
principalTable: "Clients",
principalColumn: "ClientId",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Quests",
columns: table => new
{
QuestObjId = table.Column(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
QuestId = table.Column(type: "bigint", nullable: false),
CurrentStep = table.Column(type: "smallint", nullable: false),
IsActive = table.Column(type: "boolean", nullable: false),
ShareId1 = table.Column(type: "uuid", 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");
migrationBuilder.CreateIndex(
name: "IX_QuestShares_ShareHostClientId",
table: "QuestShares",
column: "ShareHostClientId");
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Bans");
migrationBuilder.DropTable(
name: "Quests");
migrationBuilder.DropTable(
name: "QuestShares");
migrationBuilder.DropTable(
name: "Clients");
}
}
}