toga-ai 1.0.25 → 1.0.27
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.
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# dbchanges2 (Database Changes) — 2.0 knowledge
|
|
2
|
+
|
|
3
|
+
| Doc | Summary | Files |
|
|
4
|
+
|-----|---------|-------|
|
|
5
|
+
| [Database Changes (dbchanges2) Repository Architecture](architecture.md) | `dbchanges2` is the **schema-migration / SQL change-set repository** for the entire 2.0 platform. | Core/, Client/, Client_<Tenant>/, Logs/, Logs_Client/, _modules/ |
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Database Changes (dbchanges2) Repository Architecture
|
|
3
|
+
framework: "2.0"
|
|
4
|
+
repo: dbchanges2
|
|
5
|
+
project: Database Changes
|
|
6
|
+
client: shared
|
|
7
|
+
type: architecture
|
|
8
|
+
status: active
|
|
9
|
+
updated: 2026-06-09
|
|
10
|
+
owners: [jcardinal]
|
|
11
|
+
files:
|
|
12
|
+
- Core/
|
|
13
|
+
- Client/
|
|
14
|
+
- Client_<Tenant>/
|
|
15
|
+
- Logs/
|
|
16
|
+
- Logs_Client/
|
|
17
|
+
- _modules/
|
|
18
|
+
related:
|
|
19
|
+
- 2.0/apps/_underscore/architecture.md
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Summary
|
|
23
|
+
|
|
24
|
+
`dbchanges2` is the **schema-migration / SQL change-set repository** for the entire 2.0
|
|
25
|
+
platform. It contains **only `.sql` files organized into folders** — there is no PHP, no
|
|
26
|
+
runner script, and no Composer manifest in the repo. Each top-level folder maps to a
|
|
27
|
+
**database (or database family)** in the 2.0 infrastructure (see
|
|
28
|
+
`2.0/apps/_underscore/architecture.md` → *Database architecture*). An **external executor**
|
|
29
|
+
(not stored in this repo) walks each folder and runs its SQL files **in alphabetical order**
|
|
30
|
+
against the corresponding database(s).
|
|
31
|
+
|
|
32
|
+
Because execution order is purely alphabetical, **file naming is the contract.** Files are
|
|
33
|
+
named with a leading **`YYYY-MM-DD`** date so alphabetical sort = chronological order, which
|
|
34
|
+
is the intended execution order.
|
|
35
|
+
|
|
36
|
+
## File naming convention (the execution contract)
|
|
37
|
+
|
|
38
|
+
1. **Date prefix, ISO format:** every file starts `YYYY-MM-DD`. ISO ordering means
|
|
39
|
+
alphabetical = chronological = execution order.
|
|
40
|
+
2. **Optional description suffix:** a short human phrase describing the change, and/or a
|
|
41
|
+
ticket number — e.g. `2026-06-04 - RecursiveItemFulfillmentPut.sql`,
|
|
42
|
+
`2024-11-27 49875 AddAdminNoteToSalesOrderTable.sql`. The phrase is informational; only
|
|
43
|
+
the leading date governs order.
|
|
44
|
+
3. **Same-day ordering with letter suffixes:** when multiple files share a date and must run
|
|
45
|
+
in a specific sequence, append `a`, `b`, `c`, … directly after the date to force order —
|
|
46
|
+
e.g. `2024-05-16.sql` then `2024-05-16b.sql`; `2024-09-06a …`, `2024-09-11a …`,
|
|
47
|
+
`2024-09-11c …`. The letter sits right after the date so the alphabetical sort stays
|
|
48
|
+
correct.
|
|
49
|
+
|
|
50
|
+
> Naming is loose in punctuation (some files have ` - `, some a bare space, occasionally a
|
|
51
|
+
> trailing-space quirk like `2026-06-03- BLANK_CLIENT_DATABASE.sql`). The **only** hard rule
|
|
52
|
+
> is the leading `YYYY-MM-DD[letter]` so ordering holds.
|
|
53
|
+
|
|
54
|
+
## Folder → database mapping
|
|
55
|
+
|
|
56
|
+
Each top-level folder targets a database or a **fan-out set** of databases. Tenant naming
|
|
57
|
+
(`Client_<Tenant>`, `Logs_<Tenant>`) follows the `_underscore` convention: single leading
|
|
58
|
+
capital, rest lower-case (e.g. `Compass`, `Compasscanada`).
|
|
59
|
+
|
|
60
|
+
| Folder | Target database(s) | Fan-out |
|
|
61
|
+
|---|---|---|
|
|
62
|
+
| `Core/` | `Core` (shared platform DB) | single DB |
|
|
63
|
+
| `Logs/` | `Logs` (framework-level logs, not tenant-scoped) | single DB |
|
|
64
|
+
| `Client/` | **every** `Client_<Tenant>` database | fan-out to all active clients |
|
|
65
|
+
| `Client_<Name>/` | the **one** `Client_<Name>` DB only | single tenant |
|
|
66
|
+
| `Logs_Client/` | **every** `Logs_<Tenant>` database | fan-out to all client-log DBs |
|
|
67
|
+
| `_modules/` | reusable change-sets, opt-in per client (see below) | indirection |
|
|
68
|
+
|
|
69
|
+
Key distinction: **`Client/` is the shared changes applied to every client database**, while
|
|
70
|
+
**`Client_<Name>/` holds changes scoped to that single client.** As of 2026-06-09 there are
|
|
71
|
+
**30 `Client_<Name>` folders** (Aig, Bankofamerica, Browardsheriff, Canon, Compass,
|
|
72
|
+
CompassCanada, Elite, Endeavorhealth, Erau, Growrk, Managelife, Masonite, Mcgrawhill,
|
|
73
|
+
Miamidade, Ncci, Northwell, Nycdoe, Nychh, Pcmatic, Prudential, Quad, Rate, Sbasite, Shrss,
|
|
74
|
+
Spglobal, Trividiahealth, True, Wje, Wmchealth, Ynhh).
|
|
75
|
+
|
|
76
|
+
`Client/` and `Logs_Client/` also contain `BLANK_CLIENT_DATABASE` / `BLANK_CLIENT_LOGS_DATABASE`
|
|
77
|
+
seed scripts used to provision a brand-new tenant DB from scratch.
|
|
78
|
+
|
|
79
|
+
## `_modules` — reusable, opt-in change-sets
|
|
80
|
+
|
|
81
|
+
Some change-sets aren't applied to every client — only to clients that use a given **module**
|
|
82
|
+
(a feature/integration). This is modeled with two pieces:
|
|
83
|
+
|
|
84
|
+
1. **`_modules.txt` inside a client folder** — a plain-text manifest listing the module names
|
|
85
|
+
that client depends on, **one per line**. Example: `Client_Compass/_modules.txt` contains
|
|
86
|
+
`netsuite`; `Client_Pcmatic/_modules.txt` contains `startech`. An empty/absent file means
|
|
87
|
+
no extra modules. (Note: the file is literally named **`_modules.txt`**.)
|
|
88
|
+
2. **`_modules/<module>/` folder** — holds the dated SQL change-set for that module. Each
|
|
89
|
+
value in a client's `_modules.txt` matches a **subfolder name** under `_modules/`.
|
|
90
|
+
|
|
91
|
+
When the executor processes a client, it applies that client's own folder **plus** the
|
|
92
|
+
change-sets of every module named in its `_modules.txt`. Current modules:
|
|
93
|
+
|
|
94
|
+
| Module value | Folder | Used by (examples) |
|
|
95
|
+
|---|---|---|
|
|
96
|
+
| `netsuite` | `_modules/netsuite/` | Compass, Canon, Ncci, Sbasite, Spglobal, … (most clients) |
|
|
97
|
+
| `startech` | `_modules/startech/` | Pcmatic |
|
|
98
|
+
|
|
99
|
+
Module folders use the **same `YYYY-MM-DD` naming + ordering rules** as client folders.
|
|
100
|
+
|
|
101
|
+
> **Module names should be lower-case**, and a module value may be a **nested path** that
|
|
102
|
+
> maps to a nested subfolder — e.g. a `_modules.txt` entry of `ai/bdr` would reference
|
|
103
|
+
> `_modules/ai/bdr/`. The repo currently contains an `_modules/Ai/Bdr/` folder whose casing
|
|
104
|
+
> is a **typo** (it should be `_modules/ai/bdr/`); no client references it yet, so there is no
|
|
105
|
+
> live example of a nested module in use. Treat lower-case as the convention going forward.
|
|
106
|
+
|
|
107
|
+
## HISTORIC folders — always skipped
|
|
108
|
+
|
|
109
|
+
Any folder named **`HISTORIC`** is **ignored by the executor** — it is an archive of old,
|
|
110
|
+
already-applied change files moved aside to keep the live list short. Present under
|
|
111
|
+
`Client/HISTORIC/`, `Core/HISTORIC/`, `Logs_Client/HISTORIC/`, and `_modules/netsuite/HISTORIC/`,
|
|
112
|
+
typically bucketed as `FILES BEFORE <date>` (or by year under `Core/`). **Never** rely on a
|
|
113
|
+
file inside `HISTORIC` running; **never** add new changes there.
|
|
114
|
+
|
|
115
|
+
## Adding a new change (the rules)
|
|
116
|
+
|
|
117
|
+
1. Pick the right folder for the target DB: `Core/`, `Logs/`, the shared `Client/` (every
|
|
118
|
+
tenant), a specific `Client_<Name>/`, `Logs_Client/` (every tenant log), or a module under
|
|
119
|
+
`_modules/<module>/`.
|
|
120
|
+
2. Name the file `YYYY-MM-DD - <ShortDescription>.sql` using **today's date**. If another
|
|
121
|
+
file already exists for today in that folder and yours must run after it, append the next
|
|
122
|
+
free letter (`b`, `c`, …) right after the date.
|
|
123
|
+
3. Write **idempotent / forward-only** SQL that is safe to run in alphabetical order after all
|
|
124
|
+
prior files in the folder. Follow `rules/common/security.md` — no credentials in the file.
|
|
125
|
+
4. To make a change reach only module-using clients, put it in `_modules/<module>/` and ensure
|
|
126
|
+
the relevant clients list `<module>` in their `_modules.txt`.
|
|
127
|
+
5. Never edit or re-date an already-applied file — add a new dated file instead. Never put new
|
|
128
|
+
work in a `HISTORIC` folder.
|
|
129
|
+
|
|
130
|
+
## Relationship to the rest of 2.0
|
|
131
|
+
|
|
132
|
+
`dbchanges2` is registered as a **2.0 core repo** (`role: core` in `registry.json`) — it is
|
|
133
|
+
platform-wide infrastructure, not a single application. It has no code dependency on
|
|
134
|
+
`_underscore`, but it is **conceptually coupled** to the `_underscore` database model: its
|
|
135
|
+
folder names mirror the DB families (`Core`, `Logs`, `Client_<Tenant>`, `Logs_<Tenant>`)
|
|
136
|
+
defined in `2.0/apps/_underscore/architecture.md`, and its change files create/alter the
|
|
137
|
+
tables that `_Model_*` classes map to.
|
package/knowledge/INDEX.md
CHANGED
|
@@ -12,6 +12,7 @@ _Auto-generated by `knowledge.js index`. Do not hand-edit._
|
|
|
12
12
|
- **_underscore** (_Underscore) _(framework core)_ — 2 doc(s) → [2.0/apps/_underscore/INDEX.md](2.0/apps/_underscore/INDEX.md)
|
|
13
13
|
- **worker2** (Worker) — 3 doc(s) → [2.0/apps/worker2/INDEX.md](2.0/apps/worker2/INDEX.md)
|
|
14
14
|
- **api2** (API) — 1 doc(s) → [2.0/apps/api2/INDEX.md](2.0/apps/api2/INDEX.md)
|
|
15
|
+
- **dbchanges2** (Database Changes) _(framework core)_ — 1 doc(s) → [2.0/apps/dbchanges2/INDEX.md](2.0/apps/dbchanges2/INDEX.md)
|
|
15
16
|
|
|
16
17
|
## Clients
|
|
17
18
|
|
package/knowledge/registry.json
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
{ "repo": "_underscore", "project": "_Underscore", "framework": "2.0", "role": "core", "dependsOn": [] },
|
|
3
3
|
{ "repo": "worker2", "project": "Worker", "framework": "2.0", "role": "app", "dependsOn": [] },
|
|
4
4
|
{ "repo": "api2", "project": "API", "framework": "2.0", "role": "app", "dependsOn": [] },
|
|
5
|
+
{ "repo": "dbchanges2", "project": "Database Changes", "framework": "2.0", "role": "core", "dependsOn": [] },
|
|
5
6
|
{ "repo": "library", "project": "Library", "framework": "1.0", "role": "core", "dependsOn": [] },
|
|
6
7
|
{ "repo": "worker", "project": "Worker", "framework": "1.0", "role": "app", "dependsOn": [] }
|
|
7
8
|
]
|
package/package.json
CHANGED
package/skills/capture/SKILL.md
CHANGED
|
@@ -138,6 +138,13 @@ Skip mirror-back if the paths are the same directory.
|
|
|
138
138
|
|
|
139
139
|
## Step 7 — Push (only when IS_GIT_CLONE is true)
|
|
140
140
|
|
|
141
|
+
**This push is pre-authorized and mandatory — never ask the developer to confirm it.**
|
|
142
|
+
Running `/capture` IS the authorization to publish. After validate + index pass and the
|
|
143
|
+
staged set is confined to `knowledge/`, commit and push automatically as the final step of
|
|
144
|
+
every capture. Do not pause, do not present a "ready to push?" prompt, do not offer to "leave
|
|
145
|
+
it staged locally." The only reasons to stop are the guardrails already listed below: nothing
|
|
146
|
+
new to push (Check B empty), files staged outside `knowledge/`, or a push that errors.
|
|
147
|
+
|
|
141
148
|
If `IS_GIT_CLONE` is false — skip this step entirely and show:
|
|
142
149
|
> "⚠ Docs written to `.claude/knowledge/` only (no git clone). Run `npx toga-ai`
|
|
143
150
|
> to create `~/toga-tech`, then re-run /capture to push."
|