diff --git a/server/migrations/002_spells.sql b/server/migrations/002_spells.sql index 99c6ada..955e032 100644 --- a/server/migrations/002_spells.sql +++ b/server/migrations/002_spells.sql @@ -5,7 +5,7 @@ CREATE TABLE IF NOT EXISTS spells ( tier TINYINT NOT NULL, casting_stat ENUM('INT', 'WIS') NOT NULL, duration VARCHAR(100) NOT NULL DEFAULT 'Instant', - range VARCHAR(100) NOT NULL DEFAULT 'Near', + `range` VARCHAR(100) NOT NULL DEFAULT 'Near', is_focus TINYINT NOT NULL DEFAULT 0, description TEXT NOT NULL DEFAULT '', UNIQUE KEY uq_spells_name_class (name, class) diff --git a/server/src/routes/characters.ts b/server/src/routes/characters.ts index d1653f0..6d38281 100644 --- a/server/src/routes/characters.ts +++ b/server/src/routes/characters.ts @@ -590,7 +590,7 @@ router.get("/:id/spells", requireAuth, async (req, res, next) => { try { const [rows] = await db.execute( `SELECT cs.id, cs.spell_id, cs.exhausted, cs.locked_until, cs.focus_active, cs.focus_started_at, - s.name, s.class, s.tier, s.casting_stat, s.duration, s.range, s.is_focus, s.description + s.name, s.class, s.tier, s.casting_stat, s.duration, s.\`range\`, s.is_focus, s.description FROM character_spells cs JOIN spells s ON s.id = cs.spell_id WHERE cs.character_id = ? @@ -610,7 +610,7 @@ router.post("/:id/spells", requireAuth, async (req, res, next) => { [req.params.id, spell_id] ); const [rows] = await db.execute( - `SELECT cs.*, s.name, s.class, s.tier, s.casting_stat, s.duration, s.range, s.is_focus, s.description + `SELECT cs.*, s.name, s.class, s.tier, s.casting_stat, s.duration, s.\`range\`, s.is_focus, s.description FROM character_spells cs JOIN spells s ON s.id = cs.spell_id WHERE cs.character_id = ? AND cs.spell_id = ?`, [req.params.id, spell_id] diff --git a/server/src/seed-spells.ts b/server/src/seed-spells.ts index bf6c4bd..af96e8c 100644 --- a/server/src/seed-spells.ts +++ b/server/src/seed-spells.ts @@ -48,7 +48,7 @@ export async function seedSpells(): Promise { for (const spell of SPELLS) { await db.execute( - "INSERT INTO spells (name, class, tier, casting_stat, duration, range, is_focus, description) VALUES (?, ?, ?, ?, ?, ?, ?, ?)", + "INSERT INTO spells (name, class, tier, casting_stat, duration, `range`, is_focus, description) VALUES (?, ?, ?, ?, ?, ?, ?, ?)", [spell.name, spell.class, spell.tier, spell.casting_stat, spell.duration, spell.range, spell.is_focus, spell.description] ); }