000-platform-init.xml
14.6 KB
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
<?xml version="1.0" encoding="UTF-8"?>
<!--
vibe_erp — platform init changelog.
Creates the cross-cutting platform tables: an audit log and the
metadata__* registry tables described in architecture spec section 8
("The metadata store").
These are intentionally minimal v0.1 stubs: id + source + timestamps
+ (where useful) a payload jsonb. Real columns are added by later
changesets in the PBCs that own them. pbc-identity owns the User
schema and ships its own changelog.
vibe_erp is single-tenant per instance: one running process serves
exactly one company against an isolated database. There are no
tenant_id columns and no Row-Level Security policies anywhere in
this changelog — customer isolation happens at the deployment level
(one running instance per customer).
-->
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.27.xsd">
<!-- ─── platform__audit ──────────────────────────────────────────── -->
<changeSet id="platform-init-001" author="vibe_erp">
<createTable tableName="platform__audit">
<column name="id" type="uuid"><constraints primaryKey="true" nullable="false"/></column>
<column name="source" type="varchar(32)" defaultValue="core"><constraints nullable="false"/></column>
<column name="payload" type="jsonb"/>
<column name="created_at" type="timestamptz" defaultValueComputed="now()"><constraints nullable="false"/></column>
<column name="updated_at" type="timestamptz" defaultValueComputed="now()"><constraints nullable="false"/></column>
</createTable>
<createIndex tableName="platform__audit" indexName="platform__audit_source_idx">
<column name="source"/>
</createIndex>
<rollback><dropTable tableName="platform__audit"/></rollback>
</changeSet>
<!-- ─── metadata__entity ─────────────────────────────────────────── -->
<changeSet id="platform-init-002" author="vibe_erp">
<createTable tableName="metadata__entity">
<column name="id" type="uuid"><constraints primaryKey="true" nullable="false"/></column>
<column name="source" type="varchar(32)" defaultValue="core"><constraints nullable="false"/></column>
<column name="payload" type="jsonb"/>
<column name="created_at" type="timestamptz" defaultValueComputed="now()"><constraints nullable="false"/></column>
<column name="updated_at" type="timestamptz" defaultValueComputed="now()"><constraints nullable="false"/></column>
</createTable>
<createIndex tableName="metadata__entity" indexName="metadata__entity_source_idx">
<column name="source"/>
</createIndex>
<rollback><dropTable tableName="metadata__entity"/></rollback>
</changeSet>
<!-- ─── metadata__custom_field ───────────────────────────────────── -->
<changeSet id="platform-init-003" author="vibe_erp">
<createTable tableName="metadata__custom_field">
<column name="id" type="uuid"><constraints primaryKey="true" nullable="false"/></column>
<column name="source" type="varchar(32)" defaultValue="core"><constraints nullable="false"/></column>
<column name="payload" type="jsonb"/>
<column name="created_at" type="timestamptz" defaultValueComputed="now()"><constraints nullable="false"/></column>
<column name="updated_at" type="timestamptz" defaultValueComputed="now()"><constraints nullable="false"/></column>
</createTable>
<createIndex tableName="metadata__custom_field" indexName="metadata__custom_field_source_idx">
<column name="source"/>
</createIndex>
<rollback><dropTable tableName="metadata__custom_field"/></rollback>
</changeSet>
<!-- ─── metadata__form ───────────────────────────────────────────── -->
<changeSet id="platform-init-004" author="vibe_erp">
<createTable tableName="metadata__form">
<column name="id" type="uuid"><constraints primaryKey="true" nullable="false"/></column>
<column name="source" type="varchar(32)" defaultValue="core"><constraints nullable="false"/></column>
<column name="payload" type="jsonb"/>
<column name="created_at" type="timestamptz" defaultValueComputed="now()"><constraints nullable="false"/></column>
<column name="updated_at" type="timestamptz" defaultValueComputed="now()"><constraints nullable="false"/></column>
</createTable>
<createIndex tableName="metadata__form" indexName="metadata__form_source_idx">
<column name="source"/>
</createIndex>
<rollback><dropTable tableName="metadata__form"/></rollback>
</changeSet>
<!-- ─── metadata__list_view ──────────────────────────────────────── -->
<changeSet id="platform-init-005" author="vibe_erp">
<createTable tableName="metadata__list_view">
<column name="id" type="uuid"><constraints primaryKey="true" nullable="false"/></column>
<column name="source" type="varchar(32)" defaultValue="core"><constraints nullable="false"/></column>
<column name="payload" type="jsonb"/>
<column name="created_at" type="timestamptz" defaultValueComputed="now()"><constraints nullable="false"/></column>
<column name="updated_at" type="timestamptz" defaultValueComputed="now()"><constraints nullable="false"/></column>
</createTable>
<createIndex tableName="metadata__list_view" indexName="metadata__list_view_source_idx">
<column name="source"/>
</createIndex>
<rollback><dropTable tableName="metadata__list_view"/></rollback>
</changeSet>
<!-- ─── metadata__workflow ───────────────────────────────────────── -->
<changeSet id="platform-init-006" author="vibe_erp">
<createTable tableName="metadata__workflow">
<column name="id" type="uuid"><constraints primaryKey="true" nullable="false"/></column>
<column name="source" type="varchar(32)" defaultValue="core"><constraints nullable="false"/></column>
<column name="payload" type="jsonb"/>
<column name="created_at" type="timestamptz" defaultValueComputed="now()"><constraints nullable="false"/></column>
<column name="updated_at" type="timestamptz" defaultValueComputed="now()"><constraints nullable="false"/></column>
</createTable>
<createIndex tableName="metadata__workflow" indexName="metadata__workflow_source_idx">
<column name="source"/>
</createIndex>
<rollback><dropTable tableName="metadata__workflow"/></rollback>
</changeSet>
<!-- ─── metadata__rule ───────────────────────────────────────────── -->
<changeSet id="platform-init-007" author="vibe_erp">
<createTable tableName="metadata__rule">
<column name="id" type="uuid"><constraints primaryKey="true" nullable="false"/></column>
<column name="source" type="varchar(32)" defaultValue="core"><constraints nullable="false"/></column>
<column name="payload" type="jsonb"/>
<column name="created_at" type="timestamptz" defaultValueComputed="now()"><constraints nullable="false"/></column>
<column name="updated_at" type="timestamptz" defaultValueComputed="now()"><constraints nullable="false"/></column>
</createTable>
<createIndex tableName="metadata__rule" indexName="metadata__rule_source_idx">
<column name="source"/>
</createIndex>
<rollback><dropTable tableName="metadata__rule"/></rollback>
</changeSet>
<!-- ─── metadata__permission ─────────────────────────────────────── -->
<changeSet id="platform-init-008" author="vibe_erp">
<createTable tableName="metadata__permission">
<column name="id" type="uuid"><constraints primaryKey="true" nullable="false"/></column>
<column name="source" type="varchar(32)" defaultValue="core"><constraints nullable="false"/></column>
<column name="payload" type="jsonb"/>
<column name="created_at" type="timestamptz" defaultValueComputed="now()"><constraints nullable="false"/></column>
<column name="updated_at" type="timestamptz" defaultValueComputed="now()"><constraints nullable="false"/></column>
</createTable>
<createIndex tableName="metadata__permission" indexName="metadata__permission_source_idx">
<column name="source"/>
</createIndex>
<rollback><dropTable tableName="metadata__permission"/></rollback>
</changeSet>
<!-- ─── metadata__role_permission ────────────────────────────────── -->
<changeSet id="platform-init-009" author="vibe_erp">
<createTable tableName="metadata__role_permission">
<column name="id" type="uuid"><constraints primaryKey="true" nullable="false"/></column>
<column name="source" type="varchar(32)" defaultValue="core"><constraints nullable="false"/></column>
<column name="payload" type="jsonb"/>
<column name="created_at" type="timestamptz" defaultValueComputed="now()"><constraints nullable="false"/></column>
<column name="updated_at" type="timestamptz" defaultValueComputed="now()"><constraints nullable="false"/></column>
</createTable>
<createIndex tableName="metadata__role_permission" indexName="metadata__role_permission_source_idx">
<column name="source"/>
</createIndex>
<rollback><dropTable tableName="metadata__role_permission"/></rollback>
</changeSet>
<!-- ─── metadata__menu ───────────────────────────────────────────── -->
<changeSet id="platform-init-010" author="vibe_erp">
<createTable tableName="metadata__menu">
<column name="id" type="uuid"><constraints primaryKey="true" nullable="false"/></column>
<column name="source" type="varchar(32)" defaultValue="core"><constraints nullable="false"/></column>
<column name="payload" type="jsonb"/>
<column name="created_at" type="timestamptz" defaultValueComputed="now()"><constraints nullable="false"/></column>
<column name="updated_at" type="timestamptz" defaultValueComputed="now()"><constraints nullable="false"/></column>
</createTable>
<createIndex tableName="metadata__menu" indexName="metadata__menu_source_idx">
<column name="source"/>
</createIndex>
<rollback><dropTable tableName="metadata__menu"/></rollback>
</changeSet>
<!-- ─── metadata__report ─────────────────────────────────────────── -->
<changeSet id="platform-init-011" author="vibe_erp">
<createTable tableName="metadata__report">
<column name="id" type="uuid"><constraints primaryKey="true" nullable="false"/></column>
<column name="source" type="varchar(32)" defaultValue="core"><constraints nullable="false"/></column>
<column name="payload" type="jsonb"/>
<column name="created_at" type="timestamptz" defaultValueComputed="now()"><constraints nullable="false"/></column>
<column name="updated_at" type="timestamptz" defaultValueComputed="now()"><constraints nullable="false"/></column>
</createTable>
<createIndex tableName="metadata__report" indexName="metadata__report_source_idx">
<column name="source"/>
</createIndex>
<rollback><dropTable tableName="metadata__report"/></rollback>
</changeSet>
<!-- ─── metadata__translation ────────────────────────────────────── -->
<changeSet id="platform-init-012" author="vibe_erp">
<createTable tableName="metadata__translation">
<column name="id" type="uuid"><constraints primaryKey="true" nullable="false"/></column>
<column name="source" type="varchar(32)" defaultValue="core"><constraints nullable="false"/></column>
<column name="payload" type="jsonb"/>
<column name="created_at" type="timestamptz" defaultValueComputed="now()"><constraints nullable="false"/></column>
<column name="updated_at" type="timestamptz" defaultValueComputed="now()"><constraints nullable="false"/></column>
</createTable>
<createIndex tableName="metadata__translation" indexName="metadata__translation_source_idx">
<column name="source"/>
</createIndex>
<rollback><dropTable tableName="metadata__translation"/></rollback>
</changeSet>
<!-- ─── metadata__plugin_config ──────────────────────────────────── -->
<changeSet id="platform-init-013" author="vibe_erp">
<createTable tableName="metadata__plugin_config">
<column name="id" type="uuid"><constraints primaryKey="true" nullable="false"/></column>
<column name="source" type="varchar(32)" defaultValue="core"><constraints nullable="false"/></column>
<column name="payload" type="jsonb"/>
<column name="created_at" type="timestamptz" defaultValueComputed="now()"><constraints nullable="false"/></column>
<column name="updated_at" type="timestamptz" defaultValueComputed="now()"><constraints nullable="false"/></column>
</createTable>
<createIndex tableName="metadata__plugin_config" indexName="metadata__plugin_config_source_idx">
<column name="source"/>
</createIndex>
<rollback><dropTable tableName="metadata__plugin_config"/></rollback>
</changeSet>
</databaseChangeLog>