Загрузка данных


ㅤ, [May 22, 2026 at 12:27]
{
  "tables": [
    {
      "name": "players",
      "columns": [
        { "name": "player_id", "type": "bigserial", "primaryKey": true },
        { "name": "username", "type": "varchar(50)", "unique": true, "notNull": true },
        { "name": "password_hash", "type": "text", "notNull": true },
        { "name": "level", "type": "int", "default": 1 },
        { "name": "experience", "type": "int", "default": 0 },
        { "name": "wins", "type": "int", "default": 0 },
        { "name": "losses", "type": "int", "default": 0 },
        { "name": "created_at", "type": "timestamp", "default": "CURRENT_TIMESTAMP" }
      ]
    },
    {
      "name": "pokemons",
      "columns": [
        { "name": "pokemon_id", "type": "bigserial", "primaryKey": true },
        { "name": "pokemon_name", "type": "varchar(100)", "unique": true, "notNull": true },
        { "name": "element", "type": "varchar(20)", "notNull": true },
        { "name": "base_hp", "type": "int", "notNull": true },
        { "name": "base_attack", "type": "int", "notNull": true },
        { "name": "base_defense", "type": "int", "notNull": true },
        { "name": "base_speed", "type": "int", "notNull": true },
        { "name": "description", "type": "text" }
      ]
    },
    {
      "name": "pokemon_attacks",
      "columns": [
        { "name": "attack_id", "type": "bigserial", "primaryKey": true },
        { "name": "pokemon_id", "type": "bigint", "notNull": true },
        { "name": "attack_name", "type": "varchar(100)", "notNull": true },
        { "name": "base_damage", "type": "int", "notNull": true },
        { "name": "element", "type": "varchar(20)", "notNull": true },
        { "name": "description", "type": "text" }
      ]
    },
    {
      "name": "player_pokemons",
      "columns": [
        { "name": "player_pokemon_id", "type": "bigserial", "primaryKey": true },
        { "name": "player_id", "type": "bigint", "notNull": true },
        { "name": "pokemon_id", "type": "bigint", "notNull": true },
        { "name": "nickname", "type": "varchar(100)" },
        { "name": "current_hp", "type": "int", "notNull": true },
        { "name": "max_hp", "type": "int", "notNull": true },
        { "name": "attack_stat", "type": "int", "notNull": true },
        { "name": "defense_stat", "type": "int", "notNull": true },
        { "name": "speed_stat", "type": "int", "notNull": true },
        { "name": "pokemon_level", "type": "int", "default": 1 },
        { "name": "pokemon_experience", "type": "int", "default": 0 }
      ]
    },
    {
      "name": "items",
      "columns": [
        { "name": "item_id", "type": "bigserial", "primaryKey": true },
        { "name": "item_name", "type": "varchar(100)", "unique": true, "notNull": true },
        { "name": "item_type", "type": "varchar(50)", "notNull": true },
        { "name": "effect_value", "type": "int", "notNull": true },
        { "name": "description", "type": "text" }
      ]
    },
    {
      "name": "inventory",
      "columns": [
        { "name": "inventory_id", "type": "bigserial", "primaryKey": true },
        { "name": "player_id", "type": "bigint", "notNull": true },
        { "name": "item_id", "type": "bigint", "notNull": true },
        { "name": "quantity", "type": "int", "default": 0 }
      ]
    },
    {
      "name": "battle_sessions",
      "columns": [
        { "name": "battle_id", "type": "bigserial", "primaryKey": true },
        { "name": "player1_id", "type": "bigint", "notNull": true },
        { "name": "player2_id", "type": "bigint", "notNull": true },
        { "name": "status", "type": "varchar(20)", "default": "waiting" },
        { "name": "turn_number", "type": "int", "default": 0 },
        { "name": "current_player_id", "type": "bigint" },
        { "name": "winner_id", "type": "bigint" },
{ "name": "created_at", "type": "timestamp", "default": "CURRENT_TIMESTAMP" },
        { "name": "finished_at", "type": "timestamp" }
      ]
    },
    {
      "name": "battle_pokemons",
      "columns": [
        { "name": "battle_pokemon_id", "type": "bigserial", "primaryKey": true },
        { "name": "battle_id", "type": "bigint", "notNull": true },
        { "name": "player_id", "type": "bigint", "notNull": true },
        { "name": "player_pokemon_id", "type": "bigint", "notNull": true },
        { "name": "slot_order", "type": "int", "notNull": true },
        { "name": "is_active", "type": "boolean", "default": false },
        { "name": "battle_hp", "type": "int", "notNull": true },
        { "name": "battle_attack", "type": "int", "notNull": true },
        { "name": "battle_defense", "type": "int", "notNull": true },
        { "name": "battle_speed", "type": "int", "notNull": true },
        { "name": "is_defeated", "type": "boolean", "default": false }
      ]
    },
    {
      "name": "battle_turns",
      "columns": [
        { "name": "turn_id", "type": "bigserial", "primaryKey": true },
        { "name": "battle_id", "type": "bigint", "notNull": true },
        { "name": "turn_number", "type": "int", "notNull": true },
        { "name": "player_id", "type": "bigint", "notNull": true },
        { "name": "inventory_id", "type": "bigint" },
        { "name": "attacking_pokemon_id", "type": "bigint" },
        { "name": "defending_pokemon_id", "type": "bigint" },
        { "name": "attack_id", "type": "bigint" },
        { "name": "action", "type": "varchar(20)", "notNull": true },
        { "name": "damage_dealt", "type": "int", "default": 0 },
        { "name": "created_at", "type": "timestamp", "default": "CURRENT_TIMESTAMP" }
      ]
    }
  ],
  "relationships": [
    {
      "table": "pokemon_attacks",
      "column": "pokemon_id",
      "refTable": "pokemons",
      "refColumn": "pokemon_id"
    },
    {
      "table": "player_pokemons",
      "column": "player_id",
      "refTable": "players",
      "refColumn": "player_id"
    },
    {
      "table": "player_pokemons",
      "column": "pokemon_id",
      "refTable": "pokemons",
      "refColumn": "pokemon_id"
    },
    {
      "table": "inventory",
      "column": "player_id",
      "refTable": "players",
      "refColumn": "player_id"
    },
    {
      "table": "inventory",
      "column": "item_id",
      "refTable": "items",
      "refColumn": "item_id"
    },
    {
      "table": "battle_sessions",
      "column": "player1_id",
      "refTable": "players",
      "refColumn": "player_id"
    },
    {
      "table": "battle_sessions",
      "column": "player2_id",
      "refTable": "players",
      "refColumn": "player_id"
    },
    {
      "table": "battle_sessions",
      "column": "current_player_id",
      "refTable": "players",
      "refColumn": "player_id"
    },
    {
      "table": "battle_sessions",
      "column": "winner_id",
      "refTable": "players",
      "refColumn": "player_id"
    },
    {
      "table": "battle_pokemons",
      "column": "battle_id",
      "refTable": "battle_sessions",
      "refColumn": "battle_id"
    },
    {
      "table": "battle_pokemons",
      "column": "player_id",
      "refTable": "players",
      "refColumn": "player_id"
    },
    {
      "table": "battle_pokemons",
      "column": "player_pokemon_id",
      "refTable": "player_pokemons",
      "refColumn": "player_pokemon_id"
    },
    {
      "table": "battle_turns",
      "column": "battle_id",
      "refTable": "battle_sessions",
      "refColumn": "battle_id"
    },
    {
      "table": "battle_turns",
      "column": "player_id",
      "refTable": "players",
      "refColumn": "player_id"
    },
    {
      "table": "battle_turns",
      "column": "inventory_id", "refTable": "inventory",
      "refColumn": "inventory_id"
    },
    {
      "table": "battle_turns",
      "column": "attacking_pokemon_id",
      "refTable": "battle_pokemons",
      "refColumn": "battle_pokemon_id"
    },
    {
      "table": "battle_turns",
      "column": "defending_pokemon_id",
      "refTable": "battle_pokemons",
      "refColumn": "battle_pokemon_id"
    },
    {
      "table": "battle_turns",
      "column": "attack_id",
      "refTable": "pokemon_attacks",
      "refColumn": "attack_id"
    }
  ]
}