Fix #4470: Add version in name#4475
Conversation
rtibbles
left a comment
There was a problem hiding this comment.
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.
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.
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.
Excellent, this looks like the right change now, I'll test it out!
rtibbles
left a comment
There was a problem hiding this comment.
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.
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.
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.
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.
Thanks, I'll test locally, and then hopefully this should be good to merge!
Signed-off-by: PoJuDeSu <spes9850401@gmail.com>
Fix #4470
Summary
Description of the change(s) you made
Changes
save_export_databasefunction and its calling context within thecreate_content_databasefunction. 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.
yarnandpip)