-
Notifications
You must be signed in to change notification settings - Fork 75
Handle empty user and participant names #511
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
Conversation
|
DB constraint is maybe a bit too much for it, how about just rejecting it in the schema? def not_empty(value):
if not value:
raise ValidationError('This field cannot be empty.') |
5023f8f to
42b90d2
Compare
42b90d2 to
c861b55
Compare
|
This PR contains database changes. Before merging it, make sure to apply the migration in production: BEGIN;
-- Running upgrade 30b5fe7b5949 -> cab5d47c1152
UPDATE participants
SET name = '?'
WHERE name= '';;
UPDATE alembic_version SET version_num='cab5d47c1152' WHERE alembic_version.version_num = '30b5fe7b5949';
COMMIT;When reviewing the PR, make sure that the changes will not break the previously deployed |
newdle/migrations/versions/20250701_c1_set_interrogation_participant_names.py
Outdated
Show resolved
Hide resolved
c861b55 to
b46b8e1
Compare
|
I wonder if it's worth to add anything to the downgrade code like: def downgrade():
op.execute(
"""
UPDATE participants
SET name = NULL
WHERE name = '?';
"""
)Since this is fixing a "bug"... probably not? |
newdle/migrations/versions/20250704_1127_cab5d47c1152_add_interrogation_participant.py
Outdated
Show resolved
Hide resolved
newdle/migrations/versions/20250704_1127_cab5d47c1152_add_interrogation_participant.py
Outdated
Show resolved
Hide resolved
No, it's a fix, so it makes sense to leave the downgrade step empty. |
|
For the broken comment about the alembic revision here in this PR, can you try removing these 3 lines? https://github.com/indico/newdle/blob/master/ci/print_revision_sql.sh#L14-L16 Not sure why they were needed... Edit: Ah, probably because it gets passed into github output later... https://github.com/indico/newdle/blob/master/.github/workflows/migration-sql-comment.yml#L48 |
c5e4c85 to
d445709
Compare
Set default name for participants with no name in migration
a193524 to
28b80bb
Compare
|
Thanks @renefs!! |
Handles empty names on avatars for users and participants.name_not_emptyvalidation in the participant schema.Fixes #502