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

Username and email fields in the galaxy_user table should have unique constraints #18487

Closed
2 tasks done
jdavcs opened this issue Jul 2, 2024 · 1 comment
Closed
2 tasks done
Assignees
Labels
area/database Galaxy's database or data access layer kind/bug

Comments

@jdavcs
Copy link
Member

jdavcs commented Jul 2, 2024

Galaxy version: 24.1

Specific error: duplicate usernames in galaxy_user table cause MultipleResultsFound errors when selecting one-or-none by username
Sentry error: https://sentry.galaxyproject.org/share/issue/7f671f6ec69f48d7bd5ae407e488f4f5/

This error is due to duplicate usernames in the galaxy_user table on main.

The underlying cause is the absence of a unique constraint on the username field in the galaxy_user table. The constraint exists in the model definition, but not in the database. There is no way to tell how and when the database schema on main was updated (the model definition blame history goes back 15+ years), but it's obvious that the constraint was never created on the database. This does not concern instances with a newer database.

The unique constraint on the username field should be added to the database via migration, which will ensure that older instances will have their databases updated once the migration is run.

The same applies to the email field: there should be a unique constraint (which, unlike username, is not defined in the model). This, too, should be added via migration.

In both cases, the migration should include a data migration to fix the duplicate records that would prevent these edits to the db schema. Deduplication can be handled via existing logic (see #18379 for similar example).

To do:

@jdavcs
Copy link
Member Author

jdavcs commented Sep 26, 2024

Fixed in #18493

@jdavcs jdavcs closed this as completed Sep 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/database Galaxy's database or data access layer kind/bug
Projects
None yet
Development

No branches or pull requests

1 participant