mirror of
https://github.com/outline/outline.git
synced 2026-06-13 11:25:03 +03:00
4774fa4fd0
* Weekly insights rollup * fix: Avoid eager db instance creation in DocumentInsight model Importing sequelize at the top level triggered createDatabaseInstance during module load, which caused unrelated test suites that transitively require the model to fail. Use the instance-bound this.sequelize in the static method instead. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * fix: Skip soft-deleted documents in weekly insights rollup The weekly task was deleting daily rows for soft-deleted documents without creating a weekly replacement, since rollupPeriod filters them out. Join to documents in both the week-discovery query and the DELETE to keep behavior consistent — historical daily rows for deleted docs are left for the cleanup task to remove at the retention boundary. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * refactor: Bind cutoff days param and add date predicate in weekly rollup Moves CUTOFF_DAYS from string interpolation to a bound parameter and adds a plain `date <` predicate so the planner can use the (documentId, date, period) index before evaluating date_trunc. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>