Open-Assistant
Open-Assistant copied to clipboard
Rename database objects/models
With the latest planning iteration (see YK's presentation) some object-names were changed. To reduce confusion the naming should be updated throughout the system (it is early enough to do this breaking change).
| Old | New |
|---|---|
| person | user |
| post | message |
| post_reaction | message_reaction |
| thread | message_tree |
| work_package | task |
Hi ! I started to work on this. However, I have a few questions :
Do you want to only modify these or should we also edit tables such as person_stats to user_stats ?
Also, I suppose it would also be better to update PostReaction class in post_reaction.py to MessageReaction with file name message_reaction.py, right ?
Thank you.
Do you want to only modify these or should we also edit tables such as
person_statstouser_stats?
Yes, exactly all existing tables/models/columns etc. should be adapted, for example:
table: person_stats -> user_stats
column: person_id -> user_id
model: PersonStats -> UserStates
filename: person_stats.py -> user_stats.py
index names, e.g. ix_person_username -> ix_user_username
Also, I suppose it would also be better to update
PostReactionclass inpost_reaction.pytoMessageReactionwith file namemessage_reaction.py, right ?
yes,exactly!
If alembic revision --autogenerate -m rename_database_objects doesn't generate the correct code for the payload-JSONB columns please look in the old migration scripts and replace what alembic generated by something like sa.Column("payload", JSONB(astext_type=sa.Text()), nullable=False) ...
@alexandrelefourner just saw there is #115 which should be merged first...
@alexandrelefourner Suggestion: I think it would be best to do the renaming in more than one step, like starting frist with Person->User as a single PR and them working forward .. if we try everything at once it will probably create a lot of conflicts. What do you think? :-) This renaming is unfortunately/naturally affecting a lot of other code.