Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding more than 1 suggested similar game fails #4

Closed
NilsFagerburg opened this issue Jan 5, 2021 · 4 comments · Fixed by iftechfoundation/ifdb#149
Closed

Adding more than 1 suggested similar game fails #4

NilsFagerburg opened this issue Jan 5, 2021 · 4 comments · Fixed by iftechfoundation/ifdb#149
Labels
Bug Something isn't working recommendations Recommend and highlight the best games

Comments

@NilsFagerburg
Copy link

Adding a suggested similar game (on the crossrec page, e.g. https://ifdb.tads.org/crossrec?game=v41tydzz51khw6ab&edit) to a game for which you've already added a suggested similar game fails with the following error message:

An error occurred deleting the suggestion from the database. You might try the operation again in a few minutes, or contact us if the problem persists.

@Durafen
Copy link

Durafen commented Jan 25, 2021

This happens because column fromgame in table crossrecs defined as primary key, so only one entry can be suggested for every game.
I tried setting created as a primary key for example, the suggestions function is back to work as intended.

@vaughany vaughany added the Bug Something isn't working label Jan 25, 2021
@lkcampbell
Copy link
Collaborator

lkcampbell commented Mar 17, 2021

@Durafen, what about putting a new id column in the table as the primary key and remove fromgame as a primary key? id seems to be the default primary key column name. Or maybe it doesn't even need a primary key?

@Durafen
Copy link

Durafen commented Mar 17, 2021

Both of this options will work.
Removing the unique primary index is the easier way (no need for coding, only table altering).

@Durafen
Copy link

Durafen commented Mar 18, 2021

It's better to have a unique key, so another simple option may be to set created as primary unique key.

MariaDB [ifdb]> DESCRIBE crossrecs;
+----------+-------------+------+-----+---------+-------+
| Field    | Type        | Null | Key | Default | Extra |
+----------+-------------+------+-----+---------+-------+
| fromgame | varchar(32) | NO   | PRI | NULL    |       |
| togame   | varchar(32) | NO   |     | NULL    |       |
| userid   | varchar(32) | NO   | MUL | NULL    |       |
| notes    | mediumtext  | YES  |     | NULL    |       |
| created  | datetime    | NO   |     | NULL    |       |
+----------+-------------+------+-----+---------+-------+

@dfabulich Opinion? Which way is going to be more suitable?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working recommendations Recommend and highlight the best games
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants