summaryrefslogtreecommitdiff
path: root/internal/db
AgeCommit message (Collapse)AuthorFiles
2024-12-04[feature] unending polls (#3592)Libravatar kim1
* adds support for unending polls to be created locally * remove unused argument
2024-12-02[feature] Add global instance CSS customization setting (#3352)Libravatar Victor Dyotte1
Allow instance admins to add custom CSS that will affect every page of their instance. This is done with a new CustomCSS instance setting that works pretty much exactly like the Users CustomCSS property. This custom CSS is then requested for every page load. User styles/themes take precedence over this CSS. Co-authored-by: tobi <tobi.smethurst@protonmail.com>
2024-11-29[performance] use new instance of bun.DB *after* migrations to reduce number ↵Libravatar kim1
of in-memory model schema (#3578) * use new instance of bun.DB *after* migrations to reduce number of model schema in-memory * update sqlite address comment
2024-11-28[chore] rename New___(string) int signature functions to Parse___(string) ↵Libravatar kim1
int (#3580) * rename New___(string) int {} signature functions to Parse___(string) int {} * remove test output
2024-11-25[bugfix] notification types missing from link header (#3571)Libravatar kim3
* ensure notification types get included in link header query for notifications * fix type query keys
2024-11-25[chore] Bump tooling versions, bump go -> v1.23.0 (#3258)Libravatar tobi1
* [chore] Bump tooling versions, bump go -> v1.23.0 * undo silly change * sign * bump go version in go.mod * allow overflow in imaging * goreleaser deprecation notices * bump versions * undo accidental rebase change * update container versions to just use latest major version * update swagger to our release with go1.23 fix * update goreleaser to use our vendored swagger version --------- Co-authored-by: kim <grufwub@gmail.com>
2024-11-25[performance] convert enum strings to ints (#3558)Libravatar kim17
* convert statuses.visibility and notifications.notification_type columns from type string -> int for performance / space savings * fix test trying to compare string to int * fix instance count query using string literal instead of gtsmodel const type * ensure a default value is always set * also migrate the account settings and sin bin status tables * initialize maps outside loops and place into singular enum mapping creation func * use int16 for enum types * update sinbinstatus creation to be from a snapshot at initial creation * add snapshot of poll type at creation time
2024-11-21[feature] Add domain permission drafts and excludes (#3547)Libravatar tobi7
* [feature] Add domain permission drafts and excludes * fix typescript complaining * lint * make filenames more consistent * test own domain excluded
2024-11-21[bugfix] post counters should not include direct messages (#3554)Libravatar Jannis2
* [bugfix] post counters should not include direct messages #3504 The fix is relativly simple, it just adds a line to the relevant function which excludes all private posts. * Formating fix * mb
2024-11-11[performance] minimise log field allocations (#3529)Libravatar kim21
* when appending log field only do so by minimal amount * move slice utils to separate package to fix import cycle, add GrowJust() and AppendJust() functions * fix GrowJust() not returning slice of same length * improved xslices tests * make AppendJust() test check for slice contents, fix AppendJust() final copying behaviour * add a +1 with field growth to try minimise allocation for log 'msg' field
2024-10-19[bugfix] Fix filter title unique constraint (#3458)Libravatar tobi4
2024-10-16[chore] Upgrade golangci-lint, ignore existing int overflow warnings (#3420)Libravatar Markus Unterwaditzer1
* [chore] Bump tooling versions, bump go -> v1.23.0 * undo silly change * sign * bump go version in go.mod * allow overflow in imaging * goreleaser deprecation notices * [chore] Upgrade golangci-lint, ignore existing int overflow warnings There is a new lint for unchecked int casts. Integer overflows are bad, but the old code that triggers this lint seems to be perfectly fine. Instead of disabling the lint entirely for new code as well, grandfather in existing code. * fix golangci-lint documentation link * revert unrelated changes * revert another unrelated change * get rid of remaining nolint:gosec * swagger updates * apply review feedback * fix wrong formatting specifier thing * fix the linter for real --------- Co-authored-by: tobi <tobi.smethurst@protonmail.com>
2024-10-14updates exported interface types to match ncruces/go-sqlite3/driver methods ↵v0.17.0Libravatar kim1
(#3440)
2024-10-14[feature/OFFICIALLY UNSUPPORTED] add nowasm build tag to disable building ↵Libravatar kim4
with WebAssembly (#3429) * add experimental build-tag 'nowasm' which uses local ffmpeg / ffprobe * updated experimental support message * add comment to build script explaining build tag * add nowasm build tags to moderncsqlite files
2024-10-14[feature] for an sqlite database with journal mode != WAL, use maximum of 1 ↵Libravatar kim1
open conn (#3428)
2024-10-11[bugfix] Ensure `pending_approval` set on statuses + status faves (#3415)Libravatar tobi2
* [bugfix] Ensure pending_approval set on statuses + status faves * set PendingApproval on boosts * assume not pending approval
2024-10-05[bugfix] Update select of pending interaction requests to account for ↵Libravatar tobi2
potential nil URI (#3392)
2024-10-04[performance] remove the pragma optimize analysis limit on connection close ↵Libravatar kim1
(#3386)
2024-09-28[bugfix] visibility after implicit approval not getting invalidated (#3370)Libravatar kim2
* replicate issue * update go-structr to v0.8.10 with internal linked-list fix, small tweaks to caching of interaction requests * remove debug function --------- Co-authored-by: tobi <tobi.smethurst@protonmail.com>
2024-09-23[chore] local instance count query caching, improved status context endpoint ↵Libravatar kim1
logging, don't log ErrHideStatus when timelining (#3330) * ensure that errors checking status visibility / converting aren't dropped * add some more context to error messages * include calling function name in log entries * don't error on timelining hidden status * further code to ignore statusfilter.ErrHideStatus type errors * remove unused error type * add local instance status / domain / user counts * add checks for localhost * rename from InstanceCounts to LocalInstance * improved code comment
2024-09-20[chore] ensure consistent caller name fetching regardless of compiler ↵Libravatar kim1
inlining (#3323) * move logging levels into log package itself * ensure inconsistent inlining doesn't mess with log calling function name * remove unused global variable * fix log level
2024-09-16[performance] cache more database calls, reduce required database calls ↵Libravatar kim36
overall (#3290) * improvements to caching for lists and relationship to accounts / follows * fix nil panic in AddToList() * ensure list related caches are correctly invalidated * ensure returned ID lists are ordered correctly * bump go-structr to v0.8.9 (returns early if zero uncached keys to be loaded) * remove zero checks in uncached key load functions (go-structr now handles this) * fix issues after rebase on upstream/main * update the expected return order of CSV exports (since list entries are now down by entry creation date) * rename some funcs, allow deleting list entries for multiple follow IDs at a time, fix up more tests * use returning statements on delete to get cache invalidation info * fixes to recent database delete changes * fix broken list entries delete sql * remove unused db function * update remainder of delete functions to behave in similar way, some other small tweaks * fix delete user sql, allow returning on err no entries * uncomment + fix list database tests * update remaining list tests * update envparsing test * add comments to each specific key being invalidated * add more cache invalidation explanatory comments * whoops; actually delete poll votes from database in the DeletePollByID() func * remove added but-commented-out field * improved comment regarding paging being disabled * make cache invalidation comments match what's actually happening * fix up delete query comments to match what is happening * rename function to read a bit better * don't use ErrNoEntries on delete when not needed (it's only needed for a RETURNING call) * update function name in test * move list exclusivity check to AFTER eligibility check. use log.Panic() instead of panic() * use the poll_id column in poll_votes for selecting votes in poll ID * fix function name
2024-09-14[chore] Update go-sqlite3 to 0.18.3 (#3295)Libravatar Daenney1
* [chore] Update go-sqlite3 to 0.18.3 * [chore] Fix getting the sqlite3.Conn
2024-09-11[bugfix] Update home timeline query to ignore exclusive list entries (#3289)Libravatar tobi2
* [bugfix] Update home timeline query to ignore exclusive list entries * a
2024-09-10[feature] Process `Reject` of interaction via fedi API, put rejected ↵Libravatar tobi5
statuses in the "sin bin" 😈 (#3271) * [feature] Process `Reject` of interaction via fedi API, put rejected statuses in the "sin bin" * update test * move nil check back to `rejectStatusIRI`
2024-09-09[feature] Implement exclusive lists (#3280)Libravatar Vyr Cossont1
Fixes #2616
2024-09-09[feature/frontend] Add options to include Unlisted posts or hide all posts ↵Libravatar tobi3
(#3272) * [feature/frontend] Add options to include Unlisted posts or hide all posts * finish up * swagger * move invalidate call into bundb package, avoid invalidating if not necessary * rename show_web_statuses => web_visibility * don't use ptr for webvisibility * last bits
2024-09-08[bugfix] Fix temp table deletion causing runaway allocations (#3278)Libravatar tobi2
* [bugfix] Fix temp table deletion causing runaway allocations * move some vars around * small fixes * rely on conn max age to recycle temp tables * fackin' ell m8
2024-09-02[chore/performance] Further reduce nil uncached queries (#3267)Libravatar tobi8
* [chore/performance] Further reduce nil uncached queries * more checks
2024-09-02[chore] Don't try to select zero uncached filters (#3266)Libravatar tobi1
2024-09-02[chore/performance] Avoid unnecessary "uncached" queries (#3265)Libravatar tobi17
* [chore/performance] Avoid unnecessary "uncached" queries * go fmt
2024-08-24[feature] Interaction requests client api + settings panel (#3215)Libravatar tobi10
* [feature] Interaction requests client api + settings panel * test accept / reject * fmt * don't pin rejected interaction * use single db model for interaction accept, reject, and request * swaggor * env sharting * append errors * remove ErrNoEntries checks * change intReqID to reqID * rename "pend" to "request" * markIntsPending -> mark interactionsPending * use log instead of returning error when rejecting interaction * empty migration * jolly renaming * make interactionURI unique again * swag grr * remove unnecessary locks * invalidate as last step
2024-08-22[feature] Use `local_only` field, deprecate `federated` field (#3222)Libravatar tobi1
* [feature] Use `local_only` field, deprecate `federated` field * use `deprecated` comment for form.Federated * nolint
2024-08-08[feature] Add `db-postgres-connection-string` option (#3178)Libravatar John Winston1
* handle db-url * lint and add doc * add more doc * fix config test * return error * change name from db-url to db-postgres-connection-string
2024-08-02[chore] move PopulateAccountStats() nil check often performed into function ↵Libravatar kim2
itself (#3158) * move PopulateAccountStats() nil check often performed into function itself * fix test to take in mind we don't repopulate account stats if not-nil
2024-07-31[feature] Allow users to export data via the settings panel (#3140)Libravatar tobi5
* [feature] Allow users to export data via the settings panel * rename/move some stuff
2024-07-30[feature] persist worker queues to db (#3042)Libravatar kim5
* persist queued worker tasks to database on shutdown, fill worker queues from database on startup * ensure the tasks are sorted by creation time before pushing them * add migration to insert WorkerTask{} into database, add test for worker task persistence * add test for recovering worker queues from database * quick tweak * whoops we ended up with double cleaner job scheduling * insert each task separately, because bun is throwing some reflection error?? * add specific checking of cancelled worker contexts * add http request signing to deliveries recovered from database * add test for outgoing public key ID being correctly set on delivery * replace select with Queue.PopCtx() * get rid of loop now we don't use it * remove field now we don't use it * ensure that signing func is set * header values weren't being copied over :facepalm: * use ptr for httpclient.Request in delivery * move worker queue filling to later in server init process * fix rebase issues * make logging less shouty * use slices.Delete() instead of copying / reslicing * have database return tasks in ascending order instead of sorting them * add a 1 minute timeout to persisting worker queues
2024-07-30[chore] replace UniqueStrings with Deduplicate (#3154)Libravatar tobi1
2024-07-29[feature] Implement following hashtags (#3141)Libravatar Vyr Cossont3
* Implement followed tags API * Insert statuses with followed tags into home timelines * Test following and unfollowing tags * Correct Swagger path params * Trim conversation caches * Migration for followed_tags table * Followed tag caches and DB implementation * Lint and tests * Add missing tag info endpoint, reorganize tag API * Unwrap boosts when timelining based on tags * Apply visibility filters to tag followers * Address review comments
2024-07-26[feature] Federate interaction policies + Accepts; enforce policies (#3138)Libravatar tobi1
* [feature] Federate interaction policies + Accepts; enforce policies * use Acceptable type * fix index * remove appendIRIStrs * add GetAccept federatingdb function * lock on object IRI
2024-07-24[chore] renames the `GTS` caches to `DB` caches (#3127)Libravatar kim32
* renames the `GTS` caches to `DB` caches, as it better references what they are * change remaining Caches.GTS uses to Caches.DB
2024-07-23[chore] Add some log lines to recent migrations warning not to interrupt (#3134)Libravatar tobi3
* [chore] Add some log lines to recent migrations warning not to interrupt * arse
2024-07-23Remove content and related fields from boosts (#3131)Libravatar Vyr Cossont1
These duplicate the content of the target and aren't necessary for anything. - Stops copying some fields from target when boosting or processing a remote boost - Adds a migration to null out existing duplicate data - Updates tests
2024-07-23[feature] Conversations API (#3013)Libravatar Vyr Cossont12
* Implement conversations API * Sort and page conversations by last status ID * Appease linter * Fix deleting conversations and statuses * Refactor to make migrations automatic * Lint * Update tests post-merge * Fixes from live-fire testing * Linter caught a format problem * Refactor tests, fix cache * Negative test for non-DMs * Run conversations advanced migration on testrig startup as well as regular server startup * Document (lack of) side effects of API method for deleting a conversation * Make not-found check less nested for readability * Rename PutConversation to UpsertConversation * Use util.Ptr instead of IIFE * Reduce cache used by conversations * Remove unnecessary TableExpr/ColumnExpr * Use struct tags for both unique constraints on Conversation * Make it clear how paging with GetDirectStatusIDsBatch should be used * Let conversation paging skip conversations it can't render * Use Bun NewDropTable * Convert delete raw query to Bun * Convert update raw query to Bun * Convert latestConversationStatusesTempTable raw query partially to Bun * Convert conversationStatusesTempTable raw query partially to Bun * Rename field used to store result of MaxDirectStatusID * Move advanced migrations to their own tiny processor * Catch up util function name with main * Remove json.… wrappers * Remove redundant check * Combine error checks * Replace map with slice of structs * Address processor/type converter comments - Add context info for errors - Extract some common processor code into shared methods - Move conversation eligibility check ahead of populating conversation * Add error context when dropping temp tables
2024-07-17[chore] media pipeline improvements (#3110)Libravatar kim4
* don't set emoji / media image paths on failed download, migrate FileType from string to integer * fix incorrect uses of util.PtrOr, fix returned frontend media * fix migration not setting arguments correctly in where clause * fix not providing default with not null column * whoops * ensure a default gets set for media attachment file type * remove the exclusive flag from writing files in disk storage * rename PtrOr -> PtrOrZero, and rename PtrValueOr -> PtrOrValue to match * slight wording changes * use singular / plural word forms (no parentheses), is better for screen readers * update testmodels with unknown media type to have unset file details, update attachment focus handling converting to frontend, update tests * store first instance in ffmpeg wasm pool, fill remaining with closed instances
2024-07-15[feature/frontend] Add player for audio files; use thumbnail for `poster` ↵Libravatar tobi5
(#3099) * [feature/frontend] Audio player for audio media types * use video preview images for previews instead of video itself * don't preload * update tests for new zork status * collapse media gallery into single row when small
2024-07-15[chore] add step-by-step logging to long migration (#3102)Libravatar tobi1
2024-07-11[chore] Add interaction policy gtsmodels (#3075)Libravatar tobi11
* [chore] introduce interaction policy gts models * update migration a smidge * fix copy paste typo * update migration * use int for InteractionType
2024-07-10[bugfix] Don't throw error when parent statuses are missing (#2011) (#3088)Libravatar snow1
* [bugfix] Don't throw error when parent statuses are missing (#2011) * Split missing parent status case from error check
2024-06-29[feature] Default to WASM-based SQLite driver (#3053)Libravatar Daenney4
* [feature] Default to WASM-based SQLite driver With 0.16 out this switches our default SQLite driver to the WASM-based solution instead. So far the driver seems to perform just as well. Switching our default should result in it getting a bit more testing during the 0.17 development cycle. * add the ol' john hancock --------- Co-authored-by: tobi <tobi.smethurst@protonmail.com>