Files
dmtools/migrations/Version20260922064937.php
FrankandClaude Sonnet 5 9052218927 Characters: build the page around Darragh Oakwanderer's sheet
Replaces the Characters placeholder with a real 5e character sheet
feature, following the same read-only-detail/edit-split/game-notes
pattern as NPCs and Enemies:

- Character entity: identity, combat vitals, six ability scores, saving
  throw and skill proficiencies (computed modifiers, not stored), a
  small attacks table, and the sheet's freeform boxes (features,
  equipment, personality, appearance, backstory, allies, treasure).
- Detail page shows the portrait uncropped, then the sheet - genuine
  <table>s for ability scores, skills and attacks, since that's the one
  part of a character sheet that actually is a table; everything else
  reuses the prose helpers from the enemy stat block. Game notes are
  the only editable field here, same as Enemy/NPC.
- Edit page covers every field via CharacterType; the attack rows are
  six plain inputs handled by hand (not a Symfony collection field),
  since it's a short fixed-shape table, not a dynamic list.
- Portraits follow the NPC convention: assets/image/characters/<NameNo
  Spaces>.png, computed path, not a DB column.
- Imported the example sheet from assets/characters/ (Darragh
  Oakwanderer, halfling ranger) directly into the database.

Tests: entity math (ability/save/skill modifiers, passive perception,
portrait path), template rendering for show/edit/index (catches broken
Twig/macro/path()/asset() calls), and the login-gate redirect. 21/21
passing; schema validate clean.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-22 08:55:28 +02:00

30 lines
2.1 KiB
PHP

<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20260922064937 extends AbstractMigration
{
public function getDescription(): string
{
return 'Add character_sheet table for player character sheets';
}
public function up(Schema $schema): void
{
$this->addSql('CREATE TABLE character_sheet (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(160) NOT NULL, player_name VARCHAR(120) DEFAULT NULL, race VARCHAR(120) DEFAULT NULL, character_class VARCHAR(80) DEFAULT NULL, level SMALLINT NOT NULL, background VARCHAR(120) DEFAULT NULL, alignment VARCHAR(40) DEFAULT NULL, experience_points INT DEFAULT NULL, armor_class SMALLINT DEFAULT NULL, initiative SMALLINT DEFAULT NULL, speed VARCHAR(60) DEFAULT NULL, hit_point_maximum SMALLINT DEFAULT NULL, current_hit_points SMALLINT DEFAULT NULL, temporary_hit_points SMALLINT DEFAULT NULL, hit_dice VARCHAR(40) DEFAULT NULL, proficiency_bonus SMALLINT NOT NULL, inspiration TINYINT NOT NULL, strength SMALLINT NOT NULL, dexterity SMALLINT NOT NULL, constitution SMALLINT NOT NULL, intelligence SMALLINT NOT NULL, wisdom SMALLINT NOT NULL, charisma SMALLINT NOT NULL, saving_throw_proficiencies JSON NOT NULL, skill_proficiencies JSON NOT NULL, attacks JSON NOT NULL, other_proficiencies_languages LONGTEXT DEFAULT NULL, equipment LONGTEXT DEFAULT NULL, features_traits LONGTEXT DEFAULT NULL, spellcasting LONGTEXT DEFAULT NULL, personality_traits LONGTEXT DEFAULT NULL, ideals LONGTEXT DEFAULT NULL, bonds LONGTEXT DEFAULT NULL, flaws LONGTEXT DEFAULT NULL, appearance LONGTEXT DEFAULT NULL, backstory LONGTEXT DEFAULT NULL, allies_organizations LONGTEXT DEFAULT NULL, treasure LONGTEXT DEFAULT NULL, game_notes LONGTEXT DEFAULT NULL, updated_at DATETIME DEFAULT NULL, UNIQUE INDEX uniq_character_name (name), PRIMARY KEY (id)) DEFAULT CHARACTER SET utf8mb4 ENGINE = InnoDB');
}
public function down(Schema $schema): void
{
$this->addSql('DROP TABLE character_sheet');
}
}