pet-companion-back/Migrations/20250201022754_InitialCreate.cs
2025-01-31 23:41:30 -03:00

84 lines
3.2 KiB
C#

using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace pet_companion_api.Migrations
{
/// <inheritdoc />
public partial class InitialCreate : 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)
},
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)
},
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");
}
}
}