minetoblend / hifumin

Discord gacha bot for osu mappers
7 stars 2 forks source link

Support 5-length IDs #8

Closed pckv closed 1 month ago

pckv commented 1 month ago

I setup the bot locally and tested every command interacting with cards. They should all support 5-length IDs with these changes now

New cards are generated with 5-length IDs starting at aaaaa

Requires changing card.id to char(5) in the DB. My migration is shown below so just run each line one-by-one to first remove the constraints (ignoring them seemed to not work) and then add them back. Probably have to replace the two foreign keys with whatever names are generated for your DBs. I didn't test with synchronize in typeorm, maybe that also works

-- drop foreign key constraints using card.id
ALTER TABLE hifumin.trade_offer DROP FOREIGN KEY FK_d2ae2895fd7b7bc3bdb59627b47;
ALTER TABLE hifumin.job_assignment DROP FOREIGN KEY FK_090f9cdadc3494903c11f8bae5a;

ALTER TABLE hifumin.card MODIFY COLUMN id char(5) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL;

-- add back the removed foreign key constraints
ALTER TABLE hifumin.trade_offer ADD CONSTRAINT FK_d2ae2895fd7b7bc3bdb59627b47 FOREIGN KEY (card_id) REFERENCES hifumin.card(id);
ALTER TABLE hifumin.job_assignment ADD CONSTRAINT FK_090f9cdadc3494903c11f8bae5a FOREIGN KEY (card_id) REFERENCES hifumin.card(id);
OliBomby commented 1 month ago

image

pckv commented 1 month ago

personally i prefer the idea of drops being disabled after 9999 but here's a fix regardless. either works fine for me. deleting the bot really sucks for the players

minetoblend commented 1 month ago

deleting the bot might suck for the players but keeping it up sucks for me

pckv commented 1 month ago

that's fine, too, i get it. will you at least release a dump of the db when it's over so the history isn't lost to time?