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

make upgrade script names unique #8550

Closed
barisusakli opened this issue Aug 7, 2020 · 6 comments
Closed

make upgrade script names unique #8550

barisusakli opened this issue Aug 7, 2020 · 6 comments
Assignees
Milestone

Comments

@barisusakli
Copy link
Member

Right now it is possible to create upgrade scripts with duplicates which would cause the script to not run at all.

@barisusakli barisusakli added this to the 1.15.0 milestone Aug 7, 2020
@julianlam
Copy link
Member

Writing a test? 😛

@barisusakli
Copy link
Member Author

I don't even know if this is fixable because all the upgrade scripts are already in schemaLog like this

{ "_key" : "schemaLog", "value" : "remove_flag_reporters_zset", "score" : 1596214542878 }
{ "_key" : "schemaLog", "value" : "consolidate_flags", "score" : 1595616104011 }
{ "_key" : "schemaLog", "value" : "track_flags_by_target", "score" : 1595119081284 }
{ "_key" : "schemaLog", "value" : "readd_deleted_recent_topics", "score" : 1594226733929 }
{ "_key" : "schemaLog", "value" : "unescape_navigation_titles", "score" : 1593293879622 }
{ "_key" : "schemaLog", "value" : "fix_category_image_field", "score" : 1591729494708 }
{ "_key" : "schemaLog", "value" : "remove_allowFileUploads_priv", "score" : 1590110492477 }
{ "_key" : "schemaLog", "value" : "fix_users_sorted_sets", "score" : 1588436379784 }
{ "_key" : "schemaLog", "value" : "clean_post_topic_hash", "score" : 1570504049203 }
{ "_key" : "schemaLog", "value" : "cleanup_old_notifications", "score" : 1570502545917 }
{ "_key" : "schemaLog", "value" : "notification_type_new_topic", "score" : 1570036597733 }
{ "_key" : "schemaLog", "value" : "missing_langhub_sets", "score" : 1569982274463 }
{ "_key" : "schemaLog", "value" : "remove_long_suggested_tags", "score" : 1569981625594 }
{ "_key" : "schemaLog", "value" : "clean_flag_byCid", "score" : 1569367219940 }
{ "_key" : "schemaLog", "value" : "give_mod_info_privilege", "score" : 1568747522553 }
{ "_key" : "schemaLog", "value" : "dbsearch_change_mongodb_schema", "score" : 1566520649272 }
{ "_key" : "schemaLog", "value" : "user_pid_sets", "score" : 1561471090625 }
{ "_key" : "schemaLog", "value" : "update_registration_type", "score" : 1561176751497 }
{ "_key" : "schemaLog", "value" : "give_mod_privileges", "score" : 1561176751494 }

Where the value is the filename of the upgrade script. Making any change to this logic would cause all upgrade scripts to run again which would probably break on most forums.

Might have to start using the version name as part of the filename for upgrade scripts from now on. So instead of some_new_upgrade_script.js it should be 1.5.0_some_new_upgrade_script.js that way it won't overwrite anything in schemaLog

@barisusakli barisusakli self-assigned this Aug 7, 2020
@pitaj
Copy link
Contributor

pitaj commented Aug 7, 2020

Why not just keep naming them how we are and adding a test to make sure no two scripts have the same name?

@barisusakli
Copy link
Member Author

Went with something else.
8887f0e

@pitaj
Copy link
Contributor

pitaj commented Aug 7, 2020

Does that solution get executed during tests?

barisusakli added a commit that referenced this issue Aug 8, 2020
flush test db after tests are complete
@barisusakli
Copy link
Member Author

There were no tests for upgrades, added one to cover this.

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

No branches or pull requests

3 participants