@miniaxolotl/grove-server 1.11.20 → 1.11.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/migrate.js CHANGED
@@ -4,6 +4,33 @@ import { createRequire as __groveCreateRequire } from "node:module"; const requi
4
4
  import knex from "knex";
5
5
  import { Model, knexSnakeCaseMappers } from "objection";
6
6
 
7
+ // lib/database/src/daily-note-migration.ts
8
+ var dailyNotes = {
9
+ name: "20261117_042_daily_notes",
10
+ async up(db2) {
11
+ await db2.raw(`
12
+ CREATE TABLE daily_notes (
13
+ account_id uuid NOT NULL REFERENCES accounts(id) ON DELETE CASCADE,
14
+ local_date date NOT NULL,
15
+ memory_id uuid,
16
+ PRIMARY KEY (account_id, local_date),
17
+ UNIQUE (account_id, memory_id),
18
+ FOREIGN KEY (account_id, memory_id) REFERENCES memories(account_id,id)
19
+ ON DELETE SET NULL (memory_id)
20
+ );
21
+ ALTER TABLE daily_notes ENABLE ROW LEVEL SECURITY;
22
+ ALTER TABLE daily_notes FORCE ROW LEVEL SECURITY;
23
+ CREATE POLICY daily_notes_tenant ON daily_notes
24
+ USING (account_id=nullif(current_setting('grove.account_id',true),'')::uuid);
25
+ GRANT SELECT, INSERT ON daily_notes TO grove_runtime;
26
+ GRANT SELECT, DELETE ON daily_notes TO grove_worker;
27
+ `);
28
+ },
29
+ async down() {
30
+ throw new Error("Use a forward migration; retain daily note identities");
31
+ }
32
+ };
33
+
7
34
  // lib/database/src/writing-allowance-migration.ts
8
35
  var writingAllowance = {
9
36
  name: "20261107_041_writing_allowance",
@@ -3699,7 +3726,8 @@ var migrations = [
3699
3726
  writingTools,
3700
3727
  nativeSharing,
3701
3728
  billingTrial,
3702
- writingAllowance
3729
+ writingAllowance,
3730
+ dailyNotes
3703
3731
  ];
3704
3732
  var migrationSource = {
3705
3733
  getMigrations: async () => migrations,