fix: backtick-quote reserved word 'range' in spells SQL
This commit is contained in:
parent
b3218ee9cd
commit
ba02ffcfcb
3 changed files with 4 additions and 4 deletions
|
|
@ -5,7 +5,7 @@ CREATE TABLE IF NOT EXISTS spells (
|
||||||
tier TINYINT NOT NULL,
|
tier TINYINT NOT NULL,
|
||||||
casting_stat ENUM('INT', 'WIS') NOT NULL,
|
casting_stat ENUM('INT', 'WIS') NOT NULL,
|
||||||
duration VARCHAR(100) NOT NULL DEFAULT 'Instant',
|
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,
|
is_focus TINYINT NOT NULL DEFAULT 0,
|
||||||
description TEXT NOT NULL DEFAULT '',
|
description TEXT NOT NULL DEFAULT '',
|
||||||
UNIQUE KEY uq_spells_name_class (name, class)
|
UNIQUE KEY uq_spells_name_class (name, class)
|
||||||
|
|
|
||||||
|
|
@ -590,7 +590,7 @@ router.get("/:id/spells", requireAuth, async (req, res, next) => {
|
||||||
try {
|
try {
|
||||||
const [rows] = await db.execute<RowDataPacket[]>(
|
const [rows] = await db.execute<RowDataPacket[]>(
|
||||||
`SELECT cs.id, cs.spell_id, cs.exhausted, cs.locked_until, cs.focus_active, cs.focus_started_at,
|
`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
|
FROM character_spells cs
|
||||||
JOIN spells s ON s.id = cs.spell_id
|
JOIN spells s ON s.id = cs.spell_id
|
||||||
WHERE cs.character_id = ?
|
WHERE cs.character_id = ?
|
||||||
|
|
@ -610,7 +610,7 @@ router.post("/:id/spells", requireAuth, async (req, res, next) => {
|
||||||
[req.params.id, spell_id]
|
[req.params.id, spell_id]
|
||||||
);
|
);
|
||||||
const [rows] = await db.execute<RowDataPacket[]>(
|
const [rows] = await db.execute<RowDataPacket[]>(
|
||||||
`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
|
FROM character_spells cs JOIN spells s ON s.id = cs.spell_id
|
||||||
WHERE cs.character_id = ? AND cs.spell_id = ?`,
|
WHERE cs.character_id = ? AND cs.spell_id = ?`,
|
||||||
[req.params.id, spell_id]
|
[req.params.id, spell_id]
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ export async function seedSpells(): Promise<void> {
|
||||||
|
|
||||||
for (const spell of SPELLS) {
|
for (const spell of SPELLS) {
|
||||||
await db.execute<ResultSetHeader>(
|
await db.execute<ResultSetHeader>(
|
||||||
"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]
|
[spell.name, spell.class, spell.tier, spell.casting_stat, spell.duration, spell.range, spell.is_focus, spell.description]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue