This repository was archived by the owner on Jun 2, 2024. It is now read-only.
Open
Conversation
Pull Request Test Coverage Report for Build 208
💛 - Coveralls |
Author
|
Only problem with autoincrement is that there is a possibility, that a new item can get the same id as a previously deleted item. This will occur if the last inserted item with the current max id gets deleted, than its old id will get the maxid and will be used for the next inserted item. In some scenarios like UserIds this could cause trouble, then the hash method should be used. As an alternative one could use a deleted flag instead of deleting the whole item. |
|
@chrissander why not instead just keep autoinc in a single file with locks etc? You could also create an |
This was referenced Apr 13, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added the option to leave the id value empty when generating a new item via $db->get(). As suggested in feature request #3 there are two config options for auto_id_mode, these are autoincrement and hash.
The option 'hash' will generate a random id with 8 characters. The option 'autoincrement' will result the highest current id +1.