-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
[#12048] Data migration for course entities #12980
[#12048] Data migration for course entities #12980
Conversation
Hi @mingyuanc, thank you for your interest in contributing to TEAMMATES!
Please address the above before we proceed to review your PR. |
3097e6e
to
1efd038
Compare
protected boolean isMigrationNeeded(Course entity) { | ||
HibernateUtil.beginTransaction(); | ||
teammates.storage.sqlentity.Course course = HibernateUtil.get( | ||
teammates.storage.sqlentity.Course.class, entity.getUniqueId()); | ||
HibernateUtil.commitTransaction(); | ||
return course == null; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@NicolasCwy
Is it gonna be costly to query the sql db for every entity here?
Also do we need a MarkIsMigrated
script for Course
like the MarkIsMigratedForAccounts.java
since Course has a isMigrated
field? If needed then maybe can just check if !isMigrated
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now we can comment the isMigratedNeeded
body and return True @mingyuanc, let's get the scripts down then worry about improvements later
@yuanxi1 We'll see what the requirements are for migrating on prod and add this later if need be, for now you can just keep that script in mind if you need it later
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
@mingyuanc Please fix the lint errors! So that when we merge to master we won't cause other CI to fail |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM thanks for getting this done so fast. Have you tested this locally to verify the migration and also the verification?
If so once the CI checks pass go ahead and merge it
Part of #12048
Outline of Solution:
Abstracted away seed functions
Add migrating and verification scripts for course entity