-
Notifications
You must be signed in to change notification settings - Fork 113
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
Use unique indexes and upserts? #272
Comments
If I'm not mistaken, it seems there's already a unique index on TMSU/storage/database/schema.go Line 186 in 0bf4b80
However, a unique index on tag(name) would be very useful IMHO too.
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello.
Other day I was working on some script that would add/remove tags automatically
based on complicated, non-general-utility logic, and I figured that it will be
easier to work with database directly.
I really appreciate the choice of sqlite3 as data storage instead of some
language-specific binary format. One
.schema
command, and I knew exactly whatI need to do.
One thing that surprised me is that
tmsu
database has no unique indexes, soif I want know
id
of the tag, creating it if necessary, I have to do it usingmultiple queries:
Should table had unique index, the same could have been done atomically and much easier:
Additionally, unique index would be extra protection against logic errors that
may introduce duplicate tags/value/files. Would you be interested if I make
pull request that creates unique indexes, like following:
The text was updated successfully, but these errors were encountered: