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

Rename database objects/models #124

Closed
andreaskoepf opened this issue Dec 28, 2022 · 5 comments
Closed

Rename database objects/models #124

andreaskoepf opened this issue Dec 28, 2022 · 5 comments
Assignees
Labels

Comments

@andreaskoepf
Copy link
Collaborator

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
@alexandrelefourner
Copy link
Contributor

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.

@andreaskoepf
Copy link
Collaborator Author

Do you want to only modify these or should we also edit tables such as person_stats to user_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 PostReaction class in post_reaction.py to MessageReaction with file name message_reaction.py, right ?

yes,exactly!

@andreaskoepf
Copy link
Collaborator Author

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) ...

@andreaskoepf
Copy link
Collaborator Author

andreaskoepf commented Dec 28, 2022

@alexandrelefourner just saw there is #115 which should be merged first...

@andreaskoepf
Copy link
Collaborator Author

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

No branches or pull requests

2 participants