agentic-domain-document 0.6.0
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/.tbls.yml +201 -0
- package/CHANGELOG.md +68 -0
- package/README.md +313 -0
- package/agent/agent.manifest.json +8 -0
- package/agent/capabilities/document-authoring.json +21 -0
- package/agent/capabilities/document-block.json +22 -0
- package/agent/capabilities/document-toc.json +21 -0
- package/agent/capabilities/document-validation.json +21 -0
- package/agent/examples/document-quality-examples.md +153 -0
- package/agent/examples/examples.md +172 -0
- package/agent/guides/10-document-authoring-guide.md +28 -0
- package/agent/guides/20-domain-boundary-guide.md +41 -0
- package/agent/guides/30-authoring-policy-guide.md +40 -0
- package/agent/guides/40-toc-authoring-guide.md +73 -0
- package/agent/guides/50-content-block-guide.md +57 -0
- package/agent/guides/51-paragraph-authoring-guide.md +68 -0
- package/agent/guides/52-table-authoring-guide.md +73 -0
- package/agent/guides/53-diagram-figure-authoring-guide.md +75 -0
- package/agent/guides/70-korean-writing-style-guide.md +65 -0
- package/agent/instructions/00-runtime-behavior.md +17 -0
- package/agent/instructions/10-scope-and-boundary.md +27 -0
- package/agent/instructions/20-task-procedures.md +69 -0
- package/agent/instructions/30-must-and-must-not.md +34 -0
- package/agent/resource-index.json +185 -0
- package/agent/resource-selection.json +205 -0
- package/agent/routing.json +34 -0
- package/agent/sources/reference-mapping.md +53 -0
- package/agent/validation/document-validation-rules.md +73 -0
- package/dist/agent/document-agent-contribution.d.ts +15 -0
- package/dist/agent/document-agent-contribution.d.ts.map +1 -0
- package/dist/agent/document-agent-contribution.js +39 -0
- package/dist/agent/document-agent-contribution.js.map +1 -0
- package/dist/agent/index.d.ts +2 -0
- package/dist/agent/index.d.ts.map +1 -0
- package/dist/agent/index.js +2 -0
- package/dist/agent/index.js.map +1 -0
- package/dist/database.d.ts +8 -0
- package/dist/database.d.ts.map +1 -0
- package/dist/database.js +76 -0
- package/dist/database.js.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -0
- package/dist/markdown-importer.d.ts +14 -0
- package/dist/markdown-importer.d.ts.map +1 -0
- package/dist/markdown-importer.js +386 -0
- package/dist/markdown-importer.js.map +1 -0
- package/dist/reader.d.ts +17 -0
- package/dist/reader.d.ts.map +1 -0
- package/dist/reader.js +332 -0
- package/dist/reader.js.map +1 -0
- package/dist/repositories.d.ts +118 -0
- package/dist/repositories.d.ts.map +1 -0
- package/dist/repositories.js +388 -0
- package/dist/repositories.js.map +1 -0
- package/dist/service.d.ts +35 -0
- package/dist/service.d.ts.map +1 -0
- package/dist/service.js +327 -0
- package/dist/service.js.map +1 -0
- package/dist/types.d.ts +276 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/validators.d.ts +4 -0
- package/dist/validators.d.ts.map +1 -0
- package/dist/validators.js +255 -0
- package/dist/validators.js.map +1 -0
- package/docs/build.md +55 -0
- package/docs/configuration.md +34 -0
- package/docs/delivery.md +50 -0
- package/docs/operations.md +50 -0
- package/docs/publishing.md +69 -0
- package/docs/schema/generated/README.md +30 -0
- package/docs/schema/generated/document_annotations.md +119 -0
- package/docs/schema/generated/document_annotations.svg +60 -0
- package/docs/schema/generated/document_blocks.md +97 -0
- package/docs/schema/generated/document_blocks.svg +60 -0
- package/docs/schema/generated/document_change_events.md +135 -0
- package/docs/schema/generated/document_change_events.svg +88 -0
- package/docs/schema/generated/document_code_groups.md +70 -0
- package/docs/schema/generated/document_code_groups.svg +52 -0
- package/docs/schema/generated/document_codes.md +88 -0
- package/docs/schema/generated/document_codes.svg +52 -0
- package/docs/schema/generated/document_contents.md +87 -0
- package/docs/schema/generated/document_contents.svg +116 -0
- package/docs/schema/generated/document_documents.md +126 -0
- package/docs/schema/generated/document_documents.svg +222 -0
- package/docs/schema/generated/document_node_taxonomies.md +84 -0
- package/docs/schema/generated/document_node_taxonomies.svg +80 -0
- package/docs/schema/generated/document_node_taxonomy_levels.md +91 -0
- package/docs/schema/generated/document_node_taxonomy_levels.svg +52 -0
- package/docs/schema/generated/document_nodes.md +120 -0
- package/docs/schema/generated/document_nodes.svg +98 -0
- package/docs/schema/generated/document_revisions.md +107 -0
- package/docs/schema/generated/document_revisions.svg +116 -0
- package/docs/schema/generated/document_versions.md +126 -0
- package/docs/schema/generated/document_versions.svg +88 -0
- package/docs/schema/generated/schema.json +2534 -0
- package/docs/schema/generated/schema.mmd +170 -0
- package/docs/schema/generated/schema.svg +331 -0
- package/docs/schema/migrations.md +40 -0
- package/docs/usage.md +332 -0
- package/docs/validation-rules.md +69 -0
- package/package.json +30 -0
- package/src/database/migrations/0001_document_base.sql +753 -0
|
@@ -0,0 +1,2534 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "agentic-domain-document",
|
|
3
|
+
"desc": "Agentic Platform document domain database.",
|
|
4
|
+
"tables": [
|
|
5
|
+
{
|
|
6
|
+
"name": "document_code_groups",
|
|
7
|
+
"type": "table",
|
|
8
|
+
"comment": "코드 그룹을 정의한다.",
|
|
9
|
+
"columns": [
|
|
10
|
+
{
|
|
11
|
+
"name": "code_group_code",
|
|
12
|
+
"type": "VARCHAR(64)",
|
|
13
|
+
"nullable": true,
|
|
14
|
+
"comment": "코드 그룹 식별자"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"name": "code_group_name",
|
|
18
|
+
"type": "VARCHAR(128)",
|
|
19
|
+
"nullable": false,
|
|
20
|
+
"comment": "코드 그룹 한글명"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"name": "description",
|
|
24
|
+
"type": "TEXT",
|
|
25
|
+
"nullable": true,
|
|
26
|
+
"comment": "코드 그룹 설명"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"name": "sort_order",
|
|
30
|
+
"type": "INTEGER",
|
|
31
|
+
"nullable": false,
|
|
32
|
+
"default": "0",
|
|
33
|
+
"comment": "표시 정렬 순서"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"name": "is_active",
|
|
37
|
+
"type": "INTEGER",
|
|
38
|
+
"nullable": false,
|
|
39
|
+
"default": "1",
|
|
40
|
+
"comment": "활성 여부"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"name": "created_at",
|
|
44
|
+
"type": "DATETIME",
|
|
45
|
+
"nullable": false,
|
|
46
|
+
"default": "CURRENT_TIMESTAMP",
|
|
47
|
+
"comment": "생성 시각"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"name": "updated_at",
|
|
51
|
+
"type": "DATETIME",
|
|
52
|
+
"nullable": false,
|
|
53
|
+
"default": "CURRENT_TIMESTAMP",
|
|
54
|
+
"comment": "수정 시각"
|
|
55
|
+
}
|
|
56
|
+
],
|
|
57
|
+
"indexes": [
|
|
58
|
+
{
|
|
59
|
+
"name": "sqlite_autoindex_document_code_groups_1",
|
|
60
|
+
"def": "PRIMARY KEY (code_group_code)",
|
|
61
|
+
"table": "document_code_groups",
|
|
62
|
+
"columns": [
|
|
63
|
+
"code_group_code"
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
],
|
|
67
|
+
"constraints": [
|
|
68
|
+
{
|
|
69
|
+
"name": "code_group_code",
|
|
70
|
+
"type": "PRIMARY KEY",
|
|
71
|
+
"def": "PRIMARY KEY (code_group_code)",
|
|
72
|
+
"table": "document_code_groups",
|
|
73
|
+
"columns": [
|
|
74
|
+
"code_group_code"
|
|
75
|
+
]
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"name": "sqlite_autoindex_document_code_groups_1",
|
|
79
|
+
"type": "PRIMARY KEY",
|
|
80
|
+
"def": "PRIMARY KEY (code_group_code)",
|
|
81
|
+
"table": "document_code_groups",
|
|
82
|
+
"columns": [
|
|
83
|
+
"code_group_code"
|
|
84
|
+
]
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"name": "-",
|
|
88
|
+
"type": "CHECK",
|
|
89
|
+
"def": "CHECK (is_active IN (0, 1))",
|
|
90
|
+
"table": "document_code_groups",
|
|
91
|
+
"columns": [
|
|
92
|
+
"is_active"
|
|
93
|
+
]
|
|
94
|
+
}
|
|
95
|
+
],
|
|
96
|
+
"def": "CREATE TABLE document_code_groups (\n -- 코드 그룹 식별자\n code_group_code VARCHAR(64) PRIMARY KEY,\n\n -- 코드 그룹 한글명\n code_group_name VARCHAR(128) NOT NULL,\n\n -- 코드 그룹 설명\n description TEXT,\n\n -- 표시 정렬 순서\n sort_order INTEGER NOT NULL DEFAULT 0,\n\n -- 활성 여부. 1은 활성, 0은 비활성\n is_active INTEGER NOT NULL DEFAULT 1\n CHECK (is_active IN (0, 1)),\n\n -- 생성 시각\n created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,\n\n -- 수정 시각\n updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP\n)"
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"name": "document_codes",
|
|
100
|
+
"type": "table",
|
|
101
|
+
"comment": "코드 그룹별 코드 값을 정의한다.",
|
|
102
|
+
"columns": [
|
|
103
|
+
{
|
|
104
|
+
"name": "code_group_code",
|
|
105
|
+
"type": "VARCHAR(64)",
|
|
106
|
+
"nullable": false,
|
|
107
|
+
"comment": "코드 그룹 식별자"
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"name": "code",
|
|
111
|
+
"type": "VARCHAR(128)",
|
|
112
|
+
"nullable": false,
|
|
113
|
+
"comment": "코드 값"
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
"name": "code_name",
|
|
117
|
+
"type": "VARCHAR(128)",
|
|
118
|
+
"nullable": false,
|
|
119
|
+
"comment": "코드 한글명"
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
"name": "description",
|
|
123
|
+
"type": "TEXT",
|
|
124
|
+
"nullable": true,
|
|
125
|
+
"comment": "코드 설명"
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
"name": "sort_order",
|
|
129
|
+
"type": "INTEGER",
|
|
130
|
+
"nullable": false,
|
|
131
|
+
"default": "0",
|
|
132
|
+
"comment": "표시 정렬 순서"
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
"name": "is_active",
|
|
136
|
+
"type": "INTEGER",
|
|
137
|
+
"nullable": false,
|
|
138
|
+
"default": "1",
|
|
139
|
+
"comment": "활성 여부"
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
"name": "metadata_json",
|
|
143
|
+
"type": "JSON",
|
|
144
|
+
"nullable": true,
|
|
145
|
+
"comment": "확장 메타데이터"
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
"name": "created_at",
|
|
149
|
+
"type": "DATETIME",
|
|
150
|
+
"nullable": false,
|
|
151
|
+
"default": "CURRENT_TIMESTAMP",
|
|
152
|
+
"comment": "생성 시각"
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
"name": "updated_at",
|
|
156
|
+
"type": "DATETIME",
|
|
157
|
+
"nullable": false,
|
|
158
|
+
"default": "CURRENT_TIMESTAMP",
|
|
159
|
+
"comment": "수정 시각"
|
|
160
|
+
}
|
|
161
|
+
],
|
|
162
|
+
"indexes": [
|
|
163
|
+
{
|
|
164
|
+
"name": "sqlite_autoindex_document_codes_1",
|
|
165
|
+
"def": "PRIMARY KEY (code_group_code, code)",
|
|
166
|
+
"table": "document_codes",
|
|
167
|
+
"columns": [
|
|
168
|
+
"code_group_code",
|
|
169
|
+
"code"
|
|
170
|
+
]
|
|
171
|
+
}
|
|
172
|
+
],
|
|
173
|
+
"constraints": [
|
|
174
|
+
{
|
|
175
|
+
"name": "code_group_code",
|
|
176
|
+
"type": "PRIMARY KEY",
|
|
177
|
+
"def": "PRIMARY KEY (code_group_code)",
|
|
178
|
+
"table": "document_codes",
|
|
179
|
+
"columns": [
|
|
180
|
+
"code_group_code"
|
|
181
|
+
]
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
"name": "code",
|
|
185
|
+
"type": "PRIMARY KEY",
|
|
186
|
+
"def": "PRIMARY KEY (code)",
|
|
187
|
+
"table": "document_codes",
|
|
188
|
+
"columns": [
|
|
189
|
+
"code"
|
|
190
|
+
]
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
"name": "- (Foreign key ID: 0)",
|
|
194
|
+
"type": "FOREIGN KEY",
|
|
195
|
+
"def": "FOREIGN KEY (code_group_code) REFERENCES document_code_groups (code_group_code) ON UPDATE NO ACTION ON DELETE CASCADE MATCH NONE",
|
|
196
|
+
"table": "document_codes",
|
|
197
|
+
"referenced_table": "document_code_groups",
|
|
198
|
+
"columns": [
|
|
199
|
+
"code_group_code"
|
|
200
|
+
],
|
|
201
|
+
"referenced_columns": [
|
|
202
|
+
"code_group_code"
|
|
203
|
+
]
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
"name": "sqlite_autoindex_document_codes_1",
|
|
207
|
+
"type": "PRIMARY KEY",
|
|
208
|
+
"def": "PRIMARY KEY (code_group_code, code)",
|
|
209
|
+
"table": "document_codes",
|
|
210
|
+
"columns": [
|
|
211
|
+
"code_group_code",
|
|
212
|
+
"code"
|
|
213
|
+
]
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
"name": "-",
|
|
217
|
+
"type": "CHECK",
|
|
218
|
+
"def": "CHECK (is_active IN (0, 1))",
|
|
219
|
+
"table": "document_codes",
|
|
220
|
+
"columns": [
|
|
221
|
+
"is_active"
|
|
222
|
+
]
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
"name": "-",
|
|
226
|
+
"type": "CHECK",
|
|
227
|
+
"def": "CHECK (metadata_json IS NULL OR json_valid(metadata_json))",
|
|
228
|
+
"table": "document_codes",
|
|
229
|
+
"columns": [
|
|
230
|
+
"metadata_json"
|
|
231
|
+
]
|
|
232
|
+
}
|
|
233
|
+
],
|
|
234
|
+
"def": "CREATE TABLE document_codes (\n -- 코드 그룹 식별자\n code_group_code VARCHAR(64) NOT NULL,\n\n -- 코드 값. lower_snake_case를 사용한다.\n code VARCHAR(128) NOT NULL,\n\n -- 코드 한글명\n code_name VARCHAR(128) NOT NULL,\n\n -- 코드 설명\n description TEXT,\n\n -- 표시 정렬 순서\n sort_order INTEGER NOT NULL DEFAULT 0,\n\n -- 활성 여부. 1은 활성, 0은 비활성\n is_active INTEGER NOT NULL DEFAULT 1\n CHECK (is_active IN (0, 1)),\n\n -- 확장 메타데이터\n metadata_json JSON\n CHECK (metadata_json IS NULL OR json_valid(metadata_json)),\n\n -- 생성 시각\n created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,\n\n -- 수정 시각\n updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,\n\n PRIMARY KEY (code_group_code, code),\n\n FOREIGN KEY (code_group_code)\n REFERENCES document_code_groups (code_group_code)\n ON DELETE CASCADE\n)"
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
"name": "document_node_taxonomies",
|
|
238
|
+
"type": "table",
|
|
239
|
+
"comment": "문서 유형별 node level 해석 정책을 정의한다.",
|
|
240
|
+
"columns": [
|
|
241
|
+
{
|
|
242
|
+
"name": "taxonomy_id",
|
|
243
|
+
"type": "CHAR(36)",
|
|
244
|
+
"nullable": true,
|
|
245
|
+
"comment": "taxonomy 식별자"
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
"name": "taxonomy_code",
|
|
249
|
+
"type": "VARCHAR(128)",
|
|
250
|
+
"nullable": false,
|
|
251
|
+
"comment": "taxonomy 코드"
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
"name": "taxonomy_name",
|
|
255
|
+
"type": "VARCHAR(128)",
|
|
256
|
+
"nullable": false,
|
|
257
|
+
"comment": "taxonomy 이름"
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
"name": "document_type_code",
|
|
261
|
+
"type": "VARCHAR(128)",
|
|
262
|
+
"nullable": false,
|
|
263
|
+
"comment": "문서 유형 코드"
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
"name": "default_toc_level_limit",
|
|
267
|
+
"type": "INTEGER",
|
|
268
|
+
"nullable": false,
|
|
269
|
+
"default": "3",
|
|
270
|
+
"comment": "기본 TOC 포함 level"
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
"name": "description",
|
|
274
|
+
"type": "TEXT",
|
|
275
|
+
"nullable": true,
|
|
276
|
+
"comment": "설명"
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
"name": "is_active",
|
|
280
|
+
"type": "INTEGER",
|
|
281
|
+
"nullable": false,
|
|
282
|
+
"default": "1",
|
|
283
|
+
"comment": "활성 여부"
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
"name": "created_at",
|
|
287
|
+
"type": "DATETIME",
|
|
288
|
+
"nullable": false,
|
|
289
|
+
"default": "CURRENT_TIMESTAMP",
|
|
290
|
+
"comment": "생성 시각"
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
"name": "updated_at",
|
|
294
|
+
"type": "DATETIME",
|
|
295
|
+
"nullable": false,
|
|
296
|
+
"default": "CURRENT_TIMESTAMP",
|
|
297
|
+
"comment": "수정 시각"
|
|
298
|
+
}
|
|
299
|
+
],
|
|
300
|
+
"indexes": [
|
|
301
|
+
{
|
|
302
|
+
"name": "sqlite_autoindex_document_node_taxonomies_2",
|
|
303
|
+
"def": "UNIQUE (taxonomy_code)",
|
|
304
|
+
"table": "document_node_taxonomies",
|
|
305
|
+
"columns": [
|
|
306
|
+
"taxonomy_code"
|
|
307
|
+
]
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
"name": "sqlite_autoindex_document_node_taxonomies_1",
|
|
311
|
+
"def": "PRIMARY KEY (taxonomy_id)",
|
|
312
|
+
"table": "document_node_taxonomies",
|
|
313
|
+
"columns": [
|
|
314
|
+
"taxonomy_id"
|
|
315
|
+
]
|
|
316
|
+
}
|
|
317
|
+
],
|
|
318
|
+
"constraints": [
|
|
319
|
+
{
|
|
320
|
+
"name": "taxonomy_id",
|
|
321
|
+
"type": "PRIMARY KEY",
|
|
322
|
+
"def": "PRIMARY KEY (taxonomy_id)",
|
|
323
|
+
"table": "document_node_taxonomies",
|
|
324
|
+
"columns": [
|
|
325
|
+
"taxonomy_id"
|
|
326
|
+
]
|
|
327
|
+
},
|
|
328
|
+
{
|
|
329
|
+
"name": "sqlite_autoindex_document_node_taxonomies_2",
|
|
330
|
+
"type": "UNIQUE",
|
|
331
|
+
"def": "UNIQUE (taxonomy_code)",
|
|
332
|
+
"table": "document_node_taxonomies",
|
|
333
|
+
"columns": [
|
|
334
|
+
"taxonomy_code"
|
|
335
|
+
]
|
|
336
|
+
},
|
|
337
|
+
{
|
|
338
|
+
"name": "sqlite_autoindex_document_node_taxonomies_1",
|
|
339
|
+
"type": "PRIMARY KEY",
|
|
340
|
+
"def": "PRIMARY KEY (taxonomy_id)",
|
|
341
|
+
"table": "document_node_taxonomies",
|
|
342
|
+
"columns": [
|
|
343
|
+
"taxonomy_id"
|
|
344
|
+
]
|
|
345
|
+
},
|
|
346
|
+
{
|
|
347
|
+
"name": "-",
|
|
348
|
+
"type": "CHECK",
|
|
349
|
+
"def": "CHECK (length(taxonomy_id) = 36)",
|
|
350
|
+
"table": "document_node_taxonomies",
|
|
351
|
+
"columns": [
|
|
352
|
+
"taxonomy_id"
|
|
353
|
+
]
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
"name": "-",
|
|
357
|
+
"type": "CHECK",
|
|
358
|
+
"def": "CHECK (default_toc_level_limit \u003e= 1)",
|
|
359
|
+
"table": "document_node_taxonomies",
|
|
360
|
+
"columns": [
|
|
361
|
+
"default_toc_level_limit"
|
|
362
|
+
]
|
|
363
|
+
},
|
|
364
|
+
{
|
|
365
|
+
"name": "-",
|
|
366
|
+
"type": "CHECK",
|
|
367
|
+
"def": "CHECK (is_active IN (0, 1))",
|
|
368
|
+
"table": "document_node_taxonomies",
|
|
369
|
+
"columns": [
|
|
370
|
+
"is_active"
|
|
371
|
+
]
|
|
372
|
+
}
|
|
373
|
+
],
|
|
374
|
+
"def": "CREATE TABLE document_node_taxonomies (\n -- taxonomy 식별자\n taxonomy_id CHAR(36) PRIMARY KEY\n CHECK (length(taxonomy_id) = 36),\n\n -- taxonomy 코드\n taxonomy_code VARCHAR(128) NOT NULL UNIQUE,\n\n -- taxonomy 이름\n taxonomy_name VARCHAR(128) NOT NULL,\n\n -- 문서 유형 코드\n document_type_code VARCHAR(128) NOT NULL,\n\n -- 기본 TOC 포함 level\n default_toc_level_limit INTEGER NOT NULL DEFAULT 3\n CHECK (default_toc_level_limit \u003e= 1),\n\n -- 설명\n description TEXT,\n\n -- 활성 여부\n is_active INTEGER NOT NULL DEFAULT 1\n CHECK (is_active IN (0, 1)),\n\n -- 생성 시각\n created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,\n\n -- 수정 시각\n updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP\n)"
|
|
375
|
+
},
|
|
376
|
+
{
|
|
377
|
+
"name": "document_node_taxonomy_levels",
|
|
378
|
+
"type": "table",
|
|
379
|
+
"comment": "taxonomy별 node level 라벨, 번호 정책, counter scope를 정의한다.",
|
|
380
|
+
"columns": [
|
|
381
|
+
{
|
|
382
|
+
"name": "taxonomy_level_id",
|
|
383
|
+
"type": "CHAR(36)",
|
|
384
|
+
"nullable": true,
|
|
385
|
+
"comment": "taxonomy level 식별자"
|
|
386
|
+
},
|
|
387
|
+
{
|
|
388
|
+
"name": "taxonomy_id",
|
|
389
|
+
"type": "CHAR(36)",
|
|
390
|
+
"nullable": false,
|
|
391
|
+
"comment": "taxonomy 식별자"
|
|
392
|
+
},
|
|
393
|
+
{
|
|
394
|
+
"name": "node_level",
|
|
395
|
+
"type": "INTEGER",
|
|
396
|
+
"nullable": false,
|
|
397
|
+
"comment": "node level"
|
|
398
|
+
},
|
|
399
|
+
{
|
|
400
|
+
"name": "node_label_code",
|
|
401
|
+
"type": "VARCHAR(128)",
|
|
402
|
+
"nullable": false,
|
|
403
|
+
"comment": "node label 코드"
|
|
404
|
+
},
|
|
405
|
+
{
|
|
406
|
+
"name": "numbering_policy_code",
|
|
407
|
+
"type": "VARCHAR(64)",
|
|
408
|
+
"nullable": false,
|
|
409
|
+
"comment": "번호 정책 코드"
|
|
410
|
+
},
|
|
411
|
+
{
|
|
412
|
+
"name": "counter_scope_code",
|
|
413
|
+
"type": "VARCHAR(64)",
|
|
414
|
+
"nullable": false,
|
|
415
|
+
"comment": "번호 카운터 범위 코드"
|
|
416
|
+
},
|
|
417
|
+
{
|
|
418
|
+
"name": "sort_order",
|
|
419
|
+
"type": "INTEGER",
|
|
420
|
+
"nullable": false,
|
|
421
|
+
"default": "0",
|
|
422
|
+
"comment": "표시 정렬 순서"
|
|
423
|
+
},
|
|
424
|
+
{
|
|
425
|
+
"name": "created_at",
|
|
426
|
+
"type": "DATETIME",
|
|
427
|
+
"nullable": false,
|
|
428
|
+
"default": "CURRENT_TIMESTAMP",
|
|
429
|
+
"comment": "생성 시각"
|
|
430
|
+
},
|
|
431
|
+
{
|
|
432
|
+
"name": "updated_at",
|
|
433
|
+
"type": "DATETIME",
|
|
434
|
+
"nullable": false,
|
|
435
|
+
"default": "CURRENT_TIMESTAMP",
|
|
436
|
+
"comment": "수정 시각"
|
|
437
|
+
}
|
|
438
|
+
],
|
|
439
|
+
"indexes": [
|
|
440
|
+
{
|
|
441
|
+
"name": "sqlite_autoindex_document_node_taxonomy_levels_2",
|
|
442
|
+
"def": "UNIQUE (taxonomy_id, node_level)",
|
|
443
|
+
"table": "document_node_taxonomy_levels",
|
|
444
|
+
"columns": [
|
|
445
|
+
"taxonomy_id",
|
|
446
|
+
"node_level"
|
|
447
|
+
]
|
|
448
|
+
},
|
|
449
|
+
{
|
|
450
|
+
"name": "sqlite_autoindex_document_node_taxonomy_levels_1",
|
|
451
|
+
"def": "PRIMARY KEY (taxonomy_level_id)",
|
|
452
|
+
"table": "document_node_taxonomy_levels",
|
|
453
|
+
"columns": [
|
|
454
|
+
"taxonomy_level_id"
|
|
455
|
+
]
|
|
456
|
+
}
|
|
457
|
+
],
|
|
458
|
+
"constraints": [
|
|
459
|
+
{
|
|
460
|
+
"name": "taxonomy_level_id",
|
|
461
|
+
"type": "PRIMARY KEY",
|
|
462
|
+
"def": "PRIMARY KEY (taxonomy_level_id)",
|
|
463
|
+
"table": "document_node_taxonomy_levels",
|
|
464
|
+
"columns": [
|
|
465
|
+
"taxonomy_level_id"
|
|
466
|
+
]
|
|
467
|
+
},
|
|
468
|
+
{
|
|
469
|
+
"name": "- (Foreign key ID: 0)",
|
|
470
|
+
"type": "FOREIGN KEY",
|
|
471
|
+
"def": "FOREIGN KEY (taxonomy_id) REFERENCES document_node_taxonomies (taxonomy_id) ON UPDATE NO ACTION ON DELETE CASCADE MATCH NONE",
|
|
472
|
+
"table": "document_node_taxonomy_levels",
|
|
473
|
+
"referenced_table": "document_node_taxonomies",
|
|
474
|
+
"columns": [
|
|
475
|
+
"taxonomy_id"
|
|
476
|
+
],
|
|
477
|
+
"referenced_columns": [
|
|
478
|
+
"taxonomy_id"
|
|
479
|
+
]
|
|
480
|
+
},
|
|
481
|
+
{
|
|
482
|
+
"name": "sqlite_autoindex_document_node_taxonomy_levels_2",
|
|
483
|
+
"type": "UNIQUE",
|
|
484
|
+
"def": "UNIQUE (taxonomy_id, node_level)",
|
|
485
|
+
"table": "document_node_taxonomy_levels",
|
|
486
|
+
"columns": [
|
|
487
|
+
"taxonomy_id",
|
|
488
|
+
"node_level"
|
|
489
|
+
]
|
|
490
|
+
},
|
|
491
|
+
{
|
|
492
|
+
"name": "sqlite_autoindex_document_node_taxonomy_levels_1",
|
|
493
|
+
"type": "PRIMARY KEY",
|
|
494
|
+
"def": "PRIMARY KEY (taxonomy_level_id)",
|
|
495
|
+
"table": "document_node_taxonomy_levels",
|
|
496
|
+
"columns": [
|
|
497
|
+
"taxonomy_level_id"
|
|
498
|
+
]
|
|
499
|
+
},
|
|
500
|
+
{
|
|
501
|
+
"name": "-",
|
|
502
|
+
"type": "CHECK",
|
|
503
|
+
"def": "CHECK (length(taxonomy_level_id) = 36)",
|
|
504
|
+
"table": "document_node_taxonomy_levels",
|
|
505
|
+
"columns": [
|
|
506
|
+
"taxonomy_level_id"
|
|
507
|
+
]
|
|
508
|
+
},
|
|
509
|
+
{
|
|
510
|
+
"name": "-",
|
|
511
|
+
"type": "CHECK",
|
|
512
|
+
"def": "CHECK (length(taxonomy_id) = 36)",
|
|
513
|
+
"table": "document_node_taxonomy_levels",
|
|
514
|
+
"columns": [
|
|
515
|
+
"taxonomy_id"
|
|
516
|
+
]
|
|
517
|
+
},
|
|
518
|
+
{
|
|
519
|
+
"name": "-",
|
|
520
|
+
"type": "CHECK",
|
|
521
|
+
"def": "CHECK (node_level \u003e= 1)",
|
|
522
|
+
"table": "document_node_taxonomy_levels",
|
|
523
|
+
"columns": [
|
|
524
|
+
"node_level"
|
|
525
|
+
]
|
|
526
|
+
}
|
|
527
|
+
],
|
|
528
|
+
"def": "CREATE TABLE document_node_taxonomy_levels (\n -- taxonomy level 식별자\n taxonomy_level_id CHAR(36) PRIMARY KEY\n CHECK (length(taxonomy_level_id) = 36),\n\n -- taxonomy 식별자\n taxonomy_id CHAR(36) NOT NULL\n CHECK (length(taxonomy_id) = 36),\n\n -- node level\n node_level INTEGER NOT NULL\n CHECK (node_level \u003e= 1),\n\n -- node label 코드\n node_label_code VARCHAR(128) NOT NULL,\n\n -- 번호 정책 코드\n numbering_policy_code VARCHAR(64) NOT NULL,\n\n -- 번호 카운터 범위 코드\n counter_scope_code VARCHAR(64) NOT NULL,\n\n -- 표시 정렬 순서\n sort_order INTEGER NOT NULL DEFAULT 0,\n\n -- 생성 시각\n created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,\n\n -- 수정 시각\n updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,\n\n FOREIGN KEY (taxonomy_id)\n REFERENCES document_node_taxonomies (taxonomy_id)\n ON DELETE CASCADE,\n\n UNIQUE (taxonomy_id, node_level)\n)"
|
|
529
|
+
},
|
|
530
|
+
{
|
|
531
|
+
"name": "document_documents",
|
|
532
|
+
"type": "table",
|
|
533
|
+
"comment": "문서 단위 메타데이터, 작성자, taxonomy, 상태를 관리한다.",
|
|
534
|
+
"columns": [
|
|
535
|
+
{
|
|
536
|
+
"name": "document_id",
|
|
537
|
+
"type": "CHAR(36)",
|
|
538
|
+
"nullable": true,
|
|
539
|
+
"comment": "문서 식별자"
|
|
540
|
+
},
|
|
541
|
+
{
|
|
542
|
+
"name": "document_type_code",
|
|
543
|
+
"type": "VARCHAR(128)",
|
|
544
|
+
"nullable": false,
|
|
545
|
+
"comment": "문서 유형 코드"
|
|
546
|
+
},
|
|
547
|
+
{
|
|
548
|
+
"name": "taxonomy_id",
|
|
549
|
+
"type": "CHAR(36)",
|
|
550
|
+
"nullable": false,
|
|
551
|
+
"comment": "적용 taxonomy 식별자"
|
|
552
|
+
},
|
|
553
|
+
{
|
|
554
|
+
"name": "title",
|
|
555
|
+
"type": "VARCHAR(512)",
|
|
556
|
+
"nullable": false,
|
|
557
|
+
"comment": "문서 제목"
|
|
558
|
+
},
|
|
559
|
+
{
|
|
560
|
+
"name": "source_document_id",
|
|
561
|
+
"type": "CHAR(36)",
|
|
562
|
+
"nullable": true,
|
|
563
|
+
"comment": "파생 원본 문서 식별자"
|
|
564
|
+
},
|
|
565
|
+
{
|
|
566
|
+
"name": "version_label",
|
|
567
|
+
"type": "VARCHAR(64)",
|
|
568
|
+
"nullable": true,
|
|
569
|
+
"comment": "표시 버전"
|
|
570
|
+
},
|
|
571
|
+
{
|
|
572
|
+
"name": "author_type_code",
|
|
573
|
+
"type": "VARCHAR(32)",
|
|
574
|
+
"nullable": false,
|
|
575
|
+
"default": "'user'",
|
|
576
|
+
"comment": "작성자 유형"
|
|
577
|
+
},
|
|
578
|
+
{
|
|
579
|
+
"name": "author_id",
|
|
580
|
+
"type": "VARCHAR(128)",
|
|
581
|
+
"nullable": true,
|
|
582
|
+
"comment": "작성자 식별자"
|
|
583
|
+
},
|
|
584
|
+
{
|
|
585
|
+
"name": "author_name",
|
|
586
|
+
"type": "VARCHAR(128)",
|
|
587
|
+
"nullable": true,
|
|
588
|
+
"comment": "작성자 표시명"
|
|
589
|
+
},
|
|
590
|
+
{
|
|
591
|
+
"name": "status_code",
|
|
592
|
+
"type": "VARCHAR(32)",
|
|
593
|
+
"nullable": false,
|
|
594
|
+
"default": "'draft'",
|
|
595
|
+
"comment": "문서 상태"
|
|
596
|
+
},
|
|
597
|
+
{
|
|
598
|
+
"name": "toc_level_limit",
|
|
599
|
+
"type": "INTEGER",
|
|
600
|
+
"nullable": false,
|
|
601
|
+
"default": "3",
|
|
602
|
+
"comment": "TOC로 취급할 level limit"
|
|
603
|
+
},
|
|
604
|
+
{
|
|
605
|
+
"name": "published_at",
|
|
606
|
+
"type": "DATETIME",
|
|
607
|
+
"nullable": true,
|
|
608
|
+
"comment": "published 상태 전환 시각"
|
|
609
|
+
},
|
|
610
|
+
{
|
|
611
|
+
"name": "created_at",
|
|
612
|
+
"type": "DATETIME",
|
|
613
|
+
"nullable": false,
|
|
614
|
+
"default": "CURRENT_TIMESTAMP",
|
|
615
|
+
"comment": "생성 시각"
|
|
616
|
+
},
|
|
617
|
+
{
|
|
618
|
+
"name": "updated_at",
|
|
619
|
+
"type": "DATETIME",
|
|
620
|
+
"nullable": false,
|
|
621
|
+
"default": "CURRENT_TIMESTAMP",
|
|
622
|
+
"comment": "수정 시각"
|
|
623
|
+
},
|
|
624
|
+
{
|
|
625
|
+
"name": "metadata_json",
|
|
626
|
+
"type": "JSON",
|
|
627
|
+
"nullable": true,
|
|
628
|
+
"comment": "확장 메타데이터"
|
|
629
|
+
}
|
|
630
|
+
],
|
|
631
|
+
"indexes": [
|
|
632
|
+
{
|
|
633
|
+
"name": "idx_document_documents_source",
|
|
634
|
+
"def": "CREATE INDEX idx_document_documents_source\n ON document_documents (source_document_id)",
|
|
635
|
+
"table": "document_documents",
|
|
636
|
+
"columns": [
|
|
637
|
+
"source_document_id"
|
|
638
|
+
]
|
|
639
|
+
},
|
|
640
|
+
{
|
|
641
|
+
"name": "idx_document_documents_taxonomy",
|
|
642
|
+
"def": "CREATE INDEX idx_document_documents_taxonomy\n ON document_documents (taxonomy_id)",
|
|
643
|
+
"table": "document_documents",
|
|
644
|
+
"columns": [
|
|
645
|
+
"taxonomy_id"
|
|
646
|
+
]
|
|
647
|
+
},
|
|
648
|
+
{
|
|
649
|
+
"name": "idx_document_documents_type_status",
|
|
650
|
+
"def": "CREATE INDEX idx_document_documents_type_status\n ON document_documents (document_type_code, status_code)",
|
|
651
|
+
"table": "document_documents",
|
|
652
|
+
"columns": [
|
|
653
|
+
"document_type_code",
|
|
654
|
+
"status_code"
|
|
655
|
+
]
|
|
656
|
+
},
|
|
657
|
+
{
|
|
658
|
+
"name": "sqlite_autoindex_document_documents_1",
|
|
659
|
+
"def": "PRIMARY KEY (document_id)",
|
|
660
|
+
"table": "document_documents",
|
|
661
|
+
"columns": [
|
|
662
|
+
"document_id"
|
|
663
|
+
]
|
|
664
|
+
}
|
|
665
|
+
],
|
|
666
|
+
"constraints": [
|
|
667
|
+
{
|
|
668
|
+
"name": "document_id",
|
|
669
|
+
"type": "PRIMARY KEY",
|
|
670
|
+
"def": "PRIMARY KEY (document_id)",
|
|
671
|
+
"table": "document_documents",
|
|
672
|
+
"columns": [
|
|
673
|
+
"document_id"
|
|
674
|
+
]
|
|
675
|
+
},
|
|
676
|
+
{
|
|
677
|
+
"name": "- (Foreign key ID: 0)",
|
|
678
|
+
"type": "FOREIGN KEY",
|
|
679
|
+
"def": "FOREIGN KEY (source_document_id) REFERENCES document_documents (document_id) ON UPDATE NO ACTION ON DELETE SET NULL MATCH NONE",
|
|
680
|
+
"table": "document_documents",
|
|
681
|
+
"referenced_table": "document_documents",
|
|
682
|
+
"columns": [
|
|
683
|
+
"source_document_id"
|
|
684
|
+
],
|
|
685
|
+
"referenced_columns": [
|
|
686
|
+
"document_id"
|
|
687
|
+
]
|
|
688
|
+
},
|
|
689
|
+
{
|
|
690
|
+
"name": "- (Foreign key ID: 1)",
|
|
691
|
+
"type": "FOREIGN KEY",
|
|
692
|
+
"def": "FOREIGN KEY (taxonomy_id) REFERENCES document_node_taxonomies (taxonomy_id) ON UPDATE NO ACTION ON DELETE NO ACTION MATCH NONE",
|
|
693
|
+
"table": "document_documents",
|
|
694
|
+
"referenced_table": "document_node_taxonomies",
|
|
695
|
+
"columns": [
|
|
696
|
+
"taxonomy_id"
|
|
697
|
+
],
|
|
698
|
+
"referenced_columns": [
|
|
699
|
+
"taxonomy_id"
|
|
700
|
+
]
|
|
701
|
+
},
|
|
702
|
+
{
|
|
703
|
+
"name": "sqlite_autoindex_document_documents_1",
|
|
704
|
+
"type": "PRIMARY KEY",
|
|
705
|
+
"def": "PRIMARY KEY (document_id)",
|
|
706
|
+
"table": "document_documents",
|
|
707
|
+
"columns": [
|
|
708
|
+
"document_id"
|
|
709
|
+
]
|
|
710
|
+
},
|
|
711
|
+
{
|
|
712
|
+
"name": "-",
|
|
713
|
+
"type": "CHECK",
|
|
714
|
+
"def": "CHECK (length(document_id) = 36)",
|
|
715
|
+
"table": "document_documents",
|
|
716
|
+
"columns": [
|
|
717
|
+
"document_id"
|
|
718
|
+
]
|
|
719
|
+
},
|
|
720
|
+
{
|
|
721
|
+
"name": "-",
|
|
722
|
+
"type": "CHECK",
|
|
723
|
+
"def": "CHECK (length(taxonomy_id) = 36)",
|
|
724
|
+
"table": "document_documents",
|
|
725
|
+
"columns": [
|
|
726
|
+
"taxonomy_id"
|
|
727
|
+
]
|
|
728
|
+
},
|
|
729
|
+
{
|
|
730
|
+
"name": "-",
|
|
731
|
+
"type": "CHECK",
|
|
732
|
+
"def": "CHECK (source_document_id IS NULL OR length(source_document_id) = 36)",
|
|
733
|
+
"table": "document_documents",
|
|
734
|
+
"columns": [
|
|
735
|
+
"document_id",
|
|
736
|
+
"source_document_id"
|
|
737
|
+
]
|
|
738
|
+
},
|
|
739
|
+
{
|
|
740
|
+
"name": "-",
|
|
741
|
+
"type": "CHECK",
|
|
742
|
+
"def": "CHECK (author_type_code IN ('user', 'agent', 'system'))",
|
|
743
|
+
"table": "document_documents",
|
|
744
|
+
"columns": [
|
|
745
|
+
"author_type_code"
|
|
746
|
+
]
|
|
747
|
+
},
|
|
748
|
+
{
|
|
749
|
+
"name": "-",
|
|
750
|
+
"type": "CHECK",
|
|
751
|
+
"def": "CHECK (status_code IN ('draft', 'in_review', 'approved', 'published', 'archived'))",
|
|
752
|
+
"table": "document_documents",
|
|
753
|
+
"columns": [
|
|
754
|
+
"status_code"
|
|
755
|
+
]
|
|
756
|
+
},
|
|
757
|
+
{
|
|
758
|
+
"name": "-",
|
|
759
|
+
"type": "CHECK",
|
|
760
|
+
"def": "CHECK (toc_level_limit \u003e= 1)",
|
|
761
|
+
"table": "document_documents",
|
|
762
|
+
"columns": [
|
|
763
|
+
"toc_level_limit"
|
|
764
|
+
]
|
|
765
|
+
},
|
|
766
|
+
{
|
|
767
|
+
"name": "-",
|
|
768
|
+
"type": "CHECK",
|
|
769
|
+
"def": "CHECK (metadata_json IS NULL OR json_valid(metadata_json))",
|
|
770
|
+
"table": "document_documents",
|
|
771
|
+
"columns": [
|
|
772
|
+
"metadata_json"
|
|
773
|
+
]
|
|
774
|
+
}
|
|
775
|
+
],
|
|
776
|
+
"def": "CREATE TABLE document_documents (\n -- 문서 식별자\n document_id CHAR(36) PRIMARY KEY\n CHECK (length(document_id) = 36),\n\n -- 문서 유형 코드\n document_type_code VARCHAR(128) NOT NULL,\n\n -- 적용 taxonomy 식별자\n taxonomy_id CHAR(36) NOT NULL\n CHECK (length(taxonomy_id) = 36),\n\n -- 문서 제목\n title VARCHAR(512) NOT NULL,\n\n -- 파생 원본 문서 식별자\n source_document_id CHAR(36)\n CHECK (source_document_id IS NULL OR length(source_document_id) = 36),\n\n -- 표시 버전\n version_label VARCHAR(64),\n\n -- 작성자 유형\n author_type_code VARCHAR(32) NOT NULL DEFAULT 'user'\n CHECK (author_type_code IN ('user', 'agent', 'system')),\n\n -- 작성자 식별자\n author_id VARCHAR(128),\n\n -- 작성자 표시명\n author_name VARCHAR(128),\n\n -- 문서 상태\n status_code VARCHAR(32) NOT NULL DEFAULT 'draft'\n CHECK (status_code IN ('draft', 'in_review', 'approved', 'published', 'archived')),\n\n -- TOC로 취급할 level limit\n toc_level_limit INTEGER NOT NULL DEFAULT 3\n CHECK (toc_level_limit \u003e= 1),\n\n -- published 상태 전환 시각\n published_at DATETIME,\n\n -- 생성 시각\n created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,\n\n -- 수정 시각\n updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,\n\n -- 확장 메타데이터\n metadata_json JSON\n CHECK (metadata_json IS NULL OR json_valid(metadata_json)),\n\n FOREIGN KEY (taxonomy_id)\n REFERENCES document_node_taxonomies (taxonomy_id),\n\n FOREIGN KEY (source_document_id)\n REFERENCES document_documents (document_id)\n ON DELETE SET NULL\n)"
|
|
777
|
+
},
|
|
778
|
+
{
|
|
779
|
+
"name": "document_nodes",
|
|
780
|
+
"type": "table",
|
|
781
|
+
"comment": "문서의 계층 node tree를 관리한다.",
|
|
782
|
+
"columns": [
|
|
783
|
+
{
|
|
784
|
+
"name": "node_id",
|
|
785
|
+
"type": "CHAR(36)",
|
|
786
|
+
"nullable": true,
|
|
787
|
+
"comment": "노드 식별자"
|
|
788
|
+
},
|
|
789
|
+
{
|
|
790
|
+
"name": "document_id",
|
|
791
|
+
"type": "CHAR(36)",
|
|
792
|
+
"nullable": false,
|
|
793
|
+
"comment": "소속 문서 식별자"
|
|
794
|
+
},
|
|
795
|
+
{
|
|
796
|
+
"name": "parent_node_id",
|
|
797
|
+
"type": "CHAR(36)",
|
|
798
|
+
"nullable": true,
|
|
799
|
+
"comment": "상위 노드 식별자"
|
|
800
|
+
},
|
|
801
|
+
{
|
|
802
|
+
"name": "node_level",
|
|
803
|
+
"type": "INTEGER",
|
|
804
|
+
"nullable": false,
|
|
805
|
+
"comment": "node level"
|
|
806
|
+
},
|
|
807
|
+
{
|
|
808
|
+
"name": "node_role_code",
|
|
809
|
+
"type": "VARCHAR(64)",
|
|
810
|
+
"nullable": false,
|
|
811
|
+
"default": "'body'",
|
|
812
|
+
"comment": "노드 역할 코드"
|
|
813
|
+
},
|
|
814
|
+
{
|
|
815
|
+
"name": "title",
|
|
816
|
+
"type": "VARCHAR(512)",
|
|
817
|
+
"nullable": false,
|
|
818
|
+
"comment": "노드 제목"
|
|
819
|
+
},
|
|
820
|
+
{
|
|
821
|
+
"name": "toc_visibility",
|
|
822
|
+
"type": "VARCHAR(16)",
|
|
823
|
+
"nullable": false,
|
|
824
|
+
"default": "'inherit'",
|
|
825
|
+
"comment": "TOC 표시 정책"
|
|
826
|
+
},
|
|
827
|
+
{
|
|
828
|
+
"name": "numbering_policy_code",
|
|
829
|
+
"type": "VARCHAR(64)",
|
|
830
|
+
"nullable": false,
|
|
831
|
+
"default": "'inherit'",
|
|
832
|
+
"comment": "번호 정책 코드"
|
|
833
|
+
},
|
|
834
|
+
{
|
|
835
|
+
"name": "numbering_override",
|
|
836
|
+
"type": "VARCHAR(64)",
|
|
837
|
+
"nullable": true,
|
|
838
|
+
"comment": "수동 번호 override"
|
|
839
|
+
},
|
|
840
|
+
{
|
|
841
|
+
"name": "sort_order",
|
|
842
|
+
"type": "INTEGER",
|
|
843
|
+
"nullable": false,
|
|
844
|
+
"default": "0",
|
|
845
|
+
"comment": "형제 노드 내 정렬 순서"
|
|
846
|
+
},
|
|
847
|
+
{
|
|
848
|
+
"name": "created_at",
|
|
849
|
+
"type": "DATETIME",
|
|
850
|
+
"nullable": false,
|
|
851
|
+
"default": "CURRENT_TIMESTAMP",
|
|
852
|
+
"comment": "생성 시각"
|
|
853
|
+
},
|
|
854
|
+
{
|
|
855
|
+
"name": "updated_at",
|
|
856
|
+
"type": "DATETIME",
|
|
857
|
+
"nullable": false,
|
|
858
|
+
"default": "CURRENT_TIMESTAMP",
|
|
859
|
+
"comment": "수정 시각"
|
|
860
|
+
},
|
|
861
|
+
{
|
|
862
|
+
"name": "metadata_json",
|
|
863
|
+
"type": "JSON",
|
|
864
|
+
"nullable": true,
|
|
865
|
+
"comment": "확장 메타데이터"
|
|
866
|
+
}
|
|
867
|
+
],
|
|
868
|
+
"indexes": [
|
|
869
|
+
{
|
|
870
|
+
"name": "idx_document_nodes_document_level_order",
|
|
871
|
+
"def": "CREATE INDEX idx_document_nodes_document_level_order\n ON document_nodes (document_id, node_level, sort_order)",
|
|
872
|
+
"table": "document_nodes",
|
|
873
|
+
"columns": [
|
|
874
|
+
"document_id",
|
|
875
|
+
"node_level",
|
|
876
|
+
"sort_order"
|
|
877
|
+
]
|
|
878
|
+
},
|
|
879
|
+
{
|
|
880
|
+
"name": "idx_document_nodes_document_parent_order",
|
|
881
|
+
"def": "CREATE INDEX idx_document_nodes_document_parent_order\n ON document_nodes (document_id, parent_node_id, sort_order)",
|
|
882
|
+
"table": "document_nodes",
|
|
883
|
+
"columns": [
|
|
884
|
+
"document_id",
|
|
885
|
+
"parent_node_id",
|
|
886
|
+
"sort_order"
|
|
887
|
+
]
|
|
888
|
+
},
|
|
889
|
+
{
|
|
890
|
+
"name": "sqlite_autoindex_document_nodes_2",
|
|
891
|
+
"def": "UNIQUE (document_id, parent_node_id, sort_order)",
|
|
892
|
+
"table": "document_nodes",
|
|
893
|
+
"columns": [
|
|
894
|
+
"document_id",
|
|
895
|
+
"parent_node_id",
|
|
896
|
+
"sort_order"
|
|
897
|
+
]
|
|
898
|
+
},
|
|
899
|
+
{
|
|
900
|
+
"name": "sqlite_autoindex_document_nodes_1",
|
|
901
|
+
"def": "PRIMARY KEY (node_id)",
|
|
902
|
+
"table": "document_nodes",
|
|
903
|
+
"columns": [
|
|
904
|
+
"node_id"
|
|
905
|
+
]
|
|
906
|
+
}
|
|
907
|
+
],
|
|
908
|
+
"constraints": [
|
|
909
|
+
{
|
|
910
|
+
"name": "node_id",
|
|
911
|
+
"type": "PRIMARY KEY",
|
|
912
|
+
"def": "PRIMARY KEY (node_id)",
|
|
913
|
+
"table": "document_nodes",
|
|
914
|
+
"columns": [
|
|
915
|
+
"node_id"
|
|
916
|
+
]
|
|
917
|
+
},
|
|
918
|
+
{
|
|
919
|
+
"name": "- (Foreign key ID: 0)",
|
|
920
|
+
"type": "FOREIGN KEY",
|
|
921
|
+
"def": "FOREIGN KEY (parent_node_id) REFERENCES document_nodes (node_id) ON UPDATE NO ACTION ON DELETE CASCADE MATCH NONE",
|
|
922
|
+
"table": "document_nodes",
|
|
923
|
+
"referenced_table": "document_nodes",
|
|
924
|
+
"columns": [
|
|
925
|
+
"parent_node_id"
|
|
926
|
+
],
|
|
927
|
+
"referenced_columns": [
|
|
928
|
+
"node_id"
|
|
929
|
+
]
|
|
930
|
+
},
|
|
931
|
+
{
|
|
932
|
+
"name": "- (Foreign key ID: 1)",
|
|
933
|
+
"type": "FOREIGN KEY",
|
|
934
|
+
"def": "FOREIGN KEY (document_id) REFERENCES document_documents (document_id) ON UPDATE NO ACTION ON DELETE CASCADE MATCH NONE",
|
|
935
|
+
"table": "document_nodes",
|
|
936
|
+
"referenced_table": "document_documents",
|
|
937
|
+
"columns": [
|
|
938
|
+
"document_id"
|
|
939
|
+
],
|
|
940
|
+
"referenced_columns": [
|
|
941
|
+
"document_id"
|
|
942
|
+
]
|
|
943
|
+
},
|
|
944
|
+
{
|
|
945
|
+
"name": "sqlite_autoindex_document_nodes_2",
|
|
946
|
+
"type": "UNIQUE",
|
|
947
|
+
"def": "UNIQUE (document_id, parent_node_id, sort_order)",
|
|
948
|
+
"table": "document_nodes",
|
|
949
|
+
"columns": [
|
|
950
|
+
"document_id",
|
|
951
|
+
"parent_node_id",
|
|
952
|
+
"sort_order"
|
|
953
|
+
]
|
|
954
|
+
},
|
|
955
|
+
{
|
|
956
|
+
"name": "sqlite_autoindex_document_nodes_1",
|
|
957
|
+
"type": "PRIMARY KEY",
|
|
958
|
+
"def": "PRIMARY KEY (node_id)",
|
|
959
|
+
"table": "document_nodes",
|
|
960
|
+
"columns": [
|
|
961
|
+
"node_id"
|
|
962
|
+
]
|
|
963
|
+
},
|
|
964
|
+
{
|
|
965
|
+
"name": "-",
|
|
966
|
+
"type": "CHECK",
|
|
967
|
+
"def": "CHECK (length(node_id) = 36)",
|
|
968
|
+
"table": "document_nodes",
|
|
969
|
+
"columns": [
|
|
970
|
+
"node_id"
|
|
971
|
+
]
|
|
972
|
+
},
|
|
973
|
+
{
|
|
974
|
+
"name": "-",
|
|
975
|
+
"type": "CHECK",
|
|
976
|
+
"def": "CHECK (length(document_id) = 36)",
|
|
977
|
+
"table": "document_nodes",
|
|
978
|
+
"columns": [
|
|
979
|
+
"document_id"
|
|
980
|
+
]
|
|
981
|
+
},
|
|
982
|
+
{
|
|
983
|
+
"name": "-",
|
|
984
|
+
"type": "CHECK",
|
|
985
|
+
"def": "CHECK (parent_node_id IS NULL OR length(parent_node_id) = 36)",
|
|
986
|
+
"table": "document_nodes",
|
|
987
|
+
"columns": [
|
|
988
|
+
"node_id",
|
|
989
|
+
"parent_node_id"
|
|
990
|
+
]
|
|
991
|
+
},
|
|
992
|
+
{
|
|
993
|
+
"name": "-",
|
|
994
|
+
"type": "CHECK",
|
|
995
|
+
"def": "CHECK (node_level \u003e= 1)",
|
|
996
|
+
"table": "document_nodes",
|
|
997
|
+
"columns": [
|
|
998
|
+
"node_level"
|
|
999
|
+
]
|
|
1000
|
+
},
|
|
1001
|
+
{
|
|
1002
|
+
"name": "-",
|
|
1003
|
+
"type": "CHECK",
|
|
1004
|
+
"def": "CHECK (toc_visibility IN ('inherit', 'include', 'exclude'))",
|
|
1005
|
+
"table": "document_nodes",
|
|
1006
|
+
"columns": [
|
|
1007
|
+
"toc_visibility"
|
|
1008
|
+
]
|
|
1009
|
+
},
|
|
1010
|
+
{
|
|
1011
|
+
"name": "-",
|
|
1012
|
+
"type": "CHECK",
|
|
1013
|
+
"def": "CHECK (metadata_json IS NULL OR json_valid(metadata_json))",
|
|
1014
|
+
"table": "document_nodes",
|
|
1015
|
+
"columns": [
|
|
1016
|
+
"metadata_json"
|
|
1017
|
+
]
|
|
1018
|
+
}
|
|
1019
|
+
],
|
|
1020
|
+
"def": "CREATE TABLE document_nodes (\n -- 노드 식별자\n node_id CHAR(36) PRIMARY KEY\n CHECK (length(node_id) = 36),\n\n -- 소속 문서 식별자\n document_id CHAR(36) NOT NULL\n CHECK (length(document_id) = 36),\n\n -- 상위 노드 식별자\n parent_node_id CHAR(36)\n CHECK (parent_node_id IS NULL OR length(parent_node_id) = 36),\n\n -- node level\n node_level INTEGER NOT NULL\n CHECK (node_level \u003e= 1),\n\n -- 노드 역할 코드\n node_role_code VARCHAR(64) NOT NULL DEFAULT 'body',\n\n -- 노드 제목\n title VARCHAR(512) NOT NULL,\n\n -- TOC 표시 정책\n toc_visibility VARCHAR(16) NOT NULL DEFAULT 'inherit'\n CHECK (toc_visibility IN ('inherit', 'include', 'exclude')),\n\n -- 번호 정책 코드\n numbering_policy_code VARCHAR(64) NOT NULL DEFAULT 'inherit',\n\n -- 수동 번호 override\n numbering_override VARCHAR(64),\n\n -- 형제 노드 내 정렬 순서\n sort_order INTEGER NOT NULL DEFAULT 0,\n\n -- 생성 시각\n created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,\n\n -- 수정 시각\n updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,\n\n -- 확장 메타데이터\n metadata_json JSON\n CHECK (metadata_json IS NULL OR json_valid(metadata_json)),\n\n FOREIGN KEY (document_id)\n REFERENCES document_documents (document_id)\n ON DELETE CASCADE,\n\n FOREIGN KEY (parent_node_id)\n REFERENCES document_nodes (node_id)\n ON DELETE CASCADE,\n\n UNIQUE (document_id, parent_node_id, sort_order)\n)"
|
|
1021
|
+
},
|
|
1022
|
+
{
|
|
1023
|
+
"name": "document_contents",
|
|
1024
|
+
"type": "table",
|
|
1025
|
+
"comment": "특정 document node에 붙는 block collection을 관리한다.",
|
|
1026
|
+
"columns": [
|
|
1027
|
+
{
|
|
1028
|
+
"name": "content_id",
|
|
1029
|
+
"type": "CHAR(36)",
|
|
1030
|
+
"nullable": true,
|
|
1031
|
+
"comment": "content 식별자"
|
|
1032
|
+
},
|
|
1033
|
+
{
|
|
1034
|
+
"name": "document_id",
|
|
1035
|
+
"type": "CHAR(36)",
|
|
1036
|
+
"nullable": false,
|
|
1037
|
+
"comment": "소속 문서 식별자"
|
|
1038
|
+
},
|
|
1039
|
+
{
|
|
1040
|
+
"name": "node_id",
|
|
1041
|
+
"type": "CHAR(36)",
|
|
1042
|
+
"nullable": false,
|
|
1043
|
+
"comment": "소속 노드 식별자"
|
|
1044
|
+
},
|
|
1045
|
+
{
|
|
1046
|
+
"name": "created_at",
|
|
1047
|
+
"type": "DATETIME",
|
|
1048
|
+
"nullable": false,
|
|
1049
|
+
"default": "CURRENT_TIMESTAMP",
|
|
1050
|
+
"comment": "생성 시각"
|
|
1051
|
+
},
|
|
1052
|
+
{
|
|
1053
|
+
"name": "updated_at",
|
|
1054
|
+
"type": "DATETIME",
|
|
1055
|
+
"nullable": false,
|
|
1056
|
+
"default": "CURRENT_TIMESTAMP",
|
|
1057
|
+
"comment": "수정 시각"
|
|
1058
|
+
},
|
|
1059
|
+
{
|
|
1060
|
+
"name": "metadata_json",
|
|
1061
|
+
"type": "JSON",
|
|
1062
|
+
"nullable": true,
|
|
1063
|
+
"comment": "확장 메타데이터"
|
|
1064
|
+
}
|
|
1065
|
+
],
|
|
1066
|
+
"indexes": [
|
|
1067
|
+
{
|
|
1068
|
+
"name": "idx_document_contents_document",
|
|
1069
|
+
"def": "CREATE INDEX idx_document_contents_document\n ON document_contents (document_id)",
|
|
1070
|
+
"table": "document_contents",
|
|
1071
|
+
"columns": [
|
|
1072
|
+
"document_id"
|
|
1073
|
+
]
|
|
1074
|
+
},
|
|
1075
|
+
{
|
|
1076
|
+
"name": "sqlite_autoindex_document_contents_2",
|
|
1077
|
+
"def": "UNIQUE (node_id)",
|
|
1078
|
+
"table": "document_contents",
|
|
1079
|
+
"columns": [
|
|
1080
|
+
"node_id"
|
|
1081
|
+
]
|
|
1082
|
+
},
|
|
1083
|
+
{
|
|
1084
|
+
"name": "sqlite_autoindex_document_contents_1",
|
|
1085
|
+
"def": "PRIMARY KEY (content_id)",
|
|
1086
|
+
"table": "document_contents",
|
|
1087
|
+
"columns": [
|
|
1088
|
+
"content_id"
|
|
1089
|
+
]
|
|
1090
|
+
}
|
|
1091
|
+
],
|
|
1092
|
+
"constraints": [
|
|
1093
|
+
{
|
|
1094
|
+
"name": "content_id",
|
|
1095
|
+
"type": "PRIMARY KEY",
|
|
1096
|
+
"def": "PRIMARY KEY (content_id)",
|
|
1097
|
+
"table": "document_contents",
|
|
1098
|
+
"columns": [
|
|
1099
|
+
"content_id"
|
|
1100
|
+
]
|
|
1101
|
+
},
|
|
1102
|
+
{
|
|
1103
|
+
"name": "- (Foreign key ID: 0)",
|
|
1104
|
+
"type": "FOREIGN KEY",
|
|
1105
|
+
"def": "FOREIGN KEY (node_id) REFERENCES document_nodes (node_id) ON UPDATE NO ACTION ON DELETE CASCADE MATCH NONE",
|
|
1106
|
+
"table": "document_contents",
|
|
1107
|
+
"referenced_table": "document_nodes",
|
|
1108
|
+
"columns": [
|
|
1109
|
+
"node_id"
|
|
1110
|
+
],
|
|
1111
|
+
"referenced_columns": [
|
|
1112
|
+
"node_id"
|
|
1113
|
+
]
|
|
1114
|
+
},
|
|
1115
|
+
{
|
|
1116
|
+
"name": "- (Foreign key ID: 1)",
|
|
1117
|
+
"type": "FOREIGN KEY",
|
|
1118
|
+
"def": "FOREIGN KEY (document_id) REFERENCES document_documents (document_id) ON UPDATE NO ACTION ON DELETE CASCADE MATCH NONE",
|
|
1119
|
+
"table": "document_contents",
|
|
1120
|
+
"referenced_table": "document_documents",
|
|
1121
|
+
"columns": [
|
|
1122
|
+
"document_id"
|
|
1123
|
+
],
|
|
1124
|
+
"referenced_columns": [
|
|
1125
|
+
"document_id"
|
|
1126
|
+
]
|
|
1127
|
+
},
|
|
1128
|
+
{
|
|
1129
|
+
"name": "sqlite_autoindex_document_contents_2",
|
|
1130
|
+
"type": "UNIQUE",
|
|
1131
|
+
"def": "UNIQUE (node_id)",
|
|
1132
|
+
"table": "document_contents",
|
|
1133
|
+
"columns": [
|
|
1134
|
+
"node_id"
|
|
1135
|
+
]
|
|
1136
|
+
},
|
|
1137
|
+
{
|
|
1138
|
+
"name": "sqlite_autoindex_document_contents_1",
|
|
1139
|
+
"type": "PRIMARY KEY",
|
|
1140
|
+
"def": "PRIMARY KEY (content_id)",
|
|
1141
|
+
"table": "document_contents",
|
|
1142
|
+
"columns": [
|
|
1143
|
+
"content_id"
|
|
1144
|
+
]
|
|
1145
|
+
},
|
|
1146
|
+
{
|
|
1147
|
+
"name": "-",
|
|
1148
|
+
"type": "CHECK",
|
|
1149
|
+
"def": "CHECK (length(content_id) = 36)",
|
|
1150
|
+
"table": "document_contents",
|
|
1151
|
+
"columns": [
|
|
1152
|
+
"content_id"
|
|
1153
|
+
]
|
|
1154
|
+
},
|
|
1155
|
+
{
|
|
1156
|
+
"name": "-",
|
|
1157
|
+
"type": "CHECK",
|
|
1158
|
+
"def": "CHECK (length(document_id) = 36)",
|
|
1159
|
+
"table": "document_contents",
|
|
1160
|
+
"columns": [
|
|
1161
|
+
"document_id"
|
|
1162
|
+
]
|
|
1163
|
+
},
|
|
1164
|
+
{
|
|
1165
|
+
"name": "-",
|
|
1166
|
+
"type": "CHECK",
|
|
1167
|
+
"def": "CHECK (length(node_id) = 36)",
|
|
1168
|
+
"table": "document_contents",
|
|
1169
|
+
"columns": [
|
|
1170
|
+
"node_id"
|
|
1171
|
+
]
|
|
1172
|
+
},
|
|
1173
|
+
{
|
|
1174
|
+
"name": "-",
|
|
1175
|
+
"type": "CHECK",
|
|
1176
|
+
"def": "CHECK (metadata_json IS NULL OR json_valid(metadata_json))",
|
|
1177
|
+
"table": "document_contents",
|
|
1178
|
+
"columns": [
|
|
1179
|
+
"metadata_json"
|
|
1180
|
+
]
|
|
1181
|
+
}
|
|
1182
|
+
],
|
|
1183
|
+
"def": "CREATE TABLE document_contents (\n -- content 식별자\n content_id CHAR(36) PRIMARY KEY\n CHECK (length(content_id) = 36),\n\n -- 소속 문서 식별자\n document_id CHAR(36) NOT NULL\n CHECK (length(document_id) = 36),\n\n -- 소속 노드 식별자\n node_id CHAR(36) NOT NULL\n CHECK (length(node_id) = 36),\n\n -- 생성 시각\n created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,\n\n -- 수정 시각\n updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,\n\n -- 확장 메타데이터\n metadata_json JSON\n CHECK (metadata_json IS NULL OR json_valid(metadata_json)),\n\n FOREIGN KEY (document_id)\n REFERENCES document_documents (document_id)\n ON DELETE CASCADE,\n\n FOREIGN KEY (node_id)\n REFERENCES document_nodes (node_id)\n ON DELETE CASCADE,\n\n UNIQUE (node_id)\n)"
|
|
1184
|
+
},
|
|
1185
|
+
{
|
|
1186
|
+
"name": "document_blocks",
|
|
1187
|
+
"type": "table",
|
|
1188
|
+
"comment": "문서 본문 표현 block을 관리한다.",
|
|
1189
|
+
"columns": [
|
|
1190
|
+
{
|
|
1191
|
+
"name": "block_id",
|
|
1192
|
+
"type": "CHAR(36)",
|
|
1193
|
+
"nullable": true,
|
|
1194
|
+
"comment": "block 식별자"
|
|
1195
|
+
},
|
|
1196
|
+
{
|
|
1197
|
+
"name": "content_id",
|
|
1198
|
+
"type": "CHAR(36)",
|
|
1199
|
+
"nullable": false,
|
|
1200
|
+
"comment": "소속 content 식별자"
|
|
1201
|
+
},
|
|
1202
|
+
{
|
|
1203
|
+
"name": "block_type_code",
|
|
1204
|
+
"type": "VARCHAR(32)",
|
|
1205
|
+
"nullable": false,
|
|
1206
|
+
"comment": "block 유형 코드"
|
|
1207
|
+
},
|
|
1208
|
+
{
|
|
1209
|
+
"name": "sort_order",
|
|
1210
|
+
"type": "INTEGER",
|
|
1211
|
+
"nullable": false,
|
|
1212
|
+
"default": "0",
|
|
1213
|
+
"comment": "content 안에서의 순서"
|
|
1214
|
+
},
|
|
1215
|
+
{
|
|
1216
|
+
"name": "content_text",
|
|
1217
|
+
"type": "TEXT",
|
|
1218
|
+
"nullable": true,
|
|
1219
|
+
"comment": "텍스트 중심 block 본문"
|
|
1220
|
+
},
|
|
1221
|
+
{
|
|
1222
|
+
"name": "content_json",
|
|
1223
|
+
"type": "JSON",
|
|
1224
|
+
"nullable": true,
|
|
1225
|
+
"comment": "구조형 block payload"
|
|
1226
|
+
},
|
|
1227
|
+
{
|
|
1228
|
+
"name": "created_at",
|
|
1229
|
+
"type": "DATETIME",
|
|
1230
|
+
"nullable": false,
|
|
1231
|
+
"default": "CURRENT_TIMESTAMP",
|
|
1232
|
+
"comment": "생성 시각"
|
|
1233
|
+
},
|
|
1234
|
+
{
|
|
1235
|
+
"name": "updated_at",
|
|
1236
|
+
"type": "DATETIME",
|
|
1237
|
+
"nullable": false,
|
|
1238
|
+
"default": "CURRENT_TIMESTAMP",
|
|
1239
|
+
"comment": "수정 시각"
|
|
1240
|
+
},
|
|
1241
|
+
{
|
|
1242
|
+
"name": "metadata_json",
|
|
1243
|
+
"type": "JSON",
|
|
1244
|
+
"nullable": true,
|
|
1245
|
+
"comment": "확장 메타데이터"
|
|
1246
|
+
}
|
|
1247
|
+
],
|
|
1248
|
+
"indexes": [
|
|
1249
|
+
{
|
|
1250
|
+
"name": "idx_document_blocks_content_order",
|
|
1251
|
+
"def": "CREATE INDEX idx_document_blocks_content_order\n ON document_blocks (content_id, sort_order)",
|
|
1252
|
+
"table": "document_blocks",
|
|
1253
|
+
"columns": [
|
|
1254
|
+
"content_id",
|
|
1255
|
+
"sort_order"
|
|
1256
|
+
]
|
|
1257
|
+
},
|
|
1258
|
+
{
|
|
1259
|
+
"name": "sqlite_autoindex_document_blocks_2",
|
|
1260
|
+
"def": "UNIQUE (content_id, sort_order)",
|
|
1261
|
+
"table": "document_blocks",
|
|
1262
|
+
"columns": [
|
|
1263
|
+
"content_id",
|
|
1264
|
+
"sort_order"
|
|
1265
|
+
]
|
|
1266
|
+
},
|
|
1267
|
+
{
|
|
1268
|
+
"name": "sqlite_autoindex_document_blocks_1",
|
|
1269
|
+
"def": "PRIMARY KEY (block_id)",
|
|
1270
|
+
"table": "document_blocks",
|
|
1271
|
+
"columns": [
|
|
1272
|
+
"block_id"
|
|
1273
|
+
]
|
|
1274
|
+
}
|
|
1275
|
+
],
|
|
1276
|
+
"constraints": [
|
|
1277
|
+
{
|
|
1278
|
+
"name": "block_id",
|
|
1279
|
+
"type": "PRIMARY KEY",
|
|
1280
|
+
"def": "PRIMARY KEY (block_id)",
|
|
1281
|
+
"table": "document_blocks",
|
|
1282
|
+
"columns": [
|
|
1283
|
+
"block_id"
|
|
1284
|
+
]
|
|
1285
|
+
},
|
|
1286
|
+
{
|
|
1287
|
+
"name": "- (Foreign key ID: 0)",
|
|
1288
|
+
"type": "FOREIGN KEY",
|
|
1289
|
+
"def": "FOREIGN KEY (content_id) REFERENCES document_contents (content_id) ON UPDATE NO ACTION ON DELETE CASCADE MATCH NONE",
|
|
1290
|
+
"table": "document_blocks",
|
|
1291
|
+
"referenced_table": "document_contents",
|
|
1292
|
+
"columns": [
|
|
1293
|
+
"content_id"
|
|
1294
|
+
],
|
|
1295
|
+
"referenced_columns": [
|
|
1296
|
+
"content_id"
|
|
1297
|
+
]
|
|
1298
|
+
},
|
|
1299
|
+
{
|
|
1300
|
+
"name": "sqlite_autoindex_document_blocks_2",
|
|
1301
|
+
"type": "UNIQUE",
|
|
1302
|
+
"def": "UNIQUE (content_id, sort_order)",
|
|
1303
|
+
"table": "document_blocks",
|
|
1304
|
+
"columns": [
|
|
1305
|
+
"content_id",
|
|
1306
|
+
"sort_order"
|
|
1307
|
+
]
|
|
1308
|
+
},
|
|
1309
|
+
{
|
|
1310
|
+
"name": "sqlite_autoindex_document_blocks_1",
|
|
1311
|
+
"type": "PRIMARY KEY",
|
|
1312
|
+
"def": "PRIMARY KEY (block_id)",
|
|
1313
|
+
"table": "document_blocks",
|
|
1314
|
+
"columns": [
|
|
1315
|
+
"block_id"
|
|
1316
|
+
]
|
|
1317
|
+
},
|
|
1318
|
+
{
|
|
1319
|
+
"name": "-",
|
|
1320
|
+
"type": "CHECK",
|
|
1321
|
+
"def": "CHECK (length(block_id) = 36)",
|
|
1322
|
+
"table": "document_blocks",
|
|
1323
|
+
"columns": [
|
|
1324
|
+
"block_id"
|
|
1325
|
+
]
|
|
1326
|
+
},
|
|
1327
|
+
{
|
|
1328
|
+
"name": "-",
|
|
1329
|
+
"type": "CHECK",
|
|
1330
|
+
"def": "CHECK (length(content_id) = 36)",
|
|
1331
|
+
"table": "document_blocks",
|
|
1332
|
+
"columns": [
|
|
1333
|
+
"content_id"
|
|
1334
|
+
]
|
|
1335
|
+
},
|
|
1336
|
+
{
|
|
1337
|
+
"name": "-",
|
|
1338
|
+
"type": "CHECK",
|
|
1339
|
+
"def": "CHECK (content_json IS NULL OR json_valid(content_json))",
|
|
1340
|
+
"table": "document_blocks",
|
|
1341
|
+
"columns": [
|
|
1342
|
+
"content_json"
|
|
1343
|
+
]
|
|
1344
|
+
},
|
|
1345
|
+
{
|
|
1346
|
+
"name": "-",
|
|
1347
|
+
"type": "CHECK",
|
|
1348
|
+
"def": "CHECK (metadata_json IS NULL OR json_valid(metadata_json))",
|
|
1349
|
+
"table": "document_blocks",
|
|
1350
|
+
"columns": [
|
|
1351
|
+
"metadata_json"
|
|
1352
|
+
]
|
|
1353
|
+
},
|
|
1354
|
+
{
|
|
1355
|
+
"name": "-",
|
|
1356
|
+
"type": "CHECK",
|
|
1357
|
+
"def": "CHECK (content_text IS NOT NULL OR content_json IS NOT NULL)",
|
|
1358
|
+
"table": "document_blocks",
|
|
1359
|
+
"columns": [
|
|
1360
|
+
"content_text",
|
|
1361
|
+
"content_json"
|
|
1362
|
+
]
|
|
1363
|
+
}
|
|
1364
|
+
],
|
|
1365
|
+
"def": "CREATE TABLE document_blocks (\n -- block 식별자\n block_id CHAR(36) PRIMARY KEY\n CHECK (length(block_id) = 36),\n\n -- 소속 content 식별자\n content_id CHAR(36) NOT NULL\n CHECK (length(content_id) = 36),\n\n -- block 유형 코드\n block_type_code VARCHAR(32) NOT NULL,\n\n -- content 안에서의 순서\n sort_order INTEGER NOT NULL DEFAULT 0,\n\n -- 텍스트 중심 block 본문\n content_text TEXT,\n\n -- 구조형 block payload\n content_json JSON\n CHECK (content_json IS NULL OR json_valid(content_json)),\n\n -- 생성 시각\n created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,\n\n -- 수정 시각\n updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,\n\n -- 확장 메타데이터\n metadata_json JSON\n CHECK (metadata_json IS NULL OR json_valid(metadata_json)),\n\n FOREIGN KEY (content_id)\n REFERENCES document_contents (content_id)\n ON DELETE CASCADE,\n\n UNIQUE (content_id, sort_order),\n\n CHECK (content_text IS NOT NULL OR content_json IS NOT NULL)\n)"
|
|
1366
|
+
},
|
|
1367
|
+
{
|
|
1368
|
+
"name": "document_annotations",
|
|
1369
|
+
"type": "table",
|
|
1370
|
+
"comment": "문서 본문 밖의 note annotation을 관리한다.",
|
|
1371
|
+
"columns": [
|
|
1372
|
+
{
|
|
1373
|
+
"name": "annotation_id",
|
|
1374
|
+
"type": "CHAR(36)",
|
|
1375
|
+
"nullable": true,
|
|
1376
|
+
"comment": "annotation 식별자"
|
|
1377
|
+
},
|
|
1378
|
+
{
|
|
1379
|
+
"name": "document_id",
|
|
1380
|
+
"type": "CHAR(36)",
|
|
1381
|
+
"nullable": false,
|
|
1382
|
+
"comment": "소속 문서 식별자"
|
|
1383
|
+
},
|
|
1384
|
+
{
|
|
1385
|
+
"name": "target_type_code",
|
|
1386
|
+
"type": "VARCHAR(32)",
|
|
1387
|
+
"nullable": false,
|
|
1388
|
+
"comment": "annotation 대상 유형"
|
|
1389
|
+
},
|
|
1390
|
+
{
|
|
1391
|
+
"name": "target_id",
|
|
1392
|
+
"type": "CHAR(36)",
|
|
1393
|
+
"nullable": false,
|
|
1394
|
+
"comment": "annotation 대상 식별자"
|
|
1395
|
+
},
|
|
1396
|
+
{
|
|
1397
|
+
"name": "annotation_type_code",
|
|
1398
|
+
"type": "VARCHAR(32)",
|
|
1399
|
+
"nullable": false,
|
|
1400
|
+
"default": "'note'",
|
|
1401
|
+
"comment": "annotation 유형"
|
|
1402
|
+
},
|
|
1403
|
+
{
|
|
1404
|
+
"name": "status_code",
|
|
1405
|
+
"type": "VARCHAR(32)",
|
|
1406
|
+
"nullable": false,
|
|
1407
|
+
"default": "'open'",
|
|
1408
|
+
"comment": "annotation 상태"
|
|
1409
|
+
},
|
|
1410
|
+
{
|
|
1411
|
+
"name": "note_text",
|
|
1412
|
+
"type": "TEXT",
|
|
1413
|
+
"nullable": false,
|
|
1414
|
+
"comment": "note 내용"
|
|
1415
|
+
},
|
|
1416
|
+
{
|
|
1417
|
+
"name": "author_type_code",
|
|
1418
|
+
"type": "VARCHAR(32)",
|
|
1419
|
+
"nullable": false,
|
|
1420
|
+
"default": "'user'",
|
|
1421
|
+
"comment": "작성자 유형"
|
|
1422
|
+
},
|
|
1423
|
+
{
|
|
1424
|
+
"name": "author_id",
|
|
1425
|
+
"type": "VARCHAR(128)",
|
|
1426
|
+
"nullable": true,
|
|
1427
|
+
"comment": "작성자 식별자"
|
|
1428
|
+
},
|
|
1429
|
+
{
|
|
1430
|
+
"name": "author_name",
|
|
1431
|
+
"type": "VARCHAR(128)",
|
|
1432
|
+
"nullable": true,
|
|
1433
|
+
"comment": "작성자 표시명"
|
|
1434
|
+
},
|
|
1435
|
+
{
|
|
1436
|
+
"name": "resolved_at",
|
|
1437
|
+
"type": "DATETIME",
|
|
1438
|
+
"nullable": true,
|
|
1439
|
+
"comment": "해결 시각"
|
|
1440
|
+
},
|
|
1441
|
+
{
|
|
1442
|
+
"name": "created_at",
|
|
1443
|
+
"type": "DATETIME",
|
|
1444
|
+
"nullable": false,
|
|
1445
|
+
"default": "CURRENT_TIMESTAMP",
|
|
1446
|
+
"comment": "생성 시각"
|
|
1447
|
+
},
|
|
1448
|
+
{
|
|
1449
|
+
"name": "updated_at",
|
|
1450
|
+
"type": "DATETIME",
|
|
1451
|
+
"nullable": false,
|
|
1452
|
+
"default": "CURRENT_TIMESTAMP",
|
|
1453
|
+
"comment": "수정 시각"
|
|
1454
|
+
},
|
|
1455
|
+
{
|
|
1456
|
+
"name": "metadata_json",
|
|
1457
|
+
"type": "JSON",
|
|
1458
|
+
"nullable": true,
|
|
1459
|
+
"comment": "확장 메타데이터"
|
|
1460
|
+
}
|
|
1461
|
+
],
|
|
1462
|
+
"indexes": [
|
|
1463
|
+
{
|
|
1464
|
+
"name": "idx_document_annotations_status",
|
|
1465
|
+
"def": "CREATE INDEX idx_document_annotations_status\n ON document_annotations (document_id, status_code)",
|
|
1466
|
+
"table": "document_annotations",
|
|
1467
|
+
"columns": [
|
|
1468
|
+
"document_id",
|
|
1469
|
+
"status_code"
|
|
1470
|
+
]
|
|
1471
|
+
},
|
|
1472
|
+
{
|
|
1473
|
+
"name": "idx_document_annotations_target",
|
|
1474
|
+
"def": "CREATE INDEX idx_document_annotations_target\n ON document_annotations (document_id, target_type_code, target_id)",
|
|
1475
|
+
"table": "document_annotations",
|
|
1476
|
+
"columns": [
|
|
1477
|
+
"document_id",
|
|
1478
|
+
"target_type_code",
|
|
1479
|
+
"target_id"
|
|
1480
|
+
]
|
|
1481
|
+
},
|
|
1482
|
+
{
|
|
1483
|
+
"name": "sqlite_autoindex_document_annotations_1",
|
|
1484
|
+
"def": "PRIMARY KEY (annotation_id)",
|
|
1485
|
+
"table": "document_annotations",
|
|
1486
|
+
"columns": [
|
|
1487
|
+
"annotation_id"
|
|
1488
|
+
]
|
|
1489
|
+
}
|
|
1490
|
+
],
|
|
1491
|
+
"constraints": [
|
|
1492
|
+
{
|
|
1493
|
+
"name": "annotation_id",
|
|
1494
|
+
"type": "PRIMARY KEY",
|
|
1495
|
+
"def": "PRIMARY KEY (annotation_id)",
|
|
1496
|
+
"table": "document_annotations",
|
|
1497
|
+
"columns": [
|
|
1498
|
+
"annotation_id"
|
|
1499
|
+
]
|
|
1500
|
+
},
|
|
1501
|
+
{
|
|
1502
|
+
"name": "- (Foreign key ID: 0)",
|
|
1503
|
+
"type": "FOREIGN KEY",
|
|
1504
|
+
"def": "FOREIGN KEY (document_id) REFERENCES document_documents (document_id) ON UPDATE NO ACTION ON DELETE CASCADE MATCH NONE",
|
|
1505
|
+
"table": "document_annotations",
|
|
1506
|
+
"referenced_table": "document_documents",
|
|
1507
|
+
"columns": [
|
|
1508
|
+
"document_id"
|
|
1509
|
+
],
|
|
1510
|
+
"referenced_columns": [
|
|
1511
|
+
"document_id"
|
|
1512
|
+
]
|
|
1513
|
+
},
|
|
1514
|
+
{
|
|
1515
|
+
"name": "sqlite_autoindex_document_annotations_1",
|
|
1516
|
+
"type": "PRIMARY KEY",
|
|
1517
|
+
"def": "PRIMARY KEY (annotation_id)",
|
|
1518
|
+
"table": "document_annotations",
|
|
1519
|
+
"columns": [
|
|
1520
|
+
"annotation_id"
|
|
1521
|
+
]
|
|
1522
|
+
},
|
|
1523
|
+
{
|
|
1524
|
+
"name": "-",
|
|
1525
|
+
"type": "CHECK",
|
|
1526
|
+
"def": "CHECK (length(annotation_id) = 36)",
|
|
1527
|
+
"table": "document_annotations",
|
|
1528
|
+
"columns": [
|
|
1529
|
+
"annotation_id"
|
|
1530
|
+
]
|
|
1531
|
+
},
|
|
1532
|
+
{
|
|
1533
|
+
"name": "-",
|
|
1534
|
+
"type": "CHECK",
|
|
1535
|
+
"def": "CHECK (length(document_id) = 36)",
|
|
1536
|
+
"table": "document_annotations",
|
|
1537
|
+
"columns": [
|
|
1538
|
+
"document_id"
|
|
1539
|
+
]
|
|
1540
|
+
},
|
|
1541
|
+
{
|
|
1542
|
+
"name": "-",
|
|
1543
|
+
"type": "CHECK",
|
|
1544
|
+
"def": "CHECK (target_type_code IN ('document', 'node', 'content', 'block'))",
|
|
1545
|
+
"table": "document_annotations",
|
|
1546
|
+
"columns": [
|
|
1547
|
+
"target_type_code"
|
|
1548
|
+
]
|
|
1549
|
+
},
|
|
1550
|
+
{
|
|
1551
|
+
"name": "-",
|
|
1552
|
+
"type": "CHECK",
|
|
1553
|
+
"def": "CHECK (length(target_id) = 36)",
|
|
1554
|
+
"table": "document_annotations",
|
|
1555
|
+
"columns": [
|
|
1556
|
+
"target_id"
|
|
1557
|
+
]
|
|
1558
|
+
},
|
|
1559
|
+
{
|
|
1560
|
+
"name": "-",
|
|
1561
|
+
"type": "CHECK",
|
|
1562
|
+
"def": "CHECK (annotation_type_code = 'note')",
|
|
1563
|
+
"table": "document_annotations",
|
|
1564
|
+
"columns": [
|
|
1565
|
+
"annotation_type_code"
|
|
1566
|
+
]
|
|
1567
|
+
},
|
|
1568
|
+
{
|
|
1569
|
+
"name": "-",
|
|
1570
|
+
"type": "CHECK",
|
|
1571
|
+
"def": "CHECK (status_code IN ('open', 'resolved'))",
|
|
1572
|
+
"table": "document_annotations",
|
|
1573
|
+
"columns": [
|
|
1574
|
+
"status_code"
|
|
1575
|
+
]
|
|
1576
|
+
},
|
|
1577
|
+
{
|
|
1578
|
+
"name": "-",
|
|
1579
|
+
"type": "CHECK",
|
|
1580
|
+
"def": "CHECK (author_type_code IN ('user', 'agent', 'system'))",
|
|
1581
|
+
"table": "document_annotations",
|
|
1582
|
+
"columns": [
|
|
1583
|
+
"author_type_code"
|
|
1584
|
+
]
|
|
1585
|
+
},
|
|
1586
|
+
{
|
|
1587
|
+
"name": "-",
|
|
1588
|
+
"type": "CHECK",
|
|
1589
|
+
"def": "CHECK (metadata_json IS NULL OR json_valid(metadata_json))",
|
|
1590
|
+
"table": "document_annotations",
|
|
1591
|
+
"columns": [
|
|
1592
|
+
"metadata_json"
|
|
1593
|
+
]
|
|
1594
|
+
}
|
|
1595
|
+
],
|
|
1596
|
+
"def": "CREATE TABLE document_annotations (\n -- annotation 식별자\n annotation_id CHAR(36) PRIMARY KEY\n CHECK (length(annotation_id) = 36),\n\n -- 소속 문서 식별자\n document_id CHAR(36) NOT NULL\n CHECK (length(document_id) = 36),\n\n -- annotation 대상 유형\n target_type_code VARCHAR(32) NOT NULL\n CHECK (target_type_code IN ('document', 'node', 'content', 'block')),\n\n -- annotation 대상 식별자\n target_id CHAR(36) NOT NULL\n CHECK (length(target_id) = 36),\n\n -- annotation 유형\n annotation_type_code VARCHAR(32) NOT NULL DEFAULT 'note'\n CHECK (annotation_type_code = 'note'),\n\n -- annotation 상태\n status_code VARCHAR(32) NOT NULL DEFAULT 'open'\n CHECK (status_code IN ('open', 'resolved')),\n\n -- note 내용\n note_text TEXT NOT NULL,\n\n -- 작성자 유형\n author_type_code VARCHAR(32) NOT NULL DEFAULT 'user'\n CHECK (author_type_code IN ('user', 'agent', 'system')),\n\n -- 작성자 식별자\n author_id VARCHAR(128),\n\n -- 작성자 표시명\n author_name VARCHAR(128),\n\n -- 해결 시각\n resolved_at DATETIME,\n\n -- 생성 시각\n created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,\n\n -- 수정 시각\n updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,\n\n -- 확장 메타데이터\n metadata_json JSON\n CHECK (metadata_json IS NULL OR json_valid(metadata_json)),\n\n FOREIGN KEY (document_id)\n REFERENCES document_documents (document_id)\n ON DELETE CASCADE\n)"
|
|
1597
|
+
},
|
|
1598
|
+
{
|
|
1599
|
+
"name": "document_revisions",
|
|
1600
|
+
"type": "table",
|
|
1601
|
+
"comment": "하나 이상의 변경 이벤트를 묶는 의미 있는 변경 단위를 관리한다.",
|
|
1602
|
+
"columns": [
|
|
1603
|
+
{
|
|
1604
|
+
"name": "revision_id",
|
|
1605
|
+
"type": "CHAR(36)",
|
|
1606
|
+
"nullable": true,
|
|
1607
|
+
"comment": "revision 식별자"
|
|
1608
|
+
},
|
|
1609
|
+
{
|
|
1610
|
+
"name": "document_id",
|
|
1611
|
+
"type": "CHAR(36)",
|
|
1612
|
+
"nullable": false,
|
|
1613
|
+
"comment": "소속 문서 식별자"
|
|
1614
|
+
},
|
|
1615
|
+
{
|
|
1616
|
+
"name": "revision_no",
|
|
1617
|
+
"type": "INTEGER",
|
|
1618
|
+
"nullable": false,
|
|
1619
|
+
"comment": "문서별 revision 순번"
|
|
1620
|
+
},
|
|
1621
|
+
{
|
|
1622
|
+
"name": "revision_title",
|
|
1623
|
+
"type": "VARCHAR(256)",
|
|
1624
|
+
"nullable": false,
|
|
1625
|
+
"comment": "revision 제목"
|
|
1626
|
+
},
|
|
1627
|
+
{
|
|
1628
|
+
"name": "revision_reason",
|
|
1629
|
+
"type": "TEXT",
|
|
1630
|
+
"nullable": true,
|
|
1631
|
+
"comment": "revision 사유"
|
|
1632
|
+
},
|
|
1633
|
+
{
|
|
1634
|
+
"name": "document_status_code",
|
|
1635
|
+
"type": "VARCHAR(32)",
|
|
1636
|
+
"nullable": false,
|
|
1637
|
+
"comment": "revision 생성 당시 문서 상태"
|
|
1638
|
+
},
|
|
1639
|
+
{
|
|
1640
|
+
"name": "created_by_type_code",
|
|
1641
|
+
"type": "VARCHAR(32)",
|
|
1642
|
+
"nullable": false,
|
|
1643
|
+
"default": "'user'",
|
|
1644
|
+
"comment": "revision 생성자 유형"
|
|
1645
|
+
},
|
|
1646
|
+
{
|
|
1647
|
+
"name": "created_by_id",
|
|
1648
|
+
"type": "VARCHAR(128)",
|
|
1649
|
+
"nullable": true,
|
|
1650
|
+
"comment": "revision 생성자 식별자"
|
|
1651
|
+
},
|
|
1652
|
+
{
|
|
1653
|
+
"name": "created_by_name",
|
|
1654
|
+
"type": "VARCHAR(128)",
|
|
1655
|
+
"nullable": true,
|
|
1656
|
+
"comment": "revision 생성자 표시명"
|
|
1657
|
+
},
|
|
1658
|
+
{
|
|
1659
|
+
"name": "created_at",
|
|
1660
|
+
"type": "DATETIME",
|
|
1661
|
+
"nullable": false,
|
|
1662
|
+
"default": "CURRENT_TIMESTAMP",
|
|
1663
|
+
"comment": "생성 시각"
|
|
1664
|
+
},
|
|
1665
|
+
{
|
|
1666
|
+
"name": "metadata_json",
|
|
1667
|
+
"type": "JSON",
|
|
1668
|
+
"nullable": true,
|
|
1669
|
+
"comment": "revision 요약/확장 메타데이터"
|
|
1670
|
+
}
|
|
1671
|
+
],
|
|
1672
|
+
"indexes": [
|
|
1673
|
+
{
|
|
1674
|
+
"name": "idx_document_revisions_created_at",
|
|
1675
|
+
"def": "CREATE INDEX idx_document_revisions_created_at\n ON document_revisions (document_id, created_at)",
|
|
1676
|
+
"table": "document_revisions",
|
|
1677
|
+
"columns": [
|
|
1678
|
+
"document_id",
|
|
1679
|
+
"created_at"
|
|
1680
|
+
]
|
|
1681
|
+
},
|
|
1682
|
+
{
|
|
1683
|
+
"name": "idx_document_revisions_status",
|
|
1684
|
+
"def": "CREATE INDEX idx_document_revisions_status\n ON document_revisions (document_id, document_status_code)",
|
|
1685
|
+
"table": "document_revisions",
|
|
1686
|
+
"columns": [
|
|
1687
|
+
"document_id",
|
|
1688
|
+
"document_status_code"
|
|
1689
|
+
]
|
|
1690
|
+
},
|
|
1691
|
+
{
|
|
1692
|
+
"name": "sqlite_autoindex_document_revisions_2",
|
|
1693
|
+
"def": "UNIQUE (document_id, revision_no)",
|
|
1694
|
+
"table": "document_revisions",
|
|
1695
|
+
"columns": [
|
|
1696
|
+
"document_id",
|
|
1697
|
+
"revision_no"
|
|
1698
|
+
]
|
|
1699
|
+
},
|
|
1700
|
+
{
|
|
1701
|
+
"name": "sqlite_autoindex_document_revisions_1",
|
|
1702
|
+
"def": "PRIMARY KEY (revision_id)",
|
|
1703
|
+
"table": "document_revisions",
|
|
1704
|
+
"columns": [
|
|
1705
|
+
"revision_id"
|
|
1706
|
+
]
|
|
1707
|
+
}
|
|
1708
|
+
],
|
|
1709
|
+
"constraints": [
|
|
1710
|
+
{
|
|
1711
|
+
"name": "revision_id",
|
|
1712
|
+
"type": "PRIMARY KEY",
|
|
1713
|
+
"def": "PRIMARY KEY (revision_id)",
|
|
1714
|
+
"table": "document_revisions",
|
|
1715
|
+
"columns": [
|
|
1716
|
+
"revision_id"
|
|
1717
|
+
]
|
|
1718
|
+
},
|
|
1719
|
+
{
|
|
1720
|
+
"name": "- (Foreign key ID: 0)",
|
|
1721
|
+
"type": "FOREIGN KEY",
|
|
1722
|
+
"def": "FOREIGN KEY (document_id) REFERENCES document_documents (document_id) ON UPDATE NO ACTION ON DELETE CASCADE MATCH NONE",
|
|
1723
|
+
"table": "document_revisions",
|
|
1724
|
+
"referenced_table": "document_documents",
|
|
1725
|
+
"columns": [
|
|
1726
|
+
"document_id"
|
|
1727
|
+
],
|
|
1728
|
+
"referenced_columns": [
|
|
1729
|
+
"document_id"
|
|
1730
|
+
]
|
|
1731
|
+
},
|
|
1732
|
+
{
|
|
1733
|
+
"name": "sqlite_autoindex_document_revisions_2",
|
|
1734
|
+
"type": "UNIQUE",
|
|
1735
|
+
"def": "UNIQUE (document_id, revision_no)",
|
|
1736
|
+
"table": "document_revisions",
|
|
1737
|
+
"columns": [
|
|
1738
|
+
"document_id",
|
|
1739
|
+
"revision_no"
|
|
1740
|
+
]
|
|
1741
|
+
},
|
|
1742
|
+
{
|
|
1743
|
+
"name": "sqlite_autoindex_document_revisions_1",
|
|
1744
|
+
"type": "PRIMARY KEY",
|
|
1745
|
+
"def": "PRIMARY KEY (revision_id)",
|
|
1746
|
+
"table": "document_revisions",
|
|
1747
|
+
"columns": [
|
|
1748
|
+
"revision_id"
|
|
1749
|
+
]
|
|
1750
|
+
},
|
|
1751
|
+
{
|
|
1752
|
+
"name": "-",
|
|
1753
|
+
"type": "CHECK",
|
|
1754
|
+
"def": "CHECK (length(revision_id) = 36)",
|
|
1755
|
+
"table": "document_revisions",
|
|
1756
|
+
"columns": [
|
|
1757
|
+
"revision_id"
|
|
1758
|
+
]
|
|
1759
|
+
},
|
|
1760
|
+
{
|
|
1761
|
+
"name": "-",
|
|
1762
|
+
"type": "CHECK",
|
|
1763
|
+
"def": "CHECK (length(document_id) = 36)",
|
|
1764
|
+
"table": "document_revisions",
|
|
1765
|
+
"columns": [
|
|
1766
|
+
"document_id"
|
|
1767
|
+
]
|
|
1768
|
+
},
|
|
1769
|
+
{
|
|
1770
|
+
"name": "-",
|
|
1771
|
+
"type": "CHECK",
|
|
1772
|
+
"def": "CHECK (revision_no \u003e= 1)",
|
|
1773
|
+
"table": "document_revisions",
|
|
1774
|
+
"columns": [
|
|
1775
|
+
"revision_no"
|
|
1776
|
+
]
|
|
1777
|
+
},
|
|
1778
|
+
{
|
|
1779
|
+
"name": "-",
|
|
1780
|
+
"type": "CHECK",
|
|
1781
|
+
"def": "CHECK (document_status_code IN ('in_review', 'approved', 'published', 'archived'))",
|
|
1782
|
+
"table": "document_revisions",
|
|
1783
|
+
"columns": [
|
|
1784
|
+
"document_status_code"
|
|
1785
|
+
]
|
|
1786
|
+
},
|
|
1787
|
+
{
|
|
1788
|
+
"name": "-",
|
|
1789
|
+
"type": "CHECK",
|
|
1790
|
+
"def": "CHECK (created_by_type_code IN ('user', 'agent', 'system'))",
|
|
1791
|
+
"table": "document_revisions",
|
|
1792
|
+
"columns": [
|
|
1793
|
+
"created_by_type_code"
|
|
1794
|
+
]
|
|
1795
|
+
},
|
|
1796
|
+
{
|
|
1797
|
+
"name": "-",
|
|
1798
|
+
"type": "CHECK",
|
|
1799
|
+
"def": "CHECK (metadata_json IS NULL OR json_valid(metadata_json))",
|
|
1800
|
+
"table": "document_revisions",
|
|
1801
|
+
"columns": [
|
|
1802
|
+
"metadata_json"
|
|
1803
|
+
]
|
|
1804
|
+
}
|
|
1805
|
+
],
|
|
1806
|
+
"def": "CREATE TABLE document_revisions (\n -- revision 식별자\n revision_id CHAR(36) PRIMARY KEY\n CHECK (length(revision_id) = 36),\n\n -- 소속 문서 식별자\n document_id CHAR(36) NOT NULL\n CHECK (length(document_id) = 36),\n\n -- 문서별 revision 순번\n revision_no INTEGER NOT NULL\n CHECK (revision_no \u003e= 1),\n\n -- revision 제목\n revision_title VARCHAR(256) NOT NULL,\n\n -- revision 사유\n revision_reason TEXT,\n\n -- revision 생성 당시 문서 상태\n document_status_code VARCHAR(32) NOT NULL\n CHECK (document_status_code IN ('in_review', 'approved', 'published', 'archived')),\n\n -- revision 생성자 유형\n created_by_type_code VARCHAR(32) NOT NULL DEFAULT 'user'\n CHECK (created_by_type_code IN ('user', 'agent', 'system')),\n\n -- revision 생성자 식별자\n created_by_id VARCHAR(128),\n\n -- revision 생성자 표시명\n created_by_name VARCHAR(128),\n\n -- 생성 시각\n created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,\n\n -- revision 요약/확장 메타데이터\n metadata_json JSON\n CHECK (metadata_json IS NULL OR json_valid(metadata_json)),\n\n FOREIGN KEY (document_id)\n REFERENCES document_documents (document_id)\n ON DELETE CASCADE,\n\n UNIQUE (document_id, revision_no)\n)"
|
|
1807
|
+
},
|
|
1808
|
+
{
|
|
1809
|
+
"name": "document_change_events",
|
|
1810
|
+
"type": "table",
|
|
1811
|
+
"comment": "revision에 속하는 로그성 변경 이벤트를 관리한다.",
|
|
1812
|
+
"columns": [
|
|
1813
|
+
{
|
|
1814
|
+
"name": "event_id",
|
|
1815
|
+
"type": "CHAR(36)",
|
|
1816
|
+
"nullable": true,
|
|
1817
|
+
"comment": "event 식별자"
|
|
1818
|
+
},
|
|
1819
|
+
{
|
|
1820
|
+
"name": "revision_id",
|
|
1821
|
+
"type": "CHAR(36)",
|
|
1822
|
+
"nullable": false,
|
|
1823
|
+
"comment": "소속 revision 식별자"
|
|
1824
|
+
},
|
|
1825
|
+
{
|
|
1826
|
+
"name": "document_id",
|
|
1827
|
+
"type": "CHAR(36)",
|
|
1828
|
+
"nullable": false,
|
|
1829
|
+
"comment": "소속 문서 식별자"
|
|
1830
|
+
},
|
|
1831
|
+
{
|
|
1832
|
+
"name": "sequence_no",
|
|
1833
|
+
"type": "INTEGER",
|
|
1834
|
+
"nullable": false,
|
|
1835
|
+
"comment": "revision 안에서의 event 순서"
|
|
1836
|
+
},
|
|
1837
|
+
{
|
|
1838
|
+
"name": "target_type_code",
|
|
1839
|
+
"type": "VARCHAR(32)",
|
|
1840
|
+
"nullable": false,
|
|
1841
|
+
"comment": "변경 대상 유형"
|
|
1842
|
+
},
|
|
1843
|
+
{
|
|
1844
|
+
"name": "target_id",
|
|
1845
|
+
"type": "CHAR(36)",
|
|
1846
|
+
"nullable": false,
|
|
1847
|
+
"comment": "변경 대상 식별자"
|
|
1848
|
+
},
|
|
1849
|
+
{
|
|
1850
|
+
"name": "change_type_code",
|
|
1851
|
+
"type": "VARCHAR(64)",
|
|
1852
|
+
"nullable": false,
|
|
1853
|
+
"comment": "변경 유형"
|
|
1854
|
+
},
|
|
1855
|
+
{
|
|
1856
|
+
"name": "change_reason",
|
|
1857
|
+
"type": "TEXT",
|
|
1858
|
+
"nullable": true,
|
|
1859
|
+
"comment": "개별 변경 사유"
|
|
1860
|
+
},
|
|
1861
|
+
{
|
|
1862
|
+
"name": "changed_by_type_code",
|
|
1863
|
+
"type": "VARCHAR(32)",
|
|
1864
|
+
"nullable": false,
|
|
1865
|
+
"default": "'user'",
|
|
1866
|
+
"comment": "변경자 유형"
|
|
1867
|
+
},
|
|
1868
|
+
{
|
|
1869
|
+
"name": "changed_by_id",
|
|
1870
|
+
"type": "VARCHAR(128)",
|
|
1871
|
+
"nullable": true,
|
|
1872
|
+
"comment": "변경자 식별자"
|
|
1873
|
+
},
|
|
1874
|
+
{
|
|
1875
|
+
"name": "changed_by_name",
|
|
1876
|
+
"type": "VARCHAR(128)",
|
|
1877
|
+
"nullable": true,
|
|
1878
|
+
"comment": "변경자 표시명"
|
|
1879
|
+
},
|
|
1880
|
+
{
|
|
1881
|
+
"name": "changed_at",
|
|
1882
|
+
"type": "DATETIME",
|
|
1883
|
+
"nullable": false,
|
|
1884
|
+
"default": "CURRENT_TIMESTAMP",
|
|
1885
|
+
"comment": "변경 시각"
|
|
1886
|
+
},
|
|
1887
|
+
{
|
|
1888
|
+
"name": "metadata_json",
|
|
1889
|
+
"type": "JSON",
|
|
1890
|
+
"nullable": true,
|
|
1891
|
+
"comment": "이벤트 메타데이터"
|
|
1892
|
+
}
|
|
1893
|
+
],
|
|
1894
|
+
"indexes": [
|
|
1895
|
+
{
|
|
1896
|
+
"name": "idx_document_change_events_changed_at",
|
|
1897
|
+
"def": "CREATE INDEX idx_document_change_events_changed_at\n ON document_change_events (document_id, changed_at)",
|
|
1898
|
+
"table": "document_change_events",
|
|
1899
|
+
"columns": [
|
|
1900
|
+
"document_id",
|
|
1901
|
+
"changed_at"
|
|
1902
|
+
]
|
|
1903
|
+
},
|
|
1904
|
+
{
|
|
1905
|
+
"name": "idx_document_change_events_target",
|
|
1906
|
+
"def": "CREATE INDEX idx_document_change_events_target\n ON document_change_events (document_id, target_type_code, target_id)",
|
|
1907
|
+
"table": "document_change_events",
|
|
1908
|
+
"columns": [
|
|
1909
|
+
"document_id",
|
|
1910
|
+
"target_type_code",
|
|
1911
|
+
"target_id"
|
|
1912
|
+
]
|
|
1913
|
+
},
|
|
1914
|
+
{
|
|
1915
|
+
"name": "sqlite_autoindex_document_change_events_2",
|
|
1916
|
+
"def": "UNIQUE (revision_id, sequence_no)",
|
|
1917
|
+
"table": "document_change_events",
|
|
1918
|
+
"columns": [
|
|
1919
|
+
"revision_id",
|
|
1920
|
+
"sequence_no"
|
|
1921
|
+
]
|
|
1922
|
+
},
|
|
1923
|
+
{
|
|
1924
|
+
"name": "sqlite_autoindex_document_change_events_1",
|
|
1925
|
+
"def": "PRIMARY KEY (event_id)",
|
|
1926
|
+
"table": "document_change_events",
|
|
1927
|
+
"columns": [
|
|
1928
|
+
"event_id"
|
|
1929
|
+
]
|
|
1930
|
+
}
|
|
1931
|
+
],
|
|
1932
|
+
"constraints": [
|
|
1933
|
+
{
|
|
1934
|
+
"name": "event_id",
|
|
1935
|
+
"type": "PRIMARY KEY",
|
|
1936
|
+
"def": "PRIMARY KEY (event_id)",
|
|
1937
|
+
"table": "document_change_events",
|
|
1938
|
+
"columns": [
|
|
1939
|
+
"event_id"
|
|
1940
|
+
]
|
|
1941
|
+
},
|
|
1942
|
+
{
|
|
1943
|
+
"name": "- (Foreign key ID: 0)",
|
|
1944
|
+
"type": "FOREIGN KEY",
|
|
1945
|
+
"def": "FOREIGN KEY (document_id) REFERENCES document_documents (document_id) ON UPDATE NO ACTION ON DELETE CASCADE MATCH NONE",
|
|
1946
|
+
"table": "document_change_events",
|
|
1947
|
+
"referenced_table": "document_documents",
|
|
1948
|
+
"columns": [
|
|
1949
|
+
"document_id"
|
|
1950
|
+
],
|
|
1951
|
+
"referenced_columns": [
|
|
1952
|
+
"document_id"
|
|
1953
|
+
]
|
|
1954
|
+
},
|
|
1955
|
+
{
|
|
1956
|
+
"name": "- (Foreign key ID: 1)",
|
|
1957
|
+
"type": "FOREIGN KEY",
|
|
1958
|
+
"def": "FOREIGN KEY (revision_id) REFERENCES document_revisions (revision_id) ON UPDATE NO ACTION ON DELETE CASCADE MATCH NONE",
|
|
1959
|
+
"table": "document_change_events",
|
|
1960
|
+
"referenced_table": "document_revisions",
|
|
1961
|
+
"columns": [
|
|
1962
|
+
"revision_id"
|
|
1963
|
+
],
|
|
1964
|
+
"referenced_columns": [
|
|
1965
|
+
"revision_id"
|
|
1966
|
+
]
|
|
1967
|
+
},
|
|
1968
|
+
{
|
|
1969
|
+
"name": "sqlite_autoindex_document_change_events_2",
|
|
1970
|
+
"type": "UNIQUE",
|
|
1971
|
+
"def": "UNIQUE (revision_id, sequence_no)",
|
|
1972
|
+
"table": "document_change_events",
|
|
1973
|
+
"columns": [
|
|
1974
|
+
"revision_id",
|
|
1975
|
+
"sequence_no"
|
|
1976
|
+
]
|
|
1977
|
+
},
|
|
1978
|
+
{
|
|
1979
|
+
"name": "sqlite_autoindex_document_change_events_1",
|
|
1980
|
+
"type": "PRIMARY KEY",
|
|
1981
|
+
"def": "PRIMARY KEY (event_id)",
|
|
1982
|
+
"table": "document_change_events",
|
|
1983
|
+
"columns": [
|
|
1984
|
+
"event_id"
|
|
1985
|
+
]
|
|
1986
|
+
},
|
|
1987
|
+
{
|
|
1988
|
+
"name": "-",
|
|
1989
|
+
"type": "CHECK",
|
|
1990
|
+
"def": "CHECK (length(event_id) = 36)",
|
|
1991
|
+
"table": "document_change_events",
|
|
1992
|
+
"columns": [
|
|
1993
|
+
"event_id"
|
|
1994
|
+
]
|
|
1995
|
+
},
|
|
1996
|
+
{
|
|
1997
|
+
"name": "-",
|
|
1998
|
+
"type": "CHECK",
|
|
1999
|
+
"def": "CHECK (length(revision_id) = 36)",
|
|
2000
|
+
"table": "document_change_events",
|
|
2001
|
+
"columns": [
|
|
2002
|
+
"revision_id"
|
|
2003
|
+
]
|
|
2004
|
+
},
|
|
2005
|
+
{
|
|
2006
|
+
"name": "-",
|
|
2007
|
+
"type": "CHECK",
|
|
2008
|
+
"def": "CHECK (length(document_id) = 36)",
|
|
2009
|
+
"table": "document_change_events",
|
|
2010
|
+
"columns": [
|
|
2011
|
+
"document_id"
|
|
2012
|
+
]
|
|
2013
|
+
},
|
|
2014
|
+
{
|
|
2015
|
+
"name": "-",
|
|
2016
|
+
"type": "CHECK",
|
|
2017
|
+
"def": "CHECK (sequence_no \u003e= 1)",
|
|
2018
|
+
"table": "document_change_events",
|
|
2019
|
+
"columns": [
|
|
2020
|
+
"sequence_no"
|
|
2021
|
+
]
|
|
2022
|
+
},
|
|
2023
|
+
{
|
|
2024
|
+
"name": "-",
|
|
2025
|
+
"type": "CHECK",
|
|
2026
|
+
"def": "CHECK (target_type_code IN ('document', 'node', 'content', 'block', 'annotation'))",
|
|
2027
|
+
"table": "document_change_events",
|
|
2028
|
+
"columns": [
|
|
2029
|
+
"target_type_code"
|
|
2030
|
+
]
|
|
2031
|
+
},
|
|
2032
|
+
{
|
|
2033
|
+
"name": "-",
|
|
2034
|
+
"type": "CHECK",
|
|
2035
|
+
"def": "CHECK (length(target_id) = 36)",
|
|
2036
|
+
"table": "document_change_events",
|
|
2037
|
+
"columns": [
|
|
2038
|
+
"target_id"
|
|
2039
|
+
]
|
|
2040
|
+
},
|
|
2041
|
+
{
|
|
2042
|
+
"name": "-",
|
|
2043
|
+
"type": "CHECK",
|
|
2044
|
+
"def": "CHECK (change_type_code IN ( 'created', 'updated', 'deleted', 'status_changed', 'reordered', 'annotated', 'version_created', 'new_draft_created' ))",
|
|
2045
|
+
"table": "document_change_events",
|
|
2046
|
+
"columns": [
|
|
2047
|
+
"change_type_code"
|
|
2048
|
+
]
|
|
2049
|
+
},
|
|
2050
|
+
{
|
|
2051
|
+
"name": "-",
|
|
2052
|
+
"type": "CHECK",
|
|
2053
|
+
"def": "CHECK (changed_by_type_code IN ('user', 'agent', 'system'))",
|
|
2054
|
+
"table": "document_change_events",
|
|
2055
|
+
"columns": [
|
|
2056
|
+
"changed_by_type_code"
|
|
2057
|
+
]
|
|
2058
|
+
},
|
|
2059
|
+
{
|
|
2060
|
+
"name": "-",
|
|
2061
|
+
"type": "CHECK",
|
|
2062
|
+
"def": "CHECK (metadata_json IS NULL OR json_valid(metadata_json))",
|
|
2063
|
+
"table": "document_change_events",
|
|
2064
|
+
"columns": [
|
|
2065
|
+
"metadata_json"
|
|
2066
|
+
]
|
|
2067
|
+
}
|
|
2068
|
+
],
|
|
2069
|
+
"def": "CREATE TABLE document_change_events (\n -- event 식별자\n event_id CHAR(36) PRIMARY KEY\n CHECK (length(event_id) = 36),\n\n -- 소속 revision 식별자\n revision_id CHAR(36) NOT NULL\n CHECK (length(revision_id) = 36),\n\n -- 소속 문서 식별자\n document_id CHAR(36) NOT NULL\n CHECK (length(document_id) = 36),\n\n -- revision 안에서의 event 순서\n sequence_no INTEGER NOT NULL\n CHECK (sequence_no \u003e= 1),\n\n -- 변경 대상 유형\n target_type_code VARCHAR(32) NOT NULL\n CHECK (target_type_code IN ('document', 'node', 'content', 'block', 'annotation')),\n\n -- 변경 대상 식별자\n target_id CHAR(36) NOT NULL\n CHECK (length(target_id) = 36),\n\n -- 변경 유형\n change_type_code VARCHAR(64) NOT NULL\n CHECK (change_type_code IN (\n 'created',\n 'updated',\n 'deleted',\n 'status_changed',\n 'reordered',\n 'annotated',\n 'version_created',\n 'new_draft_created'\n )),\n\n -- 개별 변경 사유\n change_reason TEXT,\n\n -- 변경자 유형\n changed_by_type_code VARCHAR(32) NOT NULL DEFAULT 'user'\n CHECK (changed_by_type_code IN ('user', 'agent', 'system')),\n\n -- 변경자 식별자\n changed_by_id VARCHAR(128),\n\n -- 변경자 표시명\n changed_by_name VARCHAR(128),\n\n -- 변경 시각\n changed_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,\n\n -- before/after preview 등 이벤트 메타데이터\n metadata_json JSON\n CHECK (metadata_json IS NULL OR json_valid(metadata_json)),\n\n FOREIGN KEY (revision_id)\n REFERENCES document_revisions (revision_id)\n ON DELETE CASCADE,\n\n FOREIGN KEY (document_id)\n REFERENCES document_documents (document_id)\n ON DELETE CASCADE,\n\n UNIQUE (revision_id, sequence_no)\n)"
|
|
2070
|
+
},
|
|
2071
|
+
{
|
|
2072
|
+
"name": "document_versions",
|
|
2073
|
+
"type": "table",
|
|
2074
|
+
"comment": "검토/승인/배포 기준본 snapshot을 관리한다.",
|
|
2075
|
+
"columns": [
|
|
2076
|
+
{
|
|
2077
|
+
"name": "version_id",
|
|
2078
|
+
"type": "CHAR(36)",
|
|
2079
|
+
"nullable": true,
|
|
2080
|
+
"comment": "version 식별자"
|
|
2081
|
+
},
|
|
2082
|
+
{
|
|
2083
|
+
"name": "document_id",
|
|
2084
|
+
"type": "CHAR(36)",
|
|
2085
|
+
"nullable": false,
|
|
2086
|
+
"comment": "소속 문서 식별자"
|
|
2087
|
+
},
|
|
2088
|
+
{
|
|
2089
|
+
"name": "revision_id",
|
|
2090
|
+
"type": "CHAR(36)",
|
|
2091
|
+
"nullable": false,
|
|
2092
|
+
"comment": "기준 revision 식별자"
|
|
2093
|
+
},
|
|
2094
|
+
{
|
|
2095
|
+
"name": "version_no",
|
|
2096
|
+
"type": "INTEGER",
|
|
2097
|
+
"nullable": false,
|
|
2098
|
+
"comment": "문서별 version 순번"
|
|
2099
|
+
},
|
|
2100
|
+
{
|
|
2101
|
+
"name": "version_label",
|
|
2102
|
+
"type": "VARCHAR(64)",
|
|
2103
|
+
"nullable": true,
|
|
2104
|
+
"comment": "표시 버전"
|
|
2105
|
+
},
|
|
2106
|
+
{
|
|
2107
|
+
"name": "snapshot_type_code",
|
|
2108
|
+
"type": "VARCHAR(32)",
|
|
2109
|
+
"nullable": false,
|
|
2110
|
+
"comment": "snapshot 유형"
|
|
2111
|
+
},
|
|
2112
|
+
{
|
|
2113
|
+
"name": "document_status_code",
|
|
2114
|
+
"type": "VARCHAR(32)",
|
|
2115
|
+
"nullable": false,
|
|
2116
|
+
"comment": "snapshot 당시 문서 상태"
|
|
2117
|
+
},
|
|
2118
|
+
{
|
|
2119
|
+
"name": "snapshot_json",
|
|
2120
|
+
"type": "JSON",
|
|
2121
|
+
"nullable": true,
|
|
2122
|
+
"comment": "작은 snapshot 또는 manifest"
|
|
2123
|
+
},
|
|
2124
|
+
{
|
|
2125
|
+
"name": "checksum",
|
|
2126
|
+
"type": "CHAR(64)",
|
|
2127
|
+
"nullable": true,
|
|
2128
|
+
"comment": "snapshot checksum"
|
|
2129
|
+
},
|
|
2130
|
+
{
|
|
2131
|
+
"name": "created_by_type_code",
|
|
2132
|
+
"type": "VARCHAR(32)",
|
|
2133
|
+
"nullable": false,
|
|
2134
|
+
"default": "'user'",
|
|
2135
|
+
"comment": "생성자 유형"
|
|
2136
|
+
},
|
|
2137
|
+
{
|
|
2138
|
+
"name": "created_by_id",
|
|
2139
|
+
"type": "VARCHAR(128)",
|
|
2140
|
+
"nullable": true,
|
|
2141
|
+
"comment": "생성자 식별자"
|
|
2142
|
+
},
|
|
2143
|
+
{
|
|
2144
|
+
"name": "created_by_name",
|
|
2145
|
+
"type": "VARCHAR(128)",
|
|
2146
|
+
"nullable": true,
|
|
2147
|
+
"comment": "생성자 표시명"
|
|
2148
|
+
},
|
|
2149
|
+
{
|
|
2150
|
+
"name": "created_at",
|
|
2151
|
+
"type": "DATETIME",
|
|
2152
|
+
"nullable": false,
|
|
2153
|
+
"default": "CURRENT_TIMESTAMP",
|
|
2154
|
+
"comment": "생성 시각"
|
|
2155
|
+
}
|
|
2156
|
+
],
|
|
2157
|
+
"indexes": [
|
|
2158
|
+
{
|
|
2159
|
+
"name": "idx_document_versions_type",
|
|
2160
|
+
"def": "CREATE INDEX idx_document_versions_type\n ON document_versions (document_id, snapshot_type_code)",
|
|
2161
|
+
"table": "document_versions",
|
|
2162
|
+
"columns": [
|
|
2163
|
+
"document_id",
|
|
2164
|
+
"snapshot_type_code"
|
|
2165
|
+
]
|
|
2166
|
+
},
|
|
2167
|
+
{
|
|
2168
|
+
"name": "idx_document_versions_revision",
|
|
2169
|
+
"def": "CREATE INDEX idx_document_versions_revision\n ON document_versions (revision_id)",
|
|
2170
|
+
"table": "document_versions",
|
|
2171
|
+
"columns": [
|
|
2172
|
+
"revision_id"
|
|
2173
|
+
]
|
|
2174
|
+
},
|
|
2175
|
+
{
|
|
2176
|
+
"name": "sqlite_autoindex_document_versions_2",
|
|
2177
|
+
"def": "UNIQUE (document_id, version_no)",
|
|
2178
|
+
"table": "document_versions",
|
|
2179
|
+
"columns": [
|
|
2180
|
+
"document_id",
|
|
2181
|
+
"version_no"
|
|
2182
|
+
]
|
|
2183
|
+
},
|
|
2184
|
+
{
|
|
2185
|
+
"name": "sqlite_autoindex_document_versions_1",
|
|
2186
|
+
"def": "PRIMARY KEY (version_id)",
|
|
2187
|
+
"table": "document_versions",
|
|
2188
|
+
"columns": [
|
|
2189
|
+
"version_id"
|
|
2190
|
+
]
|
|
2191
|
+
}
|
|
2192
|
+
],
|
|
2193
|
+
"constraints": [
|
|
2194
|
+
{
|
|
2195
|
+
"name": "version_id",
|
|
2196
|
+
"type": "PRIMARY KEY",
|
|
2197
|
+
"def": "PRIMARY KEY (version_id)",
|
|
2198
|
+
"table": "document_versions",
|
|
2199
|
+
"columns": [
|
|
2200
|
+
"version_id"
|
|
2201
|
+
]
|
|
2202
|
+
},
|
|
2203
|
+
{
|
|
2204
|
+
"name": "- (Foreign key ID: 0)",
|
|
2205
|
+
"type": "FOREIGN KEY",
|
|
2206
|
+
"def": "FOREIGN KEY (revision_id) REFERENCES document_revisions (revision_id) ON UPDATE NO ACTION ON DELETE CASCADE MATCH NONE",
|
|
2207
|
+
"table": "document_versions",
|
|
2208
|
+
"referenced_table": "document_revisions",
|
|
2209
|
+
"columns": [
|
|
2210
|
+
"revision_id"
|
|
2211
|
+
],
|
|
2212
|
+
"referenced_columns": [
|
|
2213
|
+
"revision_id"
|
|
2214
|
+
]
|
|
2215
|
+
},
|
|
2216
|
+
{
|
|
2217
|
+
"name": "- (Foreign key ID: 1)",
|
|
2218
|
+
"type": "FOREIGN KEY",
|
|
2219
|
+
"def": "FOREIGN KEY (document_id) REFERENCES document_documents (document_id) ON UPDATE NO ACTION ON DELETE CASCADE MATCH NONE",
|
|
2220
|
+
"table": "document_versions",
|
|
2221
|
+
"referenced_table": "document_documents",
|
|
2222
|
+
"columns": [
|
|
2223
|
+
"document_id"
|
|
2224
|
+
],
|
|
2225
|
+
"referenced_columns": [
|
|
2226
|
+
"document_id"
|
|
2227
|
+
]
|
|
2228
|
+
},
|
|
2229
|
+
{
|
|
2230
|
+
"name": "sqlite_autoindex_document_versions_2",
|
|
2231
|
+
"type": "UNIQUE",
|
|
2232
|
+
"def": "UNIQUE (document_id, version_no)",
|
|
2233
|
+
"table": "document_versions",
|
|
2234
|
+
"columns": [
|
|
2235
|
+
"document_id",
|
|
2236
|
+
"version_no"
|
|
2237
|
+
]
|
|
2238
|
+
},
|
|
2239
|
+
{
|
|
2240
|
+
"name": "sqlite_autoindex_document_versions_1",
|
|
2241
|
+
"type": "PRIMARY KEY",
|
|
2242
|
+
"def": "PRIMARY KEY (version_id)",
|
|
2243
|
+
"table": "document_versions",
|
|
2244
|
+
"columns": [
|
|
2245
|
+
"version_id"
|
|
2246
|
+
]
|
|
2247
|
+
},
|
|
2248
|
+
{
|
|
2249
|
+
"name": "-",
|
|
2250
|
+
"type": "CHECK",
|
|
2251
|
+
"def": "CHECK (length(version_id) = 36)",
|
|
2252
|
+
"table": "document_versions",
|
|
2253
|
+
"columns": [
|
|
2254
|
+
"version_id"
|
|
2255
|
+
]
|
|
2256
|
+
},
|
|
2257
|
+
{
|
|
2258
|
+
"name": "-",
|
|
2259
|
+
"type": "CHECK",
|
|
2260
|
+
"def": "CHECK (length(document_id) = 36)",
|
|
2261
|
+
"table": "document_versions",
|
|
2262
|
+
"columns": [
|
|
2263
|
+
"document_id"
|
|
2264
|
+
]
|
|
2265
|
+
},
|
|
2266
|
+
{
|
|
2267
|
+
"name": "-",
|
|
2268
|
+
"type": "CHECK",
|
|
2269
|
+
"def": "CHECK (length(revision_id) = 36)",
|
|
2270
|
+
"table": "document_versions",
|
|
2271
|
+
"columns": [
|
|
2272
|
+
"revision_id"
|
|
2273
|
+
]
|
|
2274
|
+
},
|
|
2275
|
+
{
|
|
2276
|
+
"name": "-",
|
|
2277
|
+
"type": "CHECK",
|
|
2278
|
+
"def": "CHECK (version_no \u003e= 1)",
|
|
2279
|
+
"table": "document_versions",
|
|
2280
|
+
"columns": [
|
|
2281
|
+
"version_no"
|
|
2282
|
+
]
|
|
2283
|
+
},
|
|
2284
|
+
{
|
|
2285
|
+
"name": "-",
|
|
2286
|
+
"type": "CHECK",
|
|
2287
|
+
"def": "CHECK (snapshot_type_code IN ('review', 'approval', 'publication', 'manual'))",
|
|
2288
|
+
"table": "document_versions",
|
|
2289
|
+
"columns": [
|
|
2290
|
+
"snapshot_type_code"
|
|
2291
|
+
]
|
|
2292
|
+
},
|
|
2293
|
+
{
|
|
2294
|
+
"name": "-",
|
|
2295
|
+
"type": "CHECK",
|
|
2296
|
+
"def": "CHECK (document_status_code IN ('in_review', 'approved', 'published', 'archived'))",
|
|
2297
|
+
"table": "document_versions",
|
|
2298
|
+
"columns": [
|
|
2299
|
+
"document_status_code"
|
|
2300
|
+
]
|
|
2301
|
+
},
|
|
2302
|
+
{
|
|
2303
|
+
"name": "-",
|
|
2304
|
+
"type": "CHECK",
|
|
2305
|
+
"def": "CHECK (snapshot_json IS NULL OR json_valid(snapshot_json))",
|
|
2306
|
+
"table": "document_versions",
|
|
2307
|
+
"columns": [
|
|
2308
|
+
"snapshot_json"
|
|
2309
|
+
]
|
|
2310
|
+
},
|
|
2311
|
+
{
|
|
2312
|
+
"name": "-",
|
|
2313
|
+
"type": "CHECK",
|
|
2314
|
+
"def": "CHECK (checksum IS NULL OR length(checksum) = 64)",
|
|
2315
|
+
"table": "document_versions",
|
|
2316
|
+
"columns": [
|
|
2317
|
+
"checksum"
|
|
2318
|
+
]
|
|
2319
|
+
},
|
|
2320
|
+
{
|
|
2321
|
+
"name": "-",
|
|
2322
|
+
"type": "CHECK",
|
|
2323
|
+
"def": "CHECK (created_by_type_code IN ('user', 'agent', 'system'))",
|
|
2324
|
+
"table": "document_versions",
|
|
2325
|
+
"columns": [
|
|
2326
|
+
"created_by_type_code"
|
|
2327
|
+
]
|
|
2328
|
+
}
|
|
2329
|
+
],
|
|
2330
|
+
"def": "CREATE TABLE document_versions (\n -- version 식별자\n version_id CHAR(36) PRIMARY KEY\n CHECK (length(version_id) = 36),\n\n -- 소속 문서 식별자\n document_id CHAR(36) NOT NULL\n CHECK (length(document_id) = 36),\n\n -- 기준 revision 식별자\n revision_id CHAR(36) NOT NULL\n CHECK (length(revision_id) = 36),\n\n -- 문서별 version 순번\n version_no INTEGER NOT NULL\n CHECK (version_no \u003e= 1),\n\n -- 표시 버전\n version_label VARCHAR(64),\n\n -- snapshot 유형\n snapshot_type_code VARCHAR(32) NOT NULL\n CHECK (snapshot_type_code IN ('review', 'approval', 'publication', 'manual')),\n\n -- snapshot 당시 문서 상태\n document_status_code VARCHAR(32) NOT NULL\n CHECK (document_status_code IN ('in_review', 'approved', 'published', 'archived')),\n\n -- 작은 snapshot 또는 manifest\n snapshot_json JSON\n CHECK (snapshot_json IS NULL OR json_valid(snapshot_json)),\n\n -- snapshot checksum\n checksum CHAR(64)\n CHECK (checksum IS NULL OR length(checksum) = 64),\n\n -- 생성자 유형\n created_by_type_code VARCHAR(32) NOT NULL DEFAULT 'user'\n CHECK (created_by_type_code IN ('user', 'agent', 'system')),\n\n -- 생성자 식별자\n created_by_id VARCHAR(128),\n\n -- 생성자 표시명\n created_by_name VARCHAR(128),\n\n -- 생성 시각\n created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,\n\n FOREIGN KEY (document_id)\n REFERENCES document_documents (document_id)\n ON DELETE CASCADE,\n\n FOREIGN KEY (revision_id)\n REFERENCES document_revisions (revision_id)\n ON DELETE CASCADE,\n\n UNIQUE (document_id, version_no)\n)"
|
|
2331
|
+
}
|
|
2332
|
+
],
|
|
2333
|
+
"relations": [
|
|
2334
|
+
{
|
|
2335
|
+
"table": "document_codes",
|
|
2336
|
+
"columns": [
|
|
2337
|
+
"code_group_code"
|
|
2338
|
+
],
|
|
2339
|
+
"cardinality": "zero_or_one",
|
|
2340
|
+
"parent_table": "document_code_groups",
|
|
2341
|
+
"parent_columns": [
|
|
2342
|
+
"code_group_code"
|
|
2343
|
+
],
|
|
2344
|
+
"parent_cardinality": "exactly_one",
|
|
2345
|
+
"def": "FOREIGN KEY (code_group_code) REFERENCES document_code_groups (code_group_code) ON UPDATE NO ACTION ON DELETE CASCADE MATCH NONE"
|
|
2346
|
+
},
|
|
2347
|
+
{
|
|
2348
|
+
"table": "document_node_taxonomy_levels",
|
|
2349
|
+
"columns": [
|
|
2350
|
+
"taxonomy_id"
|
|
2351
|
+
],
|
|
2352
|
+
"cardinality": "zero_or_more",
|
|
2353
|
+
"parent_table": "document_node_taxonomies",
|
|
2354
|
+
"parent_columns": [
|
|
2355
|
+
"taxonomy_id"
|
|
2356
|
+
],
|
|
2357
|
+
"parent_cardinality": "exactly_one",
|
|
2358
|
+
"def": "FOREIGN KEY (taxonomy_id) REFERENCES document_node_taxonomies (taxonomy_id) ON UPDATE NO ACTION ON DELETE CASCADE MATCH NONE"
|
|
2359
|
+
},
|
|
2360
|
+
{
|
|
2361
|
+
"table": "document_documents",
|
|
2362
|
+
"columns": [
|
|
2363
|
+
"source_document_id"
|
|
2364
|
+
],
|
|
2365
|
+
"cardinality": "zero_or_more",
|
|
2366
|
+
"parent_table": "document_documents",
|
|
2367
|
+
"parent_columns": [
|
|
2368
|
+
"document_id"
|
|
2369
|
+
],
|
|
2370
|
+
"parent_cardinality": "zero_or_one",
|
|
2371
|
+
"def": "FOREIGN KEY (source_document_id) REFERENCES document_documents (document_id) ON UPDATE NO ACTION ON DELETE SET NULL MATCH NONE"
|
|
2372
|
+
},
|
|
2373
|
+
{
|
|
2374
|
+
"table": "document_documents",
|
|
2375
|
+
"columns": [
|
|
2376
|
+
"taxonomy_id"
|
|
2377
|
+
],
|
|
2378
|
+
"cardinality": "zero_or_more",
|
|
2379
|
+
"parent_table": "document_node_taxonomies",
|
|
2380
|
+
"parent_columns": [
|
|
2381
|
+
"taxonomy_id"
|
|
2382
|
+
],
|
|
2383
|
+
"parent_cardinality": "exactly_one",
|
|
2384
|
+
"def": "FOREIGN KEY (taxonomy_id) REFERENCES document_node_taxonomies (taxonomy_id) ON UPDATE NO ACTION ON DELETE NO ACTION MATCH NONE"
|
|
2385
|
+
},
|
|
2386
|
+
{
|
|
2387
|
+
"table": "document_nodes",
|
|
2388
|
+
"columns": [
|
|
2389
|
+
"parent_node_id"
|
|
2390
|
+
],
|
|
2391
|
+
"cardinality": "zero_or_more",
|
|
2392
|
+
"parent_table": "document_nodes",
|
|
2393
|
+
"parent_columns": [
|
|
2394
|
+
"node_id"
|
|
2395
|
+
],
|
|
2396
|
+
"parent_cardinality": "zero_or_one",
|
|
2397
|
+
"def": "FOREIGN KEY (parent_node_id) REFERENCES document_nodes (node_id) ON UPDATE NO ACTION ON DELETE CASCADE MATCH NONE"
|
|
2398
|
+
},
|
|
2399
|
+
{
|
|
2400
|
+
"table": "document_nodes",
|
|
2401
|
+
"columns": [
|
|
2402
|
+
"document_id"
|
|
2403
|
+
],
|
|
2404
|
+
"cardinality": "zero_or_more",
|
|
2405
|
+
"parent_table": "document_documents",
|
|
2406
|
+
"parent_columns": [
|
|
2407
|
+
"document_id"
|
|
2408
|
+
],
|
|
2409
|
+
"parent_cardinality": "exactly_one",
|
|
2410
|
+
"def": "FOREIGN KEY (document_id) REFERENCES document_documents (document_id) ON UPDATE NO ACTION ON DELETE CASCADE MATCH NONE"
|
|
2411
|
+
},
|
|
2412
|
+
{
|
|
2413
|
+
"table": "document_contents",
|
|
2414
|
+
"columns": [
|
|
2415
|
+
"node_id"
|
|
2416
|
+
],
|
|
2417
|
+
"cardinality": "zero_or_one",
|
|
2418
|
+
"parent_table": "document_nodes",
|
|
2419
|
+
"parent_columns": [
|
|
2420
|
+
"node_id"
|
|
2421
|
+
],
|
|
2422
|
+
"parent_cardinality": "exactly_one",
|
|
2423
|
+
"def": "FOREIGN KEY (node_id) REFERENCES document_nodes (node_id) ON UPDATE NO ACTION ON DELETE CASCADE MATCH NONE"
|
|
2424
|
+
},
|
|
2425
|
+
{
|
|
2426
|
+
"table": "document_contents",
|
|
2427
|
+
"columns": [
|
|
2428
|
+
"document_id"
|
|
2429
|
+
],
|
|
2430
|
+
"cardinality": "zero_or_more",
|
|
2431
|
+
"parent_table": "document_documents",
|
|
2432
|
+
"parent_columns": [
|
|
2433
|
+
"document_id"
|
|
2434
|
+
],
|
|
2435
|
+
"parent_cardinality": "exactly_one",
|
|
2436
|
+
"def": "FOREIGN KEY (document_id) REFERENCES document_documents (document_id) ON UPDATE NO ACTION ON DELETE CASCADE MATCH NONE"
|
|
2437
|
+
},
|
|
2438
|
+
{
|
|
2439
|
+
"table": "document_blocks",
|
|
2440
|
+
"columns": [
|
|
2441
|
+
"content_id"
|
|
2442
|
+
],
|
|
2443
|
+
"cardinality": "zero_or_more",
|
|
2444
|
+
"parent_table": "document_contents",
|
|
2445
|
+
"parent_columns": [
|
|
2446
|
+
"content_id"
|
|
2447
|
+
],
|
|
2448
|
+
"parent_cardinality": "exactly_one",
|
|
2449
|
+
"def": "FOREIGN KEY (content_id) REFERENCES document_contents (content_id) ON UPDATE NO ACTION ON DELETE CASCADE MATCH NONE"
|
|
2450
|
+
},
|
|
2451
|
+
{
|
|
2452
|
+
"table": "document_annotations",
|
|
2453
|
+
"columns": [
|
|
2454
|
+
"document_id"
|
|
2455
|
+
],
|
|
2456
|
+
"cardinality": "zero_or_more",
|
|
2457
|
+
"parent_table": "document_documents",
|
|
2458
|
+
"parent_columns": [
|
|
2459
|
+
"document_id"
|
|
2460
|
+
],
|
|
2461
|
+
"parent_cardinality": "exactly_one",
|
|
2462
|
+
"def": "FOREIGN KEY (document_id) REFERENCES document_documents (document_id) ON UPDATE NO ACTION ON DELETE CASCADE MATCH NONE"
|
|
2463
|
+
},
|
|
2464
|
+
{
|
|
2465
|
+
"table": "document_revisions",
|
|
2466
|
+
"columns": [
|
|
2467
|
+
"document_id"
|
|
2468
|
+
],
|
|
2469
|
+
"cardinality": "zero_or_more",
|
|
2470
|
+
"parent_table": "document_documents",
|
|
2471
|
+
"parent_columns": [
|
|
2472
|
+
"document_id"
|
|
2473
|
+
],
|
|
2474
|
+
"parent_cardinality": "exactly_one",
|
|
2475
|
+
"def": "FOREIGN KEY (document_id) REFERENCES document_documents (document_id) ON UPDATE NO ACTION ON DELETE CASCADE MATCH NONE"
|
|
2476
|
+
},
|
|
2477
|
+
{
|
|
2478
|
+
"table": "document_change_events",
|
|
2479
|
+
"columns": [
|
|
2480
|
+
"document_id"
|
|
2481
|
+
],
|
|
2482
|
+
"cardinality": "zero_or_more",
|
|
2483
|
+
"parent_table": "document_documents",
|
|
2484
|
+
"parent_columns": [
|
|
2485
|
+
"document_id"
|
|
2486
|
+
],
|
|
2487
|
+
"parent_cardinality": "exactly_one",
|
|
2488
|
+
"def": "FOREIGN KEY (document_id) REFERENCES document_documents (document_id) ON UPDATE NO ACTION ON DELETE CASCADE MATCH NONE"
|
|
2489
|
+
},
|
|
2490
|
+
{
|
|
2491
|
+
"table": "document_change_events",
|
|
2492
|
+
"columns": [
|
|
2493
|
+
"revision_id"
|
|
2494
|
+
],
|
|
2495
|
+
"cardinality": "zero_or_more",
|
|
2496
|
+
"parent_table": "document_revisions",
|
|
2497
|
+
"parent_columns": [
|
|
2498
|
+
"revision_id"
|
|
2499
|
+
],
|
|
2500
|
+
"parent_cardinality": "exactly_one",
|
|
2501
|
+
"def": "FOREIGN KEY (revision_id) REFERENCES document_revisions (revision_id) ON UPDATE NO ACTION ON DELETE CASCADE MATCH NONE"
|
|
2502
|
+
},
|
|
2503
|
+
{
|
|
2504
|
+
"table": "document_versions",
|
|
2505
|
+
"columns": [
|
|
2506
|
+
"revision_id"
|
|
2507
|
+
],
|
|
2508
|
+
"cardinality": "zero_or_more",
|
|
2509
|
+
"parent_table": "document_revisions",
|
|
2510
|
+
"parent_columns": [
|
|
2511
|
+
"revision_id"
|
|
2512
|
+
],
|
|
2513
|
+
"parent_cardinality": "exactly_one",
|
|
2514
|
+
"def": "FOREIGN KEY (revision_id) REFERENCES document_revisions (revision_id) ON UPDATE NO ACTION ON DELETE CASCADE MATCH NONE"
|
|
2515
|
+
},
|
|
2516
|
+
{
|
|
2517
|
+
"table": "document_versions",
|
|
2518
|
+
"columns": [
|
|
2519
|
+
"document_id"
|
|
2520
|
+
],
|
|
2521
|
+
"cardinality": "zero_or_more",
|
|
2522
|
+
"parent_table": "document_documents",
|
|
2523
|
+
"parent_columns": [
|
|
2524
|
+
"document_id"
|
|
2525
|
+
],
|
|
2526
|
+
"parent_cardinality": "exactly_one",
|
|
2527
|
+
"def": "FOREIGN KEY (document_id) REFERENCES document_documents (document_id) ON UPDATE NO ACTION ON DELETE CASCADE MATCH NONE"
|
|
2528
|
+
}
|
|
2529
|
+
],
|
|
2530
|
+
"driver": {
|
|
2531
|
+
"name": "sqlite",
|
|
2532
|
+
"database_version": "3.51.3"
|
|
2533
|
+
}
|
|
2534
|
+
}
|