oficina / sheets Public

Clone
git clone https://amadan.net/oficina/sheets

Plain git — no account needed to clone.

Download

Download this file

1package sheets
2
3import (
4 "amadan.net/oficina/home/connect/linkstore"
5 "amadan.net/oficina/home/dashboard"
6 "amadan.net/oficina/home/handoff"
7 "embed"
8
9 "amadan.net/rastrillo/rastrillo/auth"
10 "amadan.net/rastrillo/rastrillo/migrate"
11 "amadan.net/rastrillo/rastrillo/sessions"
12
13 "amadan.net/oficina/sheets/internal/sheets/store"
14)
15
16// migrationsFS embeds internal/sheets/migrations/*.sql — this package's
17// generated migrations plus the schema.sql summary `rastrillo migration
18// generate` maintains beside them. schema.sql matches the glob but is
19// never parsed as a step (migrate.FromFS excludes it by name), so the
20// go:embed directive below needs at least one *.sql file to exist before
21// this package can compile at all; that is why an empty schema.sql was
22// committed ahead of the first `rastrillo migration generate` run rather
23// than left for it to create.
24//
25//go:embed migrations/*.sql
26var migrationsFS embed.FS
27
28// Schema is Sheets' own migration set: what `rastrillo migration
29// generate`/`check` diff Models against. Never hand-edit a file under
30// migrations/ once it has shipped — add a new one instead
31// (`rastrillo migration new <name>`).
32var Schema = migrate.MustFromFS(migrationsFS, "sheets")
33
34// BootSchema is everything migrate.Apply runs at boot, in apply order —
35// the shape SKILL.md documents as `migrate.Merge(subsystemSchemas...,
36// Schema)`.
37//
38// The order is not a preference. auth's backfill migration reads the
39// sessions table, so sessions.Schema must apply first; migrate.Merge's
40// argument order IS apply order. Sheets and optional Home protocol schemas
41// follow the local authentication schemas.
42var BootSchema = migrate.Merge(migrate.MustFromFS(dashboard.Migrations, "oficina_dashboard"), sessions.Schema, auth.Schema, Schema, migrate.MustFromFS(handoff.Migrations, "oficina_handoff"), migrate.MustFromFS(linkstore.Migrations, linkstore.SchemaNamespace))
43
44// Models lists every GORM model `rastrillo migration generate`/`check`
45// diff Schema against — Sheet, Tab, Row, Col, Cell, Format and Member
46// from models.go, plus Event.
47//
48// Every model but Member is declared in package store, beside the
49// persistence that owns it. The list is a []any of values, so it names
50// them across the package boundary without needing them declared here —
51// which is what lets the CLI read one Models from one package while the
52// structs live where they belong. See store/models.go for why they
53// moved.
54var Models = []any{
55 sheetAgentState{}, sheetAgentReceipt{}, sheetAgentAttribution{}, sheetAgentEdit{},
56 store.Sheet{}, store.Tab{}, store.Row{}, store.Col{},
57 store.Cell{}, store.Format{}, store.Event{}, Member{}, Grant{}, ShareLink{}, Comment{}, TabView{},
58 store.ImportReport{},
59}
60