Handle empty user and participant names#511
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 |
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? |
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