pet-companion-back/Migrations/20250204213845_InitialCreate.cs

319 lines
15 KiB
C#

using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
namespace PetCompanion.Migrations
{
/// <inheritdoc />
public partial class InitialCreate : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "GameItems",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Name = table.Column<string>(type: "TEXT", nullable: false),
Type = table.Column<int>(type: "INTEGER", nullable: false),
Rarity = table.Column<int>(type: "INTEGER", nullable: false),
Description = table.Column<string>(type: "TEXT", nullable: false),
Price = table.Column<int>(type: "INTEGER", nullable: false),
Effect = table.Column<string>(type: "TEXT", nullable: false),
EquipTarget = table.Column<int>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_GameItems", x => x.Id);
});
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),
Experience = table.Column<int>(type: "INTEGER", nullable: false),
Health = table.Column<int>(type: "INTEGER", nullable: false),
MaxHealth = 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),
SkillPoints = table.Column<int>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Pets", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Skills",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Name = table.Column<string>(type: "TEXT", nullable: false),
Description = table.Column<string>(type: "TEXT", nullable: false),
Type = table.Column<int>(type: "INTEGER", nullable: false),
PointsCost = table.Column<int>(type: "INTEGER", nullable: false),
Icon = table.Column<string>(type: "TEXT", nullable: false),
SkillsIdRequired = table.Column<string>(type: "TEXT", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Skills", x => x.Id);
});
migrationBuilder.CreateTable(
name: "EquippedItems",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
PetId = table.Column<string>(type: "TEXT", nullable: false),
EquipTarget = table.Column<int>(type: "INTEGER", nullable: false),
GameItemId = table.Column<int>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_EquippedItems", x => x.Id);
table.ForeignKey(
name: "FK_EquippedItems_GameItems_GameItemId",
column: x => x.GameItemId,
principalTable: "GameItems",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_EquippedItems_Pets_PetId",
column: x => x.PetId,
principalTable: "Pets",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Inventories",
columns: table => new
{
PetId = table.Column<string>(type: "TEXT", nullable: false),
Items = table.Column<string>(type: "TEXT", nullable: false),
Capacity = table.Column<int>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Inventories", x => x.PetId);
table.ForeignKey(
name: "FK_Inventories_Pets_PetId",
column: x => x.PetId,
principalTable: "Pets",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
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),
Luck = table.Column<int>(type: "INTEGER", nullable: false),
Agility = table.Column<int>(type: "INTEGER", nullable: false),
Perception = 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);
});
migrationBuilder.CreateTable(
name: "PetSkills",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
PetId = table.Column<string>(type: "TEXT", nullable: false),
SkillId = table.Column<int>(type: "INTEGER", nullable: false),
CurrentTier = table.Column<int>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_PetSkills", x => x.Id);
table.ForeignKey(
name: "FK_PetSkills_Pets_PetId",
column: x => x.PetId,
principalTable: "Pets",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_PetSkills_Skills_SkillId",
column: x => x.SkillId,
principalTable: "Skills",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "SkillEffects",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
SkillId = table.Column<int>(type: "INTEGER", nullable: false),
Tier = table.Column<int>(type: "INTEGER", nullable: false),
Effect = table.Column<string>(type: "TEXT", nullable: false),
Value = table.Column<decimal>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_SkillEffects", x => x.Id);
table.ForeignKey(
name: "FK_SkillEffects_Skills_SkillId",
column: x => x.SkillId,
principalTable: "Skills",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.InsertData(
table: "Skills",
columns: new[] { "Id", "Description", "Icon", "Name", "PointsCost", "SkillsIdRequired", "Type" },
values: new object[,]
{
{ 1, "Increases maximum health of your pet, making it more resilient.", "❤", "Vitality Mastery", 1, null, 0 },
{ 2, "Increases maximum intelligence of your pet, improving its learning capabilities.", "🧠", "Mind Enhancement", 1, null, 0 },
{ 3, "Increases maximum strength of your pet, making it more powerful.", "💪", "Strength Training", 1, null, 0 },
{ 4, "Increases maximum charisma of your pet, making it more charming.", "🎭", "Charisma Boost", 1, null, 0 },
{ 5, "Increases luck of your pet, making it more fortunate to find rare items.", "🍀", "Luck of the Draw", 1, "[4]", 0 },
{ 6, "Increases agility of your pet, making it faster in combat.", "🏃", "Agility Training", 1, "[3]", 0 },
{ 7, "Increases perception of your pet, making it more aware of its surroundings.", "👀", "Perception Boost", 1, "[2]", 0 }
});
migrationBuilder.InsertData(
table: "SkillEffects",
columns: new[] { "Id", "Effect", "SkillId", "Tier", "Value" },
values: new object[,]
{
{ 1, "MaxHealth", 1, 1, 25m },
{ 2, "MaxHealth", 1, 2, 50m },
{ 3, "MaxHealth", 1, 3, 100m },
{ 4, "MaxIntelligence", 2, 1, 5m },
{ 5, "MaxIntelligence", 2, 2, 10m },
{ 6, "MaxIntelligence", 2, 3, 20m },
{ 7, "MaxStrength", 3, 1, 5m },
{ 8, "MaxStrength", 3, 2, 10m },
{ 9, "MaxStrength", 3, 3, 20m },
{ 10, "MaxCharisma", 4, 1, 5m },
{ 11, "MaxCharisma", 4, 2, 10m },
{ 12, "MaxCharisma", 4, 3, 20m },
{ 13, "Luck", 5, 1, 1m },
{ 14, "Luck", 5, 2, 2m },
{ 15, "Luck", 5, 3, 3m },
{ 16, "Agility", 6, 1, 1m },
{ 17, "Agility", 6, 2, 2m },
{ 18, "Agility", 6, 3, 3m },
{ 19, "Perception", 7, 1, 1m },
{ 20, "Perception", 7, 2, 2m },
{ 21, "Perception", 7, 3, 3m }
});
migrationBuilder.CreateIndex(
name: "IX_EquippedItems_GameItemId",
table: "EquippedItems",
column: "GameItemId");
migrationBuilder.CreateIndex(
name: "IX_EquippedItems_PetId",
table: "EquippedItems",
column: "PetId");
migrationBuilder.CreateIndex(
name: "IX_PetSkills_PetId",
table: "PetSkills",
column: "PetId");
migrationBuilder.CreateIndex(
name: "IX_PetSkills_SkillId",
table: "PetSkills",
column: "SkillId");
migrationBuilder.CreateIndex(
name: "IX_SkillEffects_SkillId",
table: "SkillEffects",
column: "SkillId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "EquippedItems");
migrationBuilder.DropTable(
name: "Inventories");
migrationBuilder.DropTable(
name: "PetSkills");
migrationBuilder.DropTable(
name: "PetStats");
migrationBuilder.DropTable(
name: "Resources");
migrationBuilder.DropTable(
name: "SkillEffects");
migrationBuilder.DropTable(
name: "GameItems");
migrationBuilder.DropTable(
name: "Pets");
migrationBuilder.DropTable(
name: "Skills");
}
}
}