summaryrefslogtreecommitdiff
path: root/util/sql/schema.sql
AgeCommit message (Collapse)AuthorFilesLines
2020-04-04SQL reorg: Move util/sql/ to sql/ as a top-level dirYorhel1-983/+0
Been wanting to do this for a while... I've kept util/sql as a symlink for compatibility with the devdump, old update scripts and other code I may have forgotten. I'll remove it later.
2020-04-02Increase max release title length to 300Yorhel1-2/+2
https://vndb.org/t2520.377
2020-03-26imgflag: Keep track of users.c_imgvotes + limit number of votes + adjust ↵Yorhel1-1/+2
sampling
2020-03-23ExtLinks: A few more shop links for releasesYorhel1-2/+10
2020-03-16imgflag: Initial schema + UI for image flaggingYorhel1-3/+18
Lots of TODO's left to work on, but you have to start somewhere. I've bumped the Docker image version because this change requires TUWF commit 74aad378d49592df4359ea8a9f6f36d4a0013c04 (Elm decoder for structs with more than 8 fields)
2020-03-12SQL: Keep track of dimensions for all images in the DBYorhel1-2/+2
Ought to simplify the image flagging UI.
2020-03-12SQL: Use global "images" table for metadata of all images in the DBYorhel1-13/+17
In preparation for an image flagging feature. This replaces the 'screenshots' table. I played around with various implementations of a primary key for the images table; A single integer encoding both the type and id is most efficient, but kind of ugly to work with. Two separate columns are also ugly and force the creation of a separate 'image_type' column on all referencing tables. The current composite type isn't all that much better, but at least it makes it easy to keep treating the image id as a single entity. Old VNDB::* code still treats it as an integer with different namespaces, new VNWeb::* code treats it as a proper composite type.
2020-02-23dbdump: Add vn.c_popularity, c_rating and c_votecount to the dumpsYorhel1-3/+3
My policy is to not dump cached tables and columns that can be derived from other included data, but these stats aren't really a cache from the perspective of a DB dump user, since they're based on votes that are not available to the public.
2020-02-21SQL: Allow tags_vn.uid to be NULL for deleted usersYorhel1-3/+2
This fixes the issue of tag votes getting deleted when a user account is deleted, despite these votes being part of the kept "database contributions" mentioned in the privacy policy.
2020-02-09Tagmod: Add "notes" field to tag voting thingYorhel1-0/+1
Currently only displayed in the tag link browser and the tag editing form, but I'm hoping to display these on the VN page as well (on hover or something, not sure about the UI).
2020-02-06Cache Markdown-to-HTML in the database for doc pagesYorhel1-2/+4
Strips about 500ms off the page generation time for d11. The previous in-memory cache kinda worked, too, but it still often happens that the cache is empty. This cache also applies for docs_hist, so browsing through earlier revisions is now faster as well.
2020-01-04ulist: Add ability to save views as defaultYorhel1-1/+4
2019-12-30Merge branch 'ulist'Yorhel1-32/+37
2019-12-30ulist: Remove remnants of old votes/vnlists/wlists tablesYorhel1-28/+0
2019-12-24ulist: Export new lists in dbdump.pl, unexport old listsYorhel1-16/+16
Ended up exporting the 'users.ign_votes' column as well, as that's both easier and (potentially) more useful than not exporting ignored votes in the first place.
2019-12-22ulist: Update "My lists" VN filters to use new ulists featureYorhel1-1/+1
This is just a simple backwards-compatible port, proper integration should allow one to filter on individual labels. The "On my VN list" filter now works slightly differently in that it considers *everything* in ulist_vns to be on the users' VN list, including votes and wishlist. I've removed the option to display a "Wishlist" column. The wishlist works rather differently now, maybe this should instead just display all assigned labels - but that would consume quite a bit of space. :(
2019-12-20ulist: Remove deprecated hide_list user preferenceYorhel1-1/+1
Old VNDB::* code still uses that preference in a few places, that needs to be fixed.
2019-12-20Keep track of poll vote datesYorhel1-0/+1
That'd make it much easier to find fake accounts.
2019-12-19ulist: Update user list with vnlist/votes/wishlist statsYorhel1-1/+3
This adds the users.c_vns and c_wish columns and a function to update the cache. Unlike my previous cache update approaches, I did not use SQL triggers here, as that seemed more complex and less efficient than updating the cache manually. That's not to say that I'm happy with the current approach, but meh... The cache update function is not automatically run for all users, but that could be added to Multi::Maintenance if it turns out that the cached values will not be updated properly in some cases.
2019-12-16ulist: Integrate update script into SQL + update notify_listdel()Yorhel1-0/+31
2019-12-01v2rw: Convert thread display + poll votingYorhel1-2/+2
I did not reimplement the 'poll_recast' and 'poll_preview' settings, these actions are now always permitted. Updated CSS a little bit to highlight the linked post and fix the double border at the bottom. The nice thing about the sql_visible_threads() function I wrote earlier is that is can also be used for access control on a single thread. More code re-use. \o/
2019-11-08Wikidata: Add support for doujinshi.org author linksYorhel1-1/+2
2019-11-02Add character age field + conversionYorhel1-2/+4
2019-11-02Add character cup size field + conversion + filterYorhel1-2/+5
2019-10-10rewards: Add user settingsYorhel1-1/+10
They don't do anything yet.
2019-10-07SQL: Adjust tag_vn_inherit and trait_chars calculationsYorhel1-3/+1
Most importantly, downvoted parent tags are now still included for searching as per https://vndb.org/t12750 - in particular, a downvoted tag is considered to be exactly the same thing as a tag with no votes at all. Also made a few other adjustments: - Removed the "ignore child tags/traits if parent has its own value" rule. This was done because the 'spoiler' rating would get inherited using the average, but that should just have been the minimum (i.e. if a single child tag is not a spoiler, then neither is the parent). https://vndb.org/t10082 - The score of a parent tag is now avg(avg(votes_on_child_tags)) rather than avg(votes_on_child_tags), i.e. tags with more votes don't have more weight than tags with fewer votes. I don't think vote counts really matter in determining the parent score. - Deleted VNs now don't count towards tag statistics (this is consistent with traits). - Performance improvements: Smaller indices and more clever querying.
2019-10-03Require email confirmation when changing email addressYorhel1-1/+2
This ensures that the email address linked to a user is always valid and actually belong(s|ed) to that user.
2019-10-03SQL: Add session types + use sessions for password reset tokensYorhel1-4/+4
This improves the password reset workflow a bit. The users.passwd field is now no longer used for reset tokens, meaning that the current password isn't affected until the user actually clicks the link and changes it. It is now also possible to have multiple active password reset tokens, in case one of the emails got lost. All existing tokens are invalidated when the user finally changes their password. Tokens are now valid for at most 1 week instead of indefinitely.
2019-10-03SQL: Change sessions.lastused into sessions.expiresYorhel1-4/+4
This will be helpful when adding other types of sessions with different expiration.
2019-10-03Fix spoilers preference to be a smallint rather than booleanYorhel1-1/+1
And for those who (like me) already applied update_20191003.sql, here's a partial fix: alter table users alter column spoilers drop default; alter table users alter column spoilers type smallint using (case when spoilers then 1 else 0 end); alter table users alter column spoilers set default 0; But you'll still need to import the old preference for users who had spoilers=2, because those will have been lost.
2019-10-03SQL: Get rid of the users_prefs table, store preferences in users tableYorhel1-21/+28
This bloats the users table a little bit, but that's fine. The main advantage of this change is that we now have a proper schema for user preferences, rather than the schemaless key-value mess we had before. This commit also splits the 'tags_cat' preference up into tags_cont, tags_ero and tags_tech bools, as that's more compact to store and easier to work with. This commit also changes the 'notify_nodbedit' preference to 'notify_dbedit' with inverted meaning. The reason the value was negated in the first place was because the old schemaless approach did not support positive defaults.
2019-09-27Add Malay languageYorhel1-1/+1
Sorry for re-using update_20190923.sql, but I'm not sure anyone even uses those scripts. For documentation purposes it's neat to have similar things in a short time window combined, anyway.
2019-09-24Add language: Scottish GaelicYorhel1-1/+1
2019-09-23Add 4 new languagesYorhel1-1/+1
https://vndb.org/t12897.6
2019-09-17Rename VNDBSchema to VNDB::Schema and let it figure out the root path itselfYorhel1-1/+1
I always avoided using the VNDB::* schema for non-web related utility modules, but thats pretty silly (especially as I'm slowly trying to move away from the old VNDB::* web code).
2019-09-14SQL: Replace "shop_*.found" with "deadsince" timestampYorhel1-4/+4
Has the inverted meaning. Keeping track of how long we've been unable to find a certain shop link is useful in weeding out temporary unavailability when querying for dead links.
2019-09-03Add Pixiv ID to staff entriesYorhel1-2/+4
2019-09-03Fetch some more IDs from Wikidata + display IGDB & Pixiv linksYorhel1-1/+8
2019-09-02Minor cleanup of l_wp/l_encubed link codeYorhel1-4/+4
The fields are still there in order to keep the edit history somewhat sensible, but we don't need this additional code.
2019-09-02Allow multiple Gyutto & DMM links per releaseYorhel1-4/+4
To handle https://vndb.org/t12755.37
2019-09-01Add ErogeTrailers.com links to releasesYorhel1-2/+4
2019-09-01Add EGS links to releasesYorhel1-2/+4
2019-08-26Display shop+price info on VN pages + delete old affiliate codeYorhel1-14/+0
The current affiliate links format doesn't display as much information as before but it's also a lot less messy.
2019-08-25Add PlayAsia shop crawlerYorhel1-0/+15
Most of this code isn't new - there's been a hidden 'Affiliates.pm' module for a while. This just consolidates the code with the other shops and opens up the code. The API endpoint is hidden. :)
2019-08-25Add DLsite price & shop info crawlerYorhel1-0/+9
2019-08-24Add DenpaSoft price info crawlerYorhel1-0/+9
2019-08-24Add MangaGamer price info crawlerYorhel1-0/+9
2019-08-24Add J-List price info crawlerYorhel1-0/+9
2019-08-22Add JAST USA links to releasesYorhel1-2/+4
2019-08-21Add Itch.io links to releasesYorhel1-2/+4