Skip to content

Add remove_object_store()/rename_object_store() to Databasebuilder to make reuse useful#41

Merged
devashishdxt merged 7 commits into
devashishdxt:mainfrom
wireapp:main
Dec 29, 2025
Merged

Add remove_object_store()/rename_object_store() to Databasebuilder to make reuse useful#41
devashishdxt merged 7 commits into
devashishdxt:mainfrom
wireapp:main

Conversation

@SimonThormeyer
Copy link
Copy Markdown
Contributor

Closes #36

This allows to refer to `ObjectStoreBuilder`s by name and still keeping
the insertion order.
@SimonThormeyer
Copy link
Copy Markdown
Contributor Author

SimonThormeyer commented Dec 19, 2025

Once this is merged, would you mind making a new release so we can stop using our fork? That'd be great.

Comment thread src/builder/database_builder.rs Outdated
Comment on lines +42 to +45
debug_assert!(
_previous_object_store_for_name.is_none(),
"we probably don't want to be overwriting object stores at any point"
);
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

This assert is misleading. Using assert means that this thing is not possible and if it happens, it is a logic error in this crate. But, idb does not enforce users to not overwrite existing object stores. Users can create two object stores with same name, in which case, this'll panic (which is undesirable).

I can see there are assertions in other places too. I think it's best to remove them. Neither idb not IndexedDB stops user adding object stores with same name.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Alright, I removed the debug assertions!

This will make handling removals more straightforward.
Internally, we cannot rely on just implicit removal when combining
remove and rename: if a store is removed and another store is then
renamed to the removed store name, implicit removal would not result in
the correct sequence of operations.
@devashishdxt devashishdxt merged commit adfb19a into devashishdxt:main Dec 29, 2025
4 checks passed
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.

Add remove_object_store()/ rename_object_store() to Databasebuilder to make reuse useful

2 participants