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
# =============================================================================
# integrations 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 integrations` and qualify tables
# as `integrations.<table>`) — the convention every backbone module follows
# (see backbone-sapiens, backbone-bucket). Do not remove it.
# =============================================================================
module: integrations
version: 2
schema: integrations
# Tenancy: none, by design (ADR-0029). The module is tenant-agnostic and reusable —
# it ships no scoping column and no fence declaration. A composing backend-service
# that wants these tables org-scoped declares them in its tenancy.yaml; the
# decorator installs org_unit_id, the RLS policy, and the org-scoped per-unit
# uniques (the connector provider unique, the OAuth account
# provider+account_ref unique) at composition time. The module's own outbox
# events table keeps its tenant fence with the relay exemption
# (migrations/20260726100000_fence_outbox_company_id.up.sql) — it is relay
# infrastructure, not module tenancy.
description: "integrations domain module"
config:
database: postgresql
soft_delete: true
audit: true
default_timestamps: true
generators:
disabled:
- graphql
- grpc
- proto
# Don't re-export domain entities at the crate root (rec #4) — this module's outward contract is
# the exports::types DTOs + ports, not internal entity representations. Durable across regen.
reexport_entities: false
# 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:
- connector.model.yaml
- integration_event.model.yaml
# OAuth account connections — entity/DTOs/repository/service generate, but the
# model disables its handler target: the surface is the verb-shaped OAuth
# routes (authorize/complete/disconnect/status), never generic CRUD.
- integration_account.model.yaml