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

Drop unused column languages.sort_order #205

Open
redrun45 opened this issue Mar 10, 2024 · 5 comments
Open

Drop unused column languages.sort_order #205

redrun45 opened this issue Mar 10, 2024 · 5 comments
Labels

Comments

@redrun45
Copy link
Collaborator

When attempting to add a new language from /admin/language_manager, we get a spinner that doesn't stop. Behind the scenes, the AJAX request returns an HTML error page with this message:

An uncaught Exception was encountered
Type: mysqli_sql_exception
Message: Field 'sort_order' doesn't have a default value
Filename: /librivox/www/librivox.org/catalog/system/database/drivers/mysqli/mysqli_driver.php
Line Number: 307

Looking at the scrubbed database, sort_order can apparently just be 0. When it's not, it lines up (mostly) with alphabetical order, and appears to be manually assigned. I don't know if the languages are ever sorted on this order, so I'm looking for that now.

@redrun45 redrun45 added the bug label Mar 10, 2024
@redrun45
Copy link
Collaborator Author

(stolen from admin thread)

As far as I can tell, we don't actually use sort_order anywhere for languages, even in the API (in fact, https://librivox.org/api/feed/languages does not even appear to be a thing).

@notartom I concur, all of my grep skills fail to illuminate a single case where we use this column. I'd propose adding DEFAULT 0 to it for now, and then we have all the time in the world to test dropping it. 👍

@notartom
Copy link
Member

I'd propose adding DEFAULT 0 to it for now, and then we have all the time in the world to test dropping it. 👍

Yep, that seems safe and sensible. Am I to just YOLO that in prod directly?

@redrun45
Copy link
Collaborator Author

Ha! You know I'm looking for the way to do it on my dev box right now.
What I do know is that we have languages in the database with a sort_order of 0, and they're not hurting anything. If I'm able to add new languages in dev, and they look just like those existing ones, then I think we're as safe as it gets.

@notartom
Copy link
Member

MariaDB [librivox_catalog]> alter table languages alter sort_order set default 0;
Query OK, 0 rows affected (0.463 sec)
Records: 0  Duplicates: 0  Warnings: 0

Seems to have gone well. Let's have someone retry adding the language.

@redrun45
Copy link
Collaborator Author

redrun45 commented Mar 10, 2024

After doing the same to my dev box... I added it from the admin page in prod, using the settings provided. And... it appears to have taken!

I suppose we can leave this issue open until we've dropped that column entirely, and meanwhile it's here if someone discovers issues with language # 101. 👍

@redrun45 redrun45 added enhancement and removed bug labels Mar 11, 2024
@redrun45 redrun45 changed the title Language Manager fails to add new languages - no default sort_order Drop unused column languages.sort_order Mar 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants