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

Pull "static models" out of the DB #1048

Open
mzur opened this issue Jan 16, 2025 · 0 comments
Open

Pull "static models" out of the DB #1048

mzur opened this issue Jan 16, 2025 · 0 comments

Comments

@mzur
Copy link
Member

mzur commented Jan 16, 2025

There are several "static models" such as \Biigle\Role that are never changed. They only have an ID and a name and exist as foreign keys on several tables. To speed things up, these models are completely cached. But they don't have to exist in the database at all. They could basically be enums with fixed IDs and values. The IDs are put into the database as well but not as foreign keys to a table. This way, no foreign key checks are required, no queries are required and no caching is required.

Implement the static models as enums (or similar) with ID and name. Implement a migration that first updates all existing foreign key colums so the previous IDs of the static models match the new hard-coded IDs. Then drop the static model database tables.

Static models in biigle/core:

  • \Biigle\MediaType
  • \Biigle\Role
  • \Biigle\Shape
  • \Biigle\Visibility
  • \Biigle\ReportType

Static models in biigle/maia:

  • MaiaJobState
@mzur mzur moved this to Medium Priority in BIIGLE Roadmap Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Medium Priority
Development

No branches or pull requests

1 participant