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

🐛 Prepare for deletion of the storage_id column from the instance table #915

Merged
merged 4 commits into from
Dec 19, 2024

Conversation

Koncopd
Copy link
Member

@Koncopd Koncopd commented Dec 18, 2024

Always search default storage through the storage table.

Copy link

github-actions bot commented Dec 18, 2024

@github-actions github-actions bot temporarily deployed to pull request December 18, 2024 14:54 Inactive
@@ -251,7 +254,13 @@ def _delete_instance(
check_storage_is_empty(
root_path, account_for_sqlite_file=account_for_sqlite_file
)
_update_instance_record(instance_with_storage["id"], {"storage_id": None}, client)
# remove this code block after migrtion, i.e. deleting 'storage_id' column of 'instance'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can also remove it straight away if we just set the values to None in the hub. I'd actually prefer that.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer to keep it until we actually migrate.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why? I don't see the reason.

It makes the code complicated and unreadable. There is a really nice potential for a refactor once we remove this because the whole backward forward coupling of instance and storage is then finally disentangled.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because we're no longer populating this column the tests are already passing even without deleting anything on the hub.

We still have to go through with it though so that deletions of legacy instances don't start failing.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link

codecov bot commented Dec 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.79%. Comparing base (db43bf3) to head (b18ea0f).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #915      +/-   ##
==========================================
+ Coverage   83.77%   83.79%   +0.01%     
==========================================
  Files          43       43              
  Lines        3434     3432       -2     
==========================================
- Hits         2877     2876       -1     
+ Misses        557      556       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@github-actions github-actions bot temporarily deployed to pull request December 19, 2024 10:09 Inactive
@falexwolf falexwolf merged commit 8426994 into main Dec 19, 2024
13 checks passed
@falexwolf falexwolf deleted the rm_instance_storage branch December 19, 2024 12:17
client.table("instance")
.select("*, storage!instance_storage_id_87963cc8_fk_storage_id(*)")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh no, was this somehow forgotten before?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This FK should have been replaced with the storage_instance_id FK 9 months ago when it was replaced everywhere else. 🤔

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, this is only used during deletion; so it's not a big deal.

instance_with_storage = select_instance_by_id_with_storage(

Maybe it was re-introduced at a later point or something similar.

No user will hit it.

Copy link
Member Author

@Koncopd Koncopd Dec 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it was forgotten, but it is pretty specific thing, only called on deletion by id, so not really user facing.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's great you spotted it!

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

Successfully merging this pull request may close these issues.

2 participants