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

Ensure that shipping the item _commit fix doesn't break existing databases #62

Open
simonw opened this issue Nov 20, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@simonw
Copy link
Owner

simonw commented Nov 20, 2022

An interesting challenge with this change: since it modifies the schema, shipping a release with it could break existing databases the next time git-history file ... is run against them.

This would affect my workflow here for example: https://github.com/simonw/scrape-instances-social/blob/main/.github/workflows/scrape.yml

Originally posted by @simonw in #59 (comment)

@simonw
Copy link
Owner Author

simonw commented Nov 20, 2022

Worth noting that this really was a bug: the code was designed to create that _commit column but failed to because it mutated a copy of the item from the array, not the original object:

for item in items:
item = jsonify_all(fix_reserved_columns(item))
item["_commit"] = commit_pk
db[item_table].insert_all(
items,
column_order=("_id",),
alter=True,
foreign_keys=(("_commit", "commits", "id"),),
)

I'm going to detect if the item_table is missing that _commit column and add it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant