Upsert monsterbook cards instead of delete -> insert

Also use existing connection during character saving for proper rollback.
This commit is contained in:
P0nk
2022-01-19 17:55:23 +01:00
parent 507ab06721
commit d6192385dd
4 changed files with 27 additions and 58 deletions

View File

@@ -0,0 +1,4 @@
ALTER TABLE cosmic.`monsterbook`
CHANGE COLUMN `charid` `charid` INT(11) NOT NULL,
ADD PRIMARY KEY (`charid`, `cardid`),
ADD CONSTRAINT `FK_monsterbook_1` FOREIGN KEY (`charid`) REFERENCES `characters` (`id`) ON UPDATE CASCADE ON DELETE CASCADE;