oficina / base Public

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

Plain git — no account needed to clone.

Download

Download this file

1// Package store holds Base's members and app installs.
2package store
3
4import (
5 "embed"
6
7 "amadan.net/oficina/home/connect/linkstore"
8 "amadan.net/oficina/home/handoff"
9 "amadan.net/rastrillo/rastrillo/auth"
10 "amadan.net/rastrillo/rastrillo/migrate"
11 "amadan.net/rastrillo/rastrillo/passkey"
12 "amadan.net/rastrillo/rastrillo/pow"
13 "amadan.net/rastrillo/rastrillo/sessions"
14)
15
16//go:embed migrations/*.sql
17var migrationFS embed.FS
18
19// Schema holds only Base's own tables.
20var Schema = migrate.MustFromFS(migrationFS, "base")
21
22// BootSchema adds the framework tables the sign-in flow needs: sessions,
23// email links, the sign-in form's proof and passkeys.
24var BootSchema = migrate.Merge(sessions.Schema, auth.Schema, pow.Schema, passkey.Schema, Schema)
25
26// HomeSchema is what Oficina ID sign-in adds: the hand-off exchange and the
27// account links, in the namespaces every Oficina app uses for them.
28var HomeSchema = migrate.Merge(
29 migrate.MustFromFS(handoff.Migrations, "oficina_handoff"),
30 migrate.MustFromFS(linkstore.Migrations, linkstore.SchemaNamespace),
31)
32
33// Boot is the schema to apply at start-up: BootSchema, and HomeSchema too
34// when Oficina ID sign-in is on.
35func Boot(home bool) *migrate.Set {
36 if home {
37 return migrate.Merge(BootSchema, HomeSchema)
38 }
39 return BootSchema
40}
41