93 lines
3.9 KiB
C#
93 lines
3.9 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace pet_companion_api.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class Initial : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "Pets",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<string>(type: "TEXT", nullable: false),
|
|
Name = table.Column<string>(type: "TEXT", nullable: false),
|
|
Class = table.Column<int>(type: "INTEGER", nullable: false),
|
|
Level = table.Column<int>(type: "INTEGER", nullable: false),
|
|
UserId = table.Column<string>(type: "TEXT", nullable: false),
|
|
IsDead = table.Column<bool>(type: "INTEGER", nullable: false),
|
|
PetGatherAction = table.Column<int>(type: "INTEGER", nullable: false),
|
|
GatherActionSince = table.Column<DateTime>(type: "TEXT", nullable: false),
|
|
PetBasicAction = table.Column<int>(type: "INTEGER", nullable: false),
|
|
BasicActionCooldown = table.Column<DateTime>(type: "TEXT", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Pets", x => x.Id);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "PetStats",
|
|
columns: table => new
|
|
{
|
|
PetId = table.Column<string>(type: "TEXT", nullable: false),
|
|
Intelligence = table.Column<int>(type: "INTEGER", nullable: false),
|
|
Strength = table.Column<int>(type: "INTEGER", nullable: false),
|
|
Charisma = table.Column<int>(type: "INTEGER", nullable: false),
|
|
MaxIntelligence = table.Column<int>(type: "INTEGER", nullable: false),
|
|
MaxStrength = table.Column<int>(type: "INTEGER", nullable: false),
|
|
MaxCharisma = table.Column<int>(type: "INTEGER", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_PetStats", x => x.PetId);
|
|
table.ForeignKey(
|
|
name: "FK_PetStats_Pets_PetId",
|
|
column: x => x.PetId,
|
|
principalTable: "Pets",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Resources",
|
|
columns: table => new
|
|
{
|
|
PetId = table.Column<string>(type: "TEXT", nullable: false),
|
|
Wisdom = table.Column<int>(type: "INTEGER", nullable: false),
|
|
Gold = table.Column<int>(type: "INTEGER", nullable: false),
|
|
Food = table.Column<int>(type: "INTEGER", nullable: false),
|
|
Junk = table.Column<int>(type: "INTEGER", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Resources", x => x.PetId);
|
|
table.ForeignKey(
|
|
name: "FK_Resources_Pets_PetId",
|
|
column: x => x.PetId,
|
|
principalTable: "Pets",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "PetStats");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Resources");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Pets");
|
|
}
|
|
}
|
|
}
|