@codyswann/lisa 2.166.4 → 2.166.5
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/package.json +5 -5
- package/plugins/lisa/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-agy/plugin.json +1 -1
- package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-agy/plugin.json +1 -1
- package/plugins/lisa-cdk-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-agy/plugin.json +1 -1
- package/plugins/lisa-expo-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric/skills/harper-schema-graphql/SKILL.md +68 -17
- package/plugins/lisa-harper-fabric-agy/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-agy/skills/harper-schema-graphql/SKILL.md +68 -17
- package/plugins/lisa-harper-fabric-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-copilot/skills/harper-schema-graphql/SKILL.md +68 -17
- package/plugins/lisa-harper-fabric-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-cursor/skills/harper-schema-graphql/SKILL.md +68 -17
- package/plugins/lisa-nestjs/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-agy/plugin.json +1 -1
- package/plugins/lisa-nestjs-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw-agy/plugin.json +1 -1
- package/plugins/lisa-openclaw-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-agy/plugin.json +1 -1
- package/plugins/lisa-phaser-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-agy/plugin.json +1 -1
- package/plugins/lisa-rails-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-agy/plugin.json +1 -1
- package/plugins/lisa-typescript-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-agy/plugin.json +1 -1
- package/plugins/lisa-wiki-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/src/harper-fabric/skills/harper-schema-graphql/SKILL.md +68 -17
package/package.json
CHANGED
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"lodash": ">=4.18.1"
|
|
86
86
|
},
|
|
87
87
|
"name": "@codyswann/lisa",
|
|
88
|
-
"version": "2.166.
|
|
88
|
+
"version": "2.166.5",
|
|
89
89
|
"description": "Claude Code governance framework that applies guardrails, guidance, and automated enforcement to projects",
|
|
90
90
|
"main": "dist/index.js",
|
|
91
91
|
"exports": {
|
|
@@ -166,7 +166,7 @@
|
|
|
166
166
|
"@types/jest": "^30.0.0",
|
|
167
167
|
"@types/lodash.merge": "^4.6.0",
|
|
168
168
|
"@types/node": "^22.0.0",
|
|
169
|
-
"@vitest/coverage-v8": "^4.1.
|
|
169
|
+
"@vitest/coverage-v8": "^4.1.9",
|
|
170
170
|
"commander": "^12.0.0",
|
|
171
171
|
"esbuild-register": "^3.6.0",
|
|
172
172
|
"eslint": "^9.39.0",
|
|
@@ -205,17 +205,17 @@
|
|
|
205
205
|
"tsx": "^4.0.0",
|
|
206
206
|
"typescript": "^6.0.3",
|
|
207
207
|
"typescript-eslint": "^8.0.0",
|
|
208
|
-
"vitest": "^4.1.
|
|
208
|
+
"vitest": "^4.1.9"
|
|
209
209
|
},
|
|
210
210
|
"devDependencies": {
|
|
211
|
-
"@codyswann/lisa": "^2.
|
|
211
|
+
"@codyswann/lisa": "^2.166.4",
|
|
212
212
|
"@types/js-yaml": "^4.0.9",
|
|
213
213
|
"@types/semver": "^7.7.1",
|
|
214
214
|
"eslint-plugin-oxlint": "^1.62.0",
|
|
215
215
|
"js-yaml": "^4.1.1",
|
|
216
216
|
"oxlint": "^1.62.0",
|
|
217
217
|
"oxlint-tsgolint": "^0.22.1",
|
|
218
|
-
"vite": "^8.0.
|
|
218
|
+
"vite": "^8.0.16"
|
|
219
219
|
},
|
|
220
220
|
"type": "module"
|
|
221
221
|
}
|
|
@@ -16,28 +16,39 @@ the REST/GraphQL surface exposes.
|
|
|
16
16
|
## Defining tables
|
|
17
17
|
|
|
18
18
|
A table is a GraphQL type. Harper-specific directives mark a type as a persisted
|
|
19
|
-
table and control exposure, primary keys,
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
table and control exposure, primary keys, indexes, audit timestamps, sealed
|
|
20
|
+
records, and relationships. Lisa's Harper Fabric template pins `harperdb` to the
|
|
21
|
+
Harper 4 line (`^4.7.29`), so use this v4 directive reference for template
|
|
22
|
+
projects:
|
|
22
23
|
|
|
23
24
|
```graphql
|
|
24
|
-
type Dog @table {
|
|
25
|
-
id:
|
|
25
|
+
type Dog @table @export(name: "dogs") {
|
|
26
|
+
id: Long @primaryKey
|
|
26
27
|
name: String @indexed
|
|
27
28
|
breed: String
|
|
28
|
-
|
|
29
|
+
ownerId: Long @indexed
|
|
30
|
+
owner: Owner @relationship(from: ownerId)
|
|
31
|
+
createdAt: Long @createdTime
|
|
32
|
+
updatedAt: Long @updatedTime
|
|
29
33
|
}
|
|
30
34
|
```
|
|
31
35
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
36
|
+
| Directive | Scope | Syntax | Use |
|
|
37
|
+
| --- | --- | --- | --- |
|
|
38
|
+
| `@table` | Type | `type Product @table { ... }` | Creates a persisted table named after the type. Optional arguments: `table: "products"` to override the table name, `database: "commerce"` to choose a database, `expiration: 3600` for TTL-style records, and `audit: true` to force audit logging. |
|
|
39
|
+
| `@export` | Type | `type Product @table @export(name: "products") { ... }` | Exposes the table as a resource endpoint for REST/MQTT and related surfaces. `name` is optional; without it the type name is the path segment. |
|
|
40
|
+
| `@sealed` | Type | `type Product @table @sealed { ... }` | Rejects undeclared properties. Omit it when the table intentionally accepts extra record fields. |
|
|
41
|
+
| `@primaryKey` | Field | `id: Long @primaryKey` | Marks the unique table key. If omitted on insert, Harper v4 can auto-generate a UUID for `String`/`ID` keys or an auto-incrementing integer for `Int`/`Long`/`Any` keys. Prefer `Long` or `Any` for generated numeric keys. |
|
|
42
|
+
| `@indexed` | Field | `sku: String @indexed` | Adds a secondary index used by REST filters, SQL, and NoSQL/search paths. Array fields index each element. For vectors in Harper v4.6+, use `embedding: [Float] @indexed(type: "HNSW")`. |
|
|
43
|
+
| `@createdTime` | Field | `createdAt: Long @createdTime` | Writes Unix epoch milliseconds when the record is created. |
|
|
44
|
+
| `@updatedTime` | Field | `updatedAt: Long @updatedTime` | Writes Unix epoch milliseconds whenever the record is updated. |
|
|
45
|
+
| `@relationship(from: field)` | Field | `owner: Owner @relationship(from: ownerId)` | The foreign key is on this table and references the target table primary key. If the foreign key field is an array, the relationship is many-to-many. |
|
|
46
|
+
| `@relationship(to: field)` | Field | `dogs: [Dog] @relationship(to: ownerId)` | The foreign key is on the target table. The relationship field must be an array. |
|
|
47
|
+
| `@relationship(from: field, to: field)` | Field | `product: Product @relationship(from: productSku, to: sku)` | Joins this table's field to a non-primary-key field on the target table. Index both join fields. |
|
|
48
|
+
|
|
49
|
+
Use v5 docs only when the downstream project has intentionally moved off the Lisa
|
|
50
|
+
template's Harper 4 dependency; do not mix v5-only syntax into a `harperdb`
|
|
51
|
+
`^4.7.29` project.
|
|
41
52
|
|
|
42
53
|
## How the schema drives the app
|
|
43
54
|
|
|
@@ -48,6 +59,45 @@ type Dog @table {
|
|
|
48
59
|
or removal in the schema is a breaking change for every resource and verify path
|
|
49
60
|
that references it.
|
|
50
61
|
|
|
62
|
+
## Schema evolution
|
|
63
|
+
|
|
64
|
+
Schema changes are deploy-time data-model changes, not just type edits. Harper's
|
|
65
|
+
`graphqlSchema` extension ensures declared tables and attributes exist when the
|
|
66
|
+
component loads, but it does not perform semantic data migrations such as
|
|
67
|
+
renaming tables, copying field values, or rewriting existing rows for you.
|
|
68
|
+
|
|
69
|
+
Classify each change before editing:
|
|
70
|
+
|
|
71
|
+
| Change | Compatibility | What Harper does | Required agent work |
|
|
72
|
+
| --- | --- | --- | --- |
|
|
73
|
+
| Add optional field | Usually safe | Adds the declared attribute shape; existing rows read as missing/`null` until written. | Update resources, seeds, and verification that should include the field. |
|
|
74
|
+
| Add required/non-null field | Breaking for existing rows and writers | The schema can declare the field, but existing records do not magically gain valid values. | Backfill first or deploy as optional, populate, then tighten in a later deploy. |
|
|
75
|
+
| Add `@indexed` | Usually safe, operationally sensitive | Creates/uses a secondary index for the attribute. Large tables may pay rebuild cost. | Verify filtered REST/search paths and note index build risk in the deploy runbook. |
|
|
76
|
+
| Add `@sealed` | Breaking when rows or writers use extra properties | Future writes with undeclared properties are rejected. | Audit current data/writers, declare needed fields, or migrate callers before sealing. |
|
|
77
|
+
| Rename field | Breaking | Treated as a new field; the old field and its values are not transformed. | Add the new field, copy values with a migration, update code, verify, then remove old usage. |
|
|
78
|
+
| Rename type/table | Breaking | Harper v4 does not rename tables; changing the type name creates a new empty table and leaves the old table/data untouched. | Create the new table, copy data, update resources/routes, verify both read/write paths, then retire the old table intentionally. |
|
|
79
|
+
| Change field type | Breaking | Existing stored values are not coerced into the new type in a controlled migration. | Add a replacement field/table, transform data with code, verify, then remove old usage. |
|
|
80
|
+
| Remove field/type | Breaking | Schema no longer declares it, but dependent resources, routes, queries, seeds, and clients can still reference it. | Delete references first, run a migration/cleanup if needed, and verify old API paths fail or redirect intentionally. |
|
|
81
|
+
|
|
82
|
+
Migration recipe for production data:
|
|
83
|
+
|
|
84
|
+
1. Add the new schema shape in a backward-compatible way: new table or nullable
|
|
85
|
+
replacement field, keeping the old field/table available.
|
|
86
|
+
2. Write a one-shot migration using a Harper resource method or Operations
|
|
87
|
+
API/script that reads old rows, transforms values, and writes the new shape.
|
|
88
|
+
Make it idempotent; reruns should skip rows already migrated or compare a
|
|
89
|
+
migration marker.
|
|
90
|
+
3. Deploy to one Fabric environment and run the migration before switching
|
|
91
|
+
readers/writers. For replicated Fabric deployments, assume every node may see
|
|
92
|
+
the new code/schema at slightly different times; keep old and new reads
|
|
93
|
+
compatible until replication and smoke checks are green.
|
|
94
|
+
4. Update resources, REST/GraphQL queries, data-loader seeds, and verify scripts
|
|
95
|
+
in the same PR. A schema PR is incomplete if `bun run verify` or the project
|
|
96
|
+
smoke path cannot prove the migrated read/write behavior.
|
|
97
|
+
5. Roll back by reverting code/schema only when the old field/table remains
|
|
98
|
+
intact. Once cleanup drops old data or callers, rollback needs a reverse
|
|
99
|
+
migration and a restored compatibility path.
|
|
100
|
+
|
|
51
101
|
## Project conventions
|
|
52
102
|
|
|
53
103
|
- `schema.graphql` is **source** and lives at the component root that Fabric
|
|
@@ -68,5 +118,6 @@ Run any verify path that asserts row counts or joins against the changed model.
|
|
|
68
118
|
|
|
69
119
|
## Sources
|
|
70
120
|
|
|
71
|
-
- [
|
|
72
|
-
- [
|
|
121
|
+
- [Harper v4 Schema](https://docs.harperdb.io/reference/v4/database/schema)
|
|
122
|
+
- [Components overview](https://docs.harperdb.io/reference/v4/components/overview)
|
|
123
|
+
- [Operations API](https://docs.harperdb.io/reference/v4/operations-api/operations)
|
|
@@ -16,28 +16,39 @@ the REST/GraphQL surface exposes.
|
|
|
16
16
|
## Defining tables
|
|
17
17
|
|
|
18
18
|
A table is a GraphQL type. Harper-specific directives mark a type as a persisted
|
|
19
|
-
table and control exposure, primary keys,
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
table and control exposure, primary keys, indexes, audit timestamps, sealed
|
|
20
|
+
records, and relationships. Lisa's Harper Fabric template pins `harperdb` to the
|
|
21
|
+
Harper 4 line (`^4.7.29`), so use this v4 directive reference for template
|
|
22
|
+
projects:
|
|
22
23
|
|
|
23
24
|
```graphql
|
|
24
|
-
type Dog @table {
|
|
25
|
-
id:
|
|
25
|
+
type Dog @table @export(name: "dogs") {
|
|
26
|
+
id: Long @primaryKey
|
|
26
27
|
name: String @indexed
|
|
27
28
|
breed: String
|
|
28
|
-
|
|
29
|
+
ownerId: Long @indexed
|
|
30
|
+
owner: Owner @relationship(from: ownerId)
|
|
31
|
+
createdAt: Long @createdTime
|
|
32
|
+
updatedAt: Long @updatedTime
|
|
29
33
|
}
|
|
30
34
|
```
|
|
31
35
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
36
|
+
| Directive | Scope | Syntax | Use |
|
|
37
|
+
| --- | --- | --- | --- |
|
|
38
|
+
| `@table` | Type | `type Product @table { ... }` | Creates a persisted table named after the type. Optional arguments: `table: "products"` to override the table name, `database: "commerce"` to choose a database, `expiration: 3600` for TTL-style records, and `audit: true` to force audit logging. |
|
|
39
|
+
| `@export` | Type | `type Product @table @export(name: "products") { ... }` | Exposes the table as a resource endpoint for REST/MQTT and related surfaces. `name` is optional; without it the type name is the path segment. |
|
|
40
|
+
| `@sealed` | Type | `type Product @table @sealed { ... }` | Rejects undeclared properties. Omit it when the table intentionally accepts extra record fields. |
|
|
41
|
+
| `@primaryKey` | Field | `id: Long @primaryKey` | Marks the unique table key. If omitted on insert, Harper v4 can auto-generate a UUID for `String`/`ID` keys or an auto-incrementing integer for `Int`/`Long`/`Any` keys. Prefer `Long` or `Any` for generated numeric keys. |
|
|
42
|
+
| `@indexed` | Field | `sku: String @indexed` | Adds a secondary index used by REST filters, SQL, and NoSQL/search paths. Array fields index each element. For vectors in Harper v4.6+, use `embedding: [Float] @indexed(type: "HNSW")`. |
|
|
43
|
+
| `@createdTime` | Field | `createdAt: Long @createdTime` | Writes Unix epoch milliseconds when the record is created. |
|
|
44
|
+
| `@updatedTime` | Field | `updatedAt: Long @updatedTime` | Writes Unix epoch milliseconds whenever the record is updated. |
|
|
45
|
+
| `@relationship(from: field)` | Field | `owner: Owner @relationship(from: ownerId)` | The foreign key is on this table and references the target table primary key. If the foreign key field is an array, the relationship is many-to-many. |
|
|
46
|
+
| `@relationship(to: field)` | Field | `dogs: [Dog] @relationship(to: ownerId)` | The foreign key is on the target table. The relationship field must be an array. |
|
|
47
|
+
| `@relationship(from: field, to: field)` | Field | `product: Product @relationship(from: productSku, to: sku)` | Joins this table's field to a non-primary-key field on the target table. Index both join fields. |
|
|
48
|
+
|
|
49
|
+
Use v5 docs only when the downstream project has intentionally moved off the Lisa
|
|
50
|
+
template's Harper 4 dependency; do not mix v5-only syntax into a `harperdb`
|
|
51
|
+
`^4.7.29` project.
|
|
41
52
|
|
|
42
53
|
## How the schema drives the app
|
|
43
54
|
|
|
@@ -48,6 +59,45 @@ type Dog @table {
|
|
|
48
59
|
or removal in the schema is a breaking change for every resource and verify path
|
|
49
60
|
that references it.
|
|
50
61
|
|
|
62
|
+
## Schema evolution
|
|
63
|
+
|
|
64
|
+
Schema changes are deploy-time data-model changes, not just type edits. Harper's
|
|
65
|
+
`graphqlSchema` extension ensures declared tables and attributes exist when the
|
|
66
|
+
component loads, but it does not perform semantic data migrations such as
|
|
67
|
+
renaming tables, copying field values, or rewriting existing rows for you.
|
|
68
|
+
|
|
69
|
+
Classify each change before editing:
|
|
70
|
+
|
|
71
|
+
| Change | Compatibility | What Harper does | Required agent work |
|
|
72
|
+
| --- | --- | --- | --- |
|
|
73
|
+
| Add optional field | Usually safe | Adds the declared attribute shape; existing rows read as missing/`null` until written. | Update resources, seeds, and verification that should include the field. |
|
|
74
|
+
| Add required/non-null field | Breaking for existing rows and writers | The schema can declare the field, but existing records do not magically gain valid values. | Backfill first or deploy as optional, populate, then tighten in a later deploy. |
|
|
75
|
+
| Add `@indexed` | Usually safe, operationally sensitive | Creates/uses a secondary index for the attribute. Large tables may pay rebuild cost. | Verify filtered REST/search paths and note index build risk in the deploy runbook. |
|
|
76
|
+
| Add `@sealed` | Breaking when rows or writers use extra properties | Future writes with undeclared properties are rejected. | Audit current data/writers, declare needed fields, or migrate callers before sealing. |
|
|
77
|
+
| Rename field | Breaking | Treated as a new field; the old field and its values are not transformed. | Add the new field, copy values with a migration, update code, verify, then remove old usage. |
|
|
78
|
+
| Rename type/table | Breaking | Harper v4 does not rename tables; changing the type name creates a new empty table and leaves the old table/data untouched. | Create the new table, copy data, update resources/routes, verify both read/write paths, then retire the old table intentionally. |
|
|
79
|
+
| Change field type | Breaking | Existing stored values are not coerced into the new type in a controlled migration. | Add a replacement field/table, transform data with code, verify, then remove old usage. |
|
|
80
|
+
| Remove field/type | Breaking | Schema no longer declares it, but dependent resources, routes, queries, seeds, and clients can still reference it. | Delete references first, run a migration/cleanup if needed, and verify old API paths fail or redirect intentionally. |
|
|
81
|
+
|
|
82
|
+
Migration recipe for production data:
|
|
83
|
+
|
|
84
|
+
1. Add the new schema shape in a backward-compatible way: new table or nullable
|
|
85
|
+
replacement field, keeping the old field/table available.
|
|
86
|
+
2. Write a one-shot migration using a Harper resource method or Operations
|
|
87
|
+
API/script that reads old rows, transforms values, and writes the new shape.
|
|
88
|
+
Make it idempotent; reruns should skip rows already migrated or compare a
|
|
89
|
+
migration marker.
|
|
90
|
+
3. Deploy to one Fabric environment and run the migration before switching
|
|
91
|
+
readers/writers. For replicated Fabric deployments, assume every node may see
|
|
92
|
+
the new code/schema at slightly different times; keep old and new reads
|
|
93
|
+
compatible until replication and smoke checks are green.
|
|
94
|
+
4. Update resources, REST/GraphQL queries, data-loader seeds, and verify scripts
|
|
95
|
+
in the same PR. A schema PR is incomplete if `bun run verify` or the project
|
|
96
|
+
smoke path cannot prove the migrated read/write behavior.
|
|
97
|
+
5. Roll back by reverting code/schema only when the old field/table remains
|
|
98
|
+
intact. Once cleanup drops old data or callers, rollback needs a reverse
|
|
99
|
+
migration and a restored compatibility path.
|
|
100
|
+
|
|
51
101
|
## Project conventions
|
|
52
102
|
|
|
53
103
|
- `schema.graphql` is **source** and lives at the component root that Fabric
|
|
@@ -68,5 +118,6 @@ Run any verify path that asserts row counts or joins against the changed model.
|
|
|
68
118
|
|
|
69
119
|
## Sources
|
|
70
120
|
|
|
71
|
-
- [
|
|
72
|
-
- [
|
|
121
|
+
- [Harper v4 Schema](https://docs.harperdb.io/reference/v4/database/schema)
|
|
122
|
+
- [Components overview](https://docs.harperdb.io/reference/v4/components/overview)
|
|
123
|
+
- [Operations API](https://docs.harperdb.io/reference/v4/operations-api/operations)
|
|
@@ -16,28 +16,39 @@ the REST/GraphQL surface exposes.
|
|
|
16
16
|
## Defining tables
|
|
17
17
|
|
|
18
18
|
A table is a GraphQL type. Harper-specific directives mark a type as a persisted
|
|
19
|
-
table and control exposure, primary keys,
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
table and control exposure, primary keys, indexes, audit timestamps, sealed
|
|
20
|
+
records, and relationships. Lisa's Harper Fabric template pins `harperdb` to the
|
|
21
|
+
Harper 4 line (`^4.7.29`), so use this v4 directive reference for template
|
|
22
|
+
projects:
|
|
22
23
|
|
|
23
24
|
```graphql
|
|
24
|
-
type Dog @table {
|
|
25
|
-
id:
|
|
25
|
+
type Dog @table @export(name: "dogs") {
|
|
26
|
+
id: Long @primaryKey
|
|
26
27
|
name: String @indexed
|
|
27
28
|
breed: String
|
|
28
|
-
|
|
29
|
+
ownerId: Long @indexed
|
|
30
|
+
owner: Owner @relationship(from: ownerId)
|
|
31
|
+
createdAt: Long @createdTime
|
|
32
|
+
updatedAt: Long @updatedTime
|
|
29
33
|
}
|
|
30
34
|
```
|
|
31
35
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
36
|
+
| Directive | Scope | Syntax | Use |
|
|
37
|
+
| --- | --- | --- | --- |
|
|
38
|
+
| `@table` | Type | `type Product @table { ... }` | Creates a persisted table named after the type. Optional arguments: `table: "products"` to override the table name, `database: "commerce"` to choose a database, `expiration: 3600` for TTL-style records, and `audit: true` to force audit logging. |
|
|
39
|
+
| `@export` | Type | `type Product @table @export(name: "products") { ... }` | Exposes the table as a resource endpoint for REST/MQTT and related surfaces. `name` is optional; without it the type name is the path segment. |
|
|
40
|
+
| `@sealed` | Type | `type Product @table @sealed { ... }` | Rejects undeclared properties. Omit it when the table intentionally accepts extra record fields. |
|
|
41
|
+
| `@primaryKey` | Field | `id: Long @primaryKey` | Marks the unique table key. If omitted on insert, Harper v4 can auto-generate a UUID for `String`/`ID` keys or an auto-incrementing integer for `Int`/`Long`/`Any` keys. Prefer `Long` or `Any` for generated numeric keys. |
|
|
42
|
+
| `@indexed` | Field | `sku: String @indexed` | Adds a secondary index used by REST filters, SQL, and NoSQL/search paths. Array fields index each element. For vectors in Harper v4.6+, use `embedding: [Float] @indexed(type: "HNSW")`. |
|
|
43
|
+
| `@createdTime` | Field | `createdAt: Long @createdTime` | Writes Unix epoch milliseconds when the record is created. |
|
|
44
|
+
| `@updatedTime` | Field | `updatedAt: Long @updatedTime` | Writes Unix epoch milliseconds whenever the record is updated. |
|
|
45
|
+
| `@relationship(from: field)` | Field | `owner: Owner @relationship(from: ownerId)` | The foreign key is on this table and references the target table primary key. If the foreign key field is an array, the relationship is many-to-many. |
|
|
46
|
+
| `@relationship(to: field)` | Field | `dogs: [Dog] @relationship(to: ownerId)` | The foreign key is on the target table. The relationship field must be an array. |
|
|
47
|
+
| `@relationship(from: field, to: field)` | Field | `product: Product @relationship(from: productSku, to: sku)` | Joins this table's field to a non-primary-key field on the target table. Index both join fields. |
|
|
48
|
+
|
|
49
|
+
Use v5 docs only when the downstream project has intentionally moved off the Lisa
|
|
50
|
+
template's Harper 4 dependency; do not mix v5-only syntax into a `harperdb`
|
|
51
|
+
`^4.7.29` project.
|
|
41
52
|
|
|
42
53
|
## How the schema drives the app
|
|
43
54
|
|
|
@@ -48,6 +59,45 @@ type Dog @table {
|
|
|
48
59
|
or removal in the schema is a breaking change for every resource and verify path
|
|
49
60
|
that references it.
|
|
50
61
|
|
|
62
|
+
## Schema evolution
|
|
63
|
+
|
|
64
|
+
Schema changes are deploy-time data-model changes, not just type edits. Harper's
|
|
65
|
+
`graphqlSchema` extension ensures declared tables and attributes exist when the
|
|
66
|
+
component loads, but it does not perform semantic data migrations such as
|
|
67
|
+
renaming tables, copying field values, or rewriting existing rows for you.
|
|
68
|
+
|
|
69
|
+
Classify each change before editing:
|
|
70
|
+
|
|
71
|
+
| Change | Compatibility | What Harper does | Required agent work |
|
|
72
|
+
| --- | --- | --- | --- |
|
|
73
|
+
| Add optional field | Usually safe | Adds the declared attribute shape; existing rows read as missing/`null` until written. | Update resources, seeds, and verification that should include the field. |
|
|
74
|
+
| Add required/non-null field | Breaking for existing rows and writers | The schema can declare the field, but existing records do not magically gain valid values. | Backfill first or deploy as optional, populate, then tighten in a later deploy. |
|
|
75
|
+
| Add `@indexed` | Usually safe, operationally sensitive | Creates/uses a secondary index for the attribute. Large tables may pay rebuild cost. | Verify filtered REST/search paths and note index build risk in the deploy runbook. |
|
|
76
|
+
| Add `@sealed` | Breaking when rows or writers use extra properties | Future writes with undeclared properties are rejected. | Audit current data/writers, declare needed fields, or migrate callers before sealing. |
|
|
77
|
+
| Rename field | Breaking | Treated as a new field; the old field and its values are not transformed. | Add the new field, copy values with a migration, update code, verify, then remove old usage. |
|
|
78
|
+
| Rename type/table | Breaking | Harper v4 does not rename tables; changing the type name creates a new empty table and leaves the old table/data untouched. | Create the new table, copy data, update resources/routes, verify both read/write paths, then retire the old table intentionally. |
|
|
79
|
+
| Change field type | Breaking | Existing stored values are not coerced into the new type in a controlled migration. | Add a replacement field/table, transform data with code, verify, then remove old usage. |
|
|
80
|
+
| Remove field/type | Breaking | Schema no longer declares it, but dependent resources, routes, queries, seeds, and clients can still reference it. | Delete references first, run a migration/cleanup if needed, and verify old API paths fail or redirect intentionally. |
|
|
81
|
+
|
|
82
|
+
Migration recipe for production data:
|
|
83
|
+
|
|
84
|
+
1. Add the new schema shape in a backward-compatible way: new table or nullable
|
|
85
|
+
replacement field, keeping the old field/table available.
|
|
86
|
+
2. Write a one-shot migration using a Harper resource method or Operations
|
|
87
|
+
API/script that reads old rows, transforms values, and writes the new shape.
|
|
88
|
+
Make it idempotent; reruns should skip rows already migrated or compare a
|
|
89
|
+
migration marker.
|
|
90
|
+
3. Deploy to one Fabric environment and run the migration before switching
|
|
91
|
+
readers/writers. For replicated Fabric deployments, assume every node may see
|
|
92
|
+
the new code/schema at slightly different times; keep old and new reads
|
|
93
|
+
compatible until replication and smoke checks are green.
|
|
94
|
+
4. Update resources, REST/GraphQL queries, data-loader seeds, and verify scripts
|
|
95
|
+
in the same PR. A schema PR is incomplete if `bun run verify` or the project
|
|
96
|
+
smoke path cannot prove the migrated read/write behavior.
|
|
97
|
+
5. Roll back by reverting code/schema only when the old field/table remains
|
|
98
|
+
intact. Once cleanup drops old data or callers, rollback needs a reverse
|
|
99
|
+
migration and a restored compatibility path.
|
|
100
|
+
|
|
51
101
|
## Project conventions
|
|
52
102
|
|
|
53
103
|
- `schema.graphql` is **source** and lives at the component root that Fabric
|
|
@@ -68,5 +118,6 @@ Run any verify path that asserts row counts or joins against the changed model.
|
|
|
68
118
|
|
|
69
119
|
## Sources
|
|
70
120
|
|
|
71
|
-
- [
|
|
72
|
-
- [
|
|
121
|
+
- [Harper v4 Schema](https://docs.harperdb.io/reference/v4/database/schema)
|
|
122
|
+
- [Components overview](https://docs.harperdb.io/reference/v4/components/overview)
|
|
123
|
+
- [Operations API](https://docs.harperdb.io/reference/v4/operations-api/operations)
|
|
@@ -16,28 +16,39 @@ the REST/GraphQL surface exposes.
|
|
|
16
16
|
## Defining tables
|
|
17
17
|
|
|
18
18
|
A table is a GraphQL type. Harper-specific directives mark a type as a persisted
|
|
19
|
-
table and control exposure, primary keys,
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
table and control exposure, primary keys, indexes, audit timestamps, sealed
|
|
20
|
+
records, and relationships. Lisa's Harper Fabric template pins `harperdb` to the
|
|
21
|
+
Harper 4 line (`^4.7.29`), so use this v4 directive reference for template
|
|
22
|
+
projects:
|
|
22
23
|
|
|
23
24
|
```graphql
|
|
24
|
-
type Dog @table {
|
|
25
|
-
id:
|
|
25
|
+
type Dog @table @export(name: "dogs") {
|
|
26
|
+
id: Long @primaryKey
|
|
26
27
|
name: String @indexed
|
|
27
28
|
breed: String
|
|
28
|
-
|
|
29
|
+
ownerId: Long @indexed
|
|
30
|
+
owner: Owner @relationship(from: ownerId)
|
|
31
|
+
createdAt: Long @createdTime
|
|
32
|
+
updatedAt: Long @updatedTime
|
|
29
33
|
}
|
|
30
34
|
```
|
|
31
35
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
36
|
+
| Directive | Scope | Syntax | Use |
|
|
37
|
+
| --- | --- | --- | --- |
|
|
38
|
+
| `@table` | Type | `type Product @table { ... }` | Creates a persisted table named after the type. Optional arguments: `table: "products"` to override the table name, `database: "commerce"` to choose a database, `expiration: 3600` for TTL-style records, and `audit: true` to force audit logging. |
|
|
39
|
+
| `@export` | Type | `type Product @table @export(name: "products") { ... }` | Exposes the table as a resource endpoint for REST/MQTT and related surfaces. `name` is optional; without it the type name is the path segment. |
|
|
40
|
+
| `@sealed` | Type | `type Product @table @sealed { ... }` | Rejects undeclared properties. Omit it when the table intentionally accepts extra record fields. |
|
|
41
|
+
| `@primaryKey` | Field | `id: Long @primaryKey` | Marks the unique table key. If omitted on insert, Harper v4 can auto-generate a UUID for `String`/`ID` keys or an auto-incrementing integer for `Int`/`Long`/`Any` keys. Prefer `Long` or `Any` for generated numeric keys. |
|
|
42
|
+
| `@indexed` | Field | `sku: String @indexed` | Adds a secondary index used by REST filters, SQL, and NoSQL/search paths. Array fields index each element. For vectors in Harper v4.6+, use `embedding: [Float] @indexed(type: "HNSW")`. |
|
|
43
|
+
| `@createdTime` | Field | `createdAt: Long @createdTime` | Writes Unix epoch milliseconds when the record is created. |
|
|
44
|
+
| `@updatedTime` | Field | `updatedAt: Long @updatedTime` | Writes Unix epoch milliseconds whenever the record is updated. |
|
|
45
|
+
| `@relationship(from: field)` | Field | `owner: Owner @relationship(from: ownerId)` | The foreign key is on this table and references the target table primary key. If the foreign key field is an array, the relationship is many-to-many. |
|
|
46
|
+
| `@relationship(to: field)` | Field | `dogs: [Dog] @relationship(to: ownerId)` | The foreign key is on the target table. The relationship field must be an array. |
|
|
47
|
+
| `@relationship(from: field, to: field)` | Field | `product: Product @relationship(from: productSku, to: sku)` | Joins this table's field to a non-primary-key field on the target table. Index both join fields. |
|
|
48
|
+
|
|
49
|
+
Use v5 docs only when the downstream project has intentionally moved off the Lisa
|
|
50
|
+
template's Harper 4 dependency; do not mix v5-only syntax into a `harperdb`
|
|
51
|
+
`^4.7.29` project.
|
|
41
52
|
|
|
42
53
|
## How the schema drives the app
|
|
43
54
|
|
|
@@ -48,6 +59,45 @@ type Dog @table {
|
|
|
48
59
|
or removal in the schema is a breaking change for every resource and verify path
|
|
49
60
|
that references it.
|
|
50
61
|
|
|
62
|
+
## Schema evolution
|
|
63
|
+
|
|
64
|
+
Schema changes are deploy-time data-model changes, not just type edits. Harper's
|
|
65
|
+
`graphqlSchema` extension ensures declared tables and attributes exist when the
|
|
66
|
+
component loads, but it does not perform semantic data migrations such as
|
|
67
|
+
renaming tables, copying field values, or rewriting existing rows for you.
|
|
68
|
+
|
|
69
|
+
Classify each change before editing:
|
|
70
|
+
|
|
71
|
+
| Change | Compatibility | What Harper does | Required agent work |
|
|
72
|
+
| --- | --- | --- | --- |
|
|
73
|
+
| Add optional field | Usually safe | Adds the declared attribute shape; existing rows read as missing/`null` until written. | Update resources, seeds, and verification that should include the field. |
|
|
74
|
+
| Add required/non-null field | Breaking for existing rows and writers | The schema can declare the field, but existing records do not magically gain valid values. | Backfill first or deploy as optional, populate, then tighten in a later deploy. |
|
|
75
|
+
| Add `@indexed` | Usually safe, operationally sensitive | Creates/uses a secondary index for the attribute. Large tables may pay rebuild cost. | Verify filtered REST/search paths and note index build risk in the deploy runbook. |
|
|
76
|
+
| Add `@sealed` | Breaking when rows or writers use extra properties | Future writes with undeclared properties are rejected. | Audit current data/writers, declare needed fields, or migrate callers before sealing. |
|
|
77
|
+
| Rename field | Breaking | Treated as a new field; the old field and its values are not transformed. | Add the new field, copy values with a migration, update code, verify, then remove old usage. |
|
|
78
|
+
| Rename type/table | Breaking | Harper v4 does not rename tables; changing the type name creates a new empty table and leaves the old table/data untouched. | Create the new table, copy data, update resources/routes, verify both read/write paths, then retire the old table intentionally. |
|
|
79
|
+
| Change field type | Breaking | Existing stored values are not coerced into the new type in a controlled migration. | Add a replacement field/table, transform data with code, verify, then remove old usage. |
|
|
80
|
+
| Remove field/type | Breaking | Schema no longer declares it, but dependent resources, routes, queries, seeds, and clients can still reference it. | Delete references first, run a migration/cleanup if needed, and verify old API paths fail or redirect intentionally. |
|
|
81
|
+
|
|
82
|
+
Migration recipe for production data:
|
|
83
|
+
|
|
84
|
+
1. Add the new schema shape in a backward-compatible way: new table or nullable
|
|
85
|
+
replacement field, keeping the old field/table available.
|
|
86
|
+
2. Write a one-shot migration using a Harper resource method or Operations
|
|
87
|
+
API/script that reads old rows, transforms values, and writes the new shape.
|
|
88
|
+
Make it idempotent; reruns should skip rows already migrated or compare a
|
|
89
|
+
migration marker.
|
|
90
|
+
3. Deploy to one Fabric environment and run the migration before switching
|
|
91
|
+
readers/writers. For replicated Fabric deployments, assume every node may see
|
|
92
|
+
the new code/schema at slightly different times; keep old and new reads
|
|
93
|
+
compatible until replication and smoke checks are green.
|
|
94
|
+
4. Update resources, REST/GraphQL queries, data-loader seeds, and verify scripts
|
|
95
|
+
in the same PR. A schema PR is incomplete if `bun run verify` or the project
|
|
96
|
+
smoke path cannot prove the migrated read/write behavior.
|
|
97
|
+
5. Roll back by reverting code/schema only when the old field/table remains
|
|
98
|
+
intact. Once cleanup drops old data or callers, rollback needs a reverse
|
|
99
|
+
migration and a restored compatibility path.
|
|
100
|
+
|
|
51
101
|
## Project conventions
|
|
52
102
|
|
|
53
103
|
- `schema.graphql` is **source** and lives at the component root that Fabric
|
|
@@ -68,5 +118,6 @@ Run any verify path that asserts row counts or joins against the changed model.
|
|
|
68
118
|
|
|
69
119
|
## Sources
|
|
70
120
|
|
|
71
|
-
- [
|
|
72
|
-
- [
|
|
121
|
+
- [Harper v4 Schema](https://docs.harperdb.io/reference/v4/database/schema)
|
|
122
|
+
- [Components overview](https://docs.harperdb.io/reference/v4/components/overview)
|
|
123
|
+
- [Operations API](https://docs.harperdb.io/reference/v4/operations-api/operations)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lisa-openclaw",
|
|
3
|
-
"version": "2.166.
|
|
3
|
+
"version": "2.166.5",
|
|
4
4
|
"description": "Connect staff roles to Telegram or Slack via OpenClaw — facilitator/specialist hub-and-spoke routing and repo-coding topics, for Claude Code and Codex",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Cody Swann"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lisa-openclaw",
|
|
3
|
-
"version": "2.166.
|
|
3
|
+
"version": "2.166.5",
|
|
4
4
|
"description": "Connect staff roles to Telegram or Slack via OpenClaw — facilitator/specialist hub-and-spoke routing and repo-coding topics, across Claude and Codex.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Cody Swann"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lisa-openclaw",
|
|
3
|
-
"version": "2.166.
|
|
3
|
+
"version": "2.166.5",
|
|
4
4
|
"description": "Connect staff roles to Telegram or Slack via OpenClaw — facilitator/specialist hub-and-spoke routing and repo-coding topics, for Claude Code and Codex",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Cody Swann"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lisa-openclaw",
|
|
3
|
-
"version": "2.166.
|
|
3
|
+
"version": "2.166.5",
|
|
4
4
|
"description": "Connect staff roles to Telegram or Slack via OpenClaw — facilitator/specialist hub-and-spoke routing and repo-coding topics, for Claude Code and Codex",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Cody Swann"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lisa-openclaw",
|
|
3
|
-
"version": "2.166.
|
|
3
|
+
"version": "2.166.5",
|
|
4
4
|
"description": "Connect staff roles to Telegram or Slack via OpenClaw — facilitator/specialist hub-and-spoke routing and repo-coding topics, for Claude Code and Codex",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Cody Swann"
|
|
@@ -16,28 +16,39 @@ the REST/GraphQL surface exposes.
|
|
|
16
16
|
## Defining tables
|
|
17
17
|
|
|
18
18
|
A table is a GraphQL type. Harper-specific directives mark a type as a persisted
|
|
19
|
-
table and control exposure, primary keys,
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
table and control exposure, primary keys, indexes, audit timestamps, sealed
|
|
20
|
+
records, and relationships. Lisa's Harper Fabric template pins `harperdb` to the
|
|
21
|
+
Harper 4 line (`^4.7.29`), so use this v4 directive reference for template
|
|
22
|
+
projects:
|
|
22
23
|
|
|
23
24
|
```graphql
|
|
24
|
-
type Dog @table {
|
|
25
|
-
id:
|
|
25
|
+
type Dog @table @export(name: "dogs") {
|
|
26
|
+
id: Long @primaryKey
|
|
26
27
|
name: String @indexed
|
|
27
28
|
breed: String
|
|
28
|
-
|
|
29
|
+
ownerId: Long @indexed
|
|
30
|
+
owner: Owner @relationship(from: ownerId)
|
|
31
|
+
createdAt: Long @createdTime
|
|
32
|
+
updatedAt: Long @updatedTime
|
|
29
33
|
}
|
|
30
34
|
```
|
|
31
35
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
36
|
+
| Directive | Scope | Syntax | Use |
|
|
37
|
+
| --- | --- | --- | --- |
|
|
38
|
+
| `@table` | Type | `type Product @table { ... }` | Creates a persisted table named after the type. Optional arguments: `table: "products"` to override the table name, `database: "commerce"` to choose a database, `expiration: 3600` for TTL-style records, and `audit: true` to force audit logging. |
|
|
39
|
+
| `@export` | Type | `type Product @table @export(name: "products") { ... }` | Exposes the table as a resource endpoint for REST/MQTT and related surfaces. `name` is optional; without it the type name is the path segment. |
|
|
40
|
+
| `@sealed` | Type | `type Product @table @sealed { ... }` | Rejects undeclared properties. Omit it when the table intentionally accepts extra record fields. |
|
|
41
|
+
| `@primaryKey` | Field | `id: Long @primaryKey` | Marks the unique table key. If omitted on insert, Harper v4 can auto-generate a UUID for `String`/`ID` keys or an auto-incrementing integer for `Int`/`Long`/`Any` keys. Prefer `Long` or `Any` for generated numeric keys. |
|
|
42
|
+
| `@indexed` | Field | `sku: String @indexed` | Adds a secondary index used by REST filters, SQL, and NoSQL/search paths. Array fields index each element. For vectors in Harper v4.6+, use `embedding: [Float] @indexed(type: "HNSW")`. |
|
|
43
|
+
| `@createdTime` | Field | `createdAt: Long @createdTime` | Writes Unix epoch milliseconds when the record is created. |
|
|
44
|
+
| `@updatedTime` | Field | `updatedAt: Long @updatedTime` | Writes Unix epoch milliseconds whenever the record is updated. |
|
|
45
|
+
| `@relationship(from: field)` | Field | `owner: Owner @relationship(from: ownerId)` | The foreign key is on this table and references the target table primary key. If the foreign key field is an array, the relationship is many-to-many. |
|
|
46
|
+
| `@relationship(to: field)` | Field | `dogs: [Dog] @relationship(to: ownerId)` | The foreign key is on the target table. The relationship field must be an array. |
|
|
47
|
+
| `@relationship(from: field, to: field)` | Field | `product: Product @relationship(from: productSku, to: sku)` | Joins this table's field to a non-primary-key field on the target table. Index both join fields. |
|
|
48
|
+
|
|
49
|
+
Use v5 docs only when the downstream project has intentionally moved off the Lisa
|
|
50
|
+
template's Harper 4 dependency; do not mix v5-only syntax into a `harperdb`
|
|
51
|
+
`^4.7.29` project.
|
|
41
52
|
|
|
42
53
|
## How the schema drives the app
|
|
43
54
|
|
|
@@ -48,6 +59,45 @@ type Dog @table {
|
|
|
48
59
|
or removal in the schema is a breaking change for every resource and verify path
|
|
49
60
|
that references it.
|
|
50
61
|
|
|
62
|
+
## Schema evolution
|
|
63
|
+
|
|
64
|
+
Schema changes are deploy-time data-model changes, not just type edits. Harper's
|
|
65
|
+
`graphqlSchema` extension ensures declared tables and attributes exist when the
|
|
66
|
+
component loads, but it does not perform semantic data migrations such as
|
|
67
|
+
renaming tables, copying field values, or rewriting existing rows for you.
|
|
68
|
+
|
|
69
|
+
Classify each change before editing:
|
|
70
|
+
|
|
71
|
+
| Change | Compatibility | What Harper does | Required agent work |
|
|
72
|
+
| --- | --- | --- | --- |
|
|
73
|
+
| Add optional field | Usually safe | Adds the declared attribute shape; existing rows read as missing/`null` until written. | Update resources, seeds, and verification that should include the field. |
|
|
74
|
+
| Add required/non-null field | Breaking for existing rows and writers | The schema can declare the field, but existing records do not magically gain valid values. | Backfill first or deploy as optional, populate, then tighten in a later deploy. |
|
|
75
|
+
| Add `@indexed` | Usually safe, operationally sensitive | Creates/uses a secondary index for the attribute. Large tables may pay rebuild cost. | Verify filtered REST/search paths and note index build risk in the deploy runbook. |
|
|
76
|
+
| Add `@sealed` | Breaking when rows or writers use extra properties | Future writes with undeclared properties are rejected. | Audit current data/writers, declare needed fields, or migrate callers before sealing. |
|
|
77
|
+
| Rename field | Breaking | Treated as a new field; the old field and its values are not transformed. | Add the new field, copy values with a migration, update code, verify, then remove old usage. |
|
|
78
|
+
| Rename type/table | Breaking | Harper v4 does not rename tables; changing the type name creates a new empty table and leaves the old table/data untouched. | Create the new table, copy data, update resources/routes, verify both read/write paths, then retire the old table intentionally. |
|
|
79
|
+
| Change field type | Breaking | Existing stored values are not coerced into the new type in a controlled migration. | Add a replacement field/table, transform data with code, verify, then remove old usage. |
|
|
80
|
+
| Remove field/type | Breaking | Schema no longer declares it, but dependent resources, routes, queries, seeds, and clients can still reference it. | Delete references first, run a migration/cleanup if needed, and verify old API paths fail or redirect intentionally. |
|
|
81
|
+
|
|
82
|
+
Migration recipe for production data:
|
|
83
|
+
|
|
84
|
+
1. Add the new schema shape in a backward-compatible way: new table or nullable
|
|
85
|
+
replacement field, keeping the old field/table available.
|
|
86
|
+
2. Write a one-shot migration using a Harper resource method or Operations
|
|
87
|
+
API/script that reads old rows, transforms values, and writes the new shape.
|
|
88
|
+
Make it idempotent; reruns should skip rows already migrated or compare a
|
|
89
|
+
migration marker.
|
|
90
|
+
3. Deploy to one Fabric environment and run the migration before switching
|
|
91
|
+
readers/writers. For replicated Fabric deployments, assume every node may see
|
|
92
|
+
the new code/schema at slightly different times; keep old and new reads
|
|
93
|
+
compatible until replication and smoke checks are green.
|
|
94
|
+
4. Update resources, REST/GraphQL queries, data-loader seeds, and verify scripts
|
|
95
|
+
in the same PR. A schema PR is incomplete if `bun run verify` or the project
|
|
96
|
+
smoke path cannot prove the migrated read/write behavior.
|
|
97
|
+
5. Roll back by reverting code/schema only when the old field/table remains
|
|
98
|
+
intact. Once cleanup drops old data or callers, rollback needs a reverse
|
|
99
|
+
migration and a restored compatibility path.
|
|
100
|
+
|
|
51
101
|
## Project conventions
|
|
52
102
|
|
|
53
103
|
- `schema.graphql` is **source** and lives at the component root that Fabric
|
|
@@ -68,5 +118,6 @@ Run any verify path that asserts row counts or joins against the changed model.
|
|
|
68
118
|
|
|
69
119
|
## Sources
|
|
70
120
|
|
|
71
|
-
- [
|
|
72
|
-
- [
|
|
121
|
+
- [Harper v4 Schema](https://docs.harperdb.io/reference/v4/database/schema)
|
|
122
|
+
- [Components overview](https://docs.harperdb.io/reference/v4/components/overview)
|
|
123
|
+
- [Operations API](https://docs.harperdb.io/reference/v4/operations-api/operations)
|