-
Notifications
You must be signed in to change notification settings - Fork 228
Fix #4470: Add version in name #4475
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
Fix #4470: Add version in name #4475
Conversation
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.
Halfway there! Just need to implement both paths.
def save_export_database(channel_id, version): | ||
logging.debug("Saving export database") | ||
current_export_db_location = get_active_content_database() | ||
target_export_db_location = os.path.join(settings.DB_ROOT, "{id}.sqlite3".format(id=channel_id)) |
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.
Hi @poju3185 - just one thing to flag here, if you read the issue carefully, you will see that it is desirable to continue to export the channel database to the current location as well. The issue is asking to save the database to both the old path and the new path. This means we can keep an archive of the channel databases, but continue to have the 'latest' with the simple name.
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.
I've made the adjustments based on the feedback, and now the database is being saved to both the old and new paths. Thanks for pointing this out!
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.
Excellent, this looks like the right change now, I'll test it out!
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.
Just one more tweak needed that showed up in manual testing.
progress_tracker.track(90) | ||
map_prerequisites(channel.main_tree) | ||
save_export_database(channel.pk) | ||
save_export_database(channel.pk, channel.version) |
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.
This works perfectly except for one thing - the channel version gets incremented after this function is called (look above to see where create_content_database
and increment_channel_version
are called respectively!)
So, here you need to instead pass in channel.version + 1
and add a code comment as to why we are incrementing it here.
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.
You will see similar logic happening inside the map_channel_to_kolibri_channel
function where the version written into the database is incremented by one also.
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.
I've made the adjustments to pass in channel.version + 1
as suggested and added a comment in the code to explain why we're incrementing the version at this point. Thank you for pointing that out!
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.
Thanks, I'll test locally, and then hopefully this should be good to merge!
Signed-off-by: PoJuDeSu <[email protected]>
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.
Manual testing checks out, this is good to go! Thank you @poju3185
Fix #4470
Summary
Description of the change(s) you made
Changes
save_export_database
function and its calling context within thecreate_content_database
function. The goal is to include the channel version in the exported SQLite database filename.Manual verification steps performed
./.docker/minio/content/databases/
to see the exported sqlite3 file name.Reviewer's Checklist
This section is for reviewers to fill out.
yarn
andpip
)