1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# =============================================================================
# maintenance Module - Schema Index
# =============================================================================
# Version: 2.0
# Description: Module schema index. `module:` and `schema:` are stamped from the
# module name by `metaphor module create`. `schema:` gives this module its OWN
# Postgres schema (migrations emit `CREATE SCHEMA maintenance` and qualify tables
# as `maintenance.<table>`) — the convention every backbone module follows
# (see backbone-sapiens, backbone-bucket). Do not remove it.
# =============================================================================
module: maintenance
version: 2
schema: maintenance
# =============================================================================
# Tenancy: none, by design (ADR-0029)
# -----------------------------------------------------------------------------
# This module is tenant-agnostic. It declares NO company axis and NO fence:
# RLS stays ENABLE+FORCE with zero policies after the strip, and the composing
# service installs the org-unit fence (tenancy.yaml + decorator) at composition
# time. The historical postures port to the composed world as follows:
# - maintenance_stages (was shared_blank — nullable company_id, NULL = the
# one shared stage set): ROOT-ANCHORED rows. The decorator's allow_root
# admits tenant-root-anchored stages, and the scope union (subtree ∪
# tenant root) carries the visible-to-every-company semantics; a stage
# anchored at a regular unit is that unit's private stage, the same
# distinction the old company_id-set arm drew.
# - schedules / visits / visit_parts / requests (were strict): plain
# org-scoped rows — the decorator's NOT NULL org_unit_id with the
# acting-unit fill, exactly like every strict table before them.
# -----------------------------------------------------------------------------
description: "maintenance domain module"
config:
database: postgresql
soft_delete: true
audit: true
default_timestamps: true
generators:
disabled:
- graphql
- grpc
- proto
# Reuse sapiens for user identity (actors) — logical refs, no DB constraint.
external_imports:
- module: sapiens
types:
# Shared value-object types available to all models in this module.
shared_types:
Timestamps:
created_at:
type: datetime
attributes:
description: "Record creation timestamp"
updated_at:
type: datetime
attributes:
description: "Last update timestamp"
deleted_at:
type: datetime?
description: "Soft delete timestamp"
Actors:
created_by:
type: uuid?
attributes:
description: "User who created this record"
updated_by:
type: uuid?
attributes:
description: "User who last updated this record"
deleted_by:
type: uuid?
attributes:
description: "User who deleted this record"
Metadata:
# Import each entity model. Replace `example` with your real entities.
imports:
- maintenance_schedule.model.yaml
- maintenance_visit.model.yaml
- maintenance_stage.model.yaml
- maintenance_request.model.yaml