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.
Files changed (106) hide show
  1. package/.tbls.yml +201 -0
  2. package/CHANGELOG.md +68 -0
  3. package/README.md +313 -0
  4. package/agent/agent.manifest.json +8 -0
  5. package/agent/capabilities/document-authoring.json +21 -0
  6. package/agent/capabilities/document-block.json +22 -0
  7. package/agent/capabilities/document-toc.json +21 -0
  8. package/agent/capabilities/document-validation.json +21 -0
  9. package/agent/examples/document-quality-examples.md +153 -0
  10. package/agent/examples/examples.md +172 -0
  11. package/agent/guides/10-document-authoring-guide.md +28 -0
  12. package/agent/guides/20-domain-boundary-guide.md +41 -0
  13. package/agent/guides/30-authoring-policy-guide.md +40 -0
  14. package/agent/guides/40-toc-authoring-guide.md +73 -0
  15. package/agent/guides/50-content-block-guide.md +57 -0
  16. package/agent/guides/51-paragraph-authoring-guide.md +68 -0
  17. package/agent/guides/52-table-authoring-guide.md +73 -0
  18. package/agent/guides/53-diagram-figure-authoring-guide.md +75 -0
  19. package/agent/guides/70-korean-writing-style-guide.md +65 -0
  20. package/agent/instructions/00-runtime-behavior.md +17 -0
  21. package/agent/instructions/10-scope-and-boundary.md +27 -0
  22. package/agent/instructions/20-task-procedures.md +69 -0
  23. package/agent/instructions/30-must-and-must-not.md +34 -0
  24. package/agent/resource-index.json +185 -0
  25. package/agent/resource-selection.json +205 -0
  26. package/agent/routing.json +34 -0
  27. package/agent/sources/reference-mapping.md +53 -0
  28. package/agent/validation/document-validation-rules.md +73 -0
  29. package/dist/agent/document-agent-contribution.d.ts +15 -0
  30. package/dist/agent/document-agent-contribution.d.ts.map +1 -0
  31. package/dist/agent/document-agent-contribution.js +39 -0
  32. package/dist/agent/document-agent-contribution.js.map +1 -0
  33. package/dist/agent/index.d.ts +2 -0
  34. package/dist/agent/index.d.ts.map +1 -0
  35. package/dist/agent/index.js +2 -0
  36. package/dist/agent/index.js.map +1 -0
  37. package/dist/database.d.ts +8 -0
  38. package/dist/database.d.ts.map +1 -0
  39. package/dist/database.js +76 -0
  40. package/dist/database.js.map +1 -0
  41. package/dist/index.d.ts +15 -0
  42. package/dist/index.d.ts.map +1 -0
  43. package/dist/index.js +14 -0
  44. package/dist/index.js.map +1 -0
  45. package/dist/markdown-importer.d.ts +14 -0
  46. package/dist/markdown-importer.d.ts.map +1 -0
  47. package/dist/markdown-importer.js +386 -0
  48. package/dist/markdown-importer.js.map +1 -0
  49. package/dist/reader.d.ts +17 -0
  50. package/dist/reader.d.ts.map +1 -0
  51. package/dist/reader.js +332 -0
  52. package/dist/reader.js.map +1 -0
  53. package/dist/repositories.d.ts +118 -0
  54. package/dist/repositories.d.ts.map +1 -0
  55. package/dist/repositories.js +388 -0
  56. package/dist/repositories.js.map +1 -0
  57. package/dist/service.d.ts +35 -0
  58. package/dist/service.d.ts.map +1 -0
  59. package/dist/service.js +327 -0
  60. package/dist/service.js.map +1 -0
  61. package/dist/types.d.ts +276 -0
  62. package/dist/types.d.ts.map +1 -0
  63. package/dist/types.js +2 -0
  64. package/dist/types.js.map +1 -0
  65. package/dist/validators.d.ts +4 -0
  66. package/dist/validators.d.ts.map +1 -0
  67. package/dist/validators.js +255 -0
  68. package/dist/validators.js.map +1 -0
  69. package/docs/build.md +55 -0
  70. package/docs/configuration.md +34 -0
  71. package/docs/delivery.md +50 -0
  72. package/docs/operations.md +50 -0
  73. package/docs/publishing.md +69 -0
  74. package/docs/schema/generated/README.md +30 -0
  75. package/docs/schema/generated/document_annotations.md +119 -0
  76. package/docs/schema/generated/document_annotations.svg +60 -0
  77. package/docs/schema/generated/document_blocks.md +97 -0
  78. package/docs/schema/generated/document_blocks.svg +60 -0
  79. package/docs/schema/generated/document_change_events.md +135 -0
  80. package/docs/schema/generated/document_change_events.svg +88 -0
  81. package/docs/schema/generated/document_code_groups.md +70 -0
  82. package/docs/schema/generated/document_code_groups.svg +52 -0
  83. package/docs/schema/generated/document_codes.md +88 -0
  84. package/docs/schema/generated/document_codes.svg +52 -0
  85. package/docs/schema/generated/document_contents.md +87 -0
  86. package/docs/schema/generated/document_contents.svg +116 -0
  87. package/docs/schema/generated/document_documents.md +126 -0
  88. package/docs/schema/generated/document_documents.svg +222 -0
  89. package/docs/schema/generated/document_node_taxonomies.md +84 -0
  90. package/docs/schema/generated/document_node_taxonomies.svg +80 -0
  91. package/docs/schema/generated/document_node_taxonomy_levels.md +91 -0
  92. package/docs/schema/generated/document_node_taxonomy_levels.svg +52 -0
  93. package/docs/schema/generated/document_nodes.md +120 -0
  94. package/docs/schema/generated/document_nodes.svg +98 -0
  95. package/docs/schema/generated/document_revisions.md +107 -0
  96. package/docs/schema/generated/document_revisions.svg +116 -0
  97. package/docs/schema/generated/document_versions.md +126 -0
  98. package/docs/schema/generated/document_versions.svg +88 -0
  99. package/docs/schema/generated/schema.json +2534 -0
  100. package/docs/schema/generated/schema.mmd +170 -0
  101. package/docs/schema/generated/schema.svg +331 -0
  102. package/docs/schema/migrations.md +40 -0
  103. package/docs/usage.md +332 -0
  104. package/docs/validation-rules.md +69 -0
  105. package/package.json +30 -0
  106. package/src/database/migrations/0001_document_base.sql +753 -0
@@ -0,0 +1,120 @@
1
+ # document_nodes
2
+
3
+ ## Description
4
+
5
+ 문서의 계층 node tree를 관리한다.
6
+
7
+ <details>
8
+ <summary><strong>Table Definition</strong></summary>
9
+
10
+ ```sql
11
+ CREATE TABLE document_nodes (
12
+ -- 노드 식별자
13
+ node_id CHAR(36) PRIMARY KEY
14
+ CHECK (length(node_id) = 36),
15
+
16
+ -- 소속 문서 식별자
17
+ document_id CHAR(36) NOT NULL
18
+ CHECK (length(document_id) = 36),
19
+
20
+ -- 상위 노드 식별자
21
+ parent_node_id CHAR(36)
22
+ CHECK (parent_node_id IS NULL OR length(parent_node_id) = 36),
23
+
24
+ -- node level
25
+ node_level INTEGER NOT NULL
26
+ CHECK (node_level >= 1),
27
+
28
+ -- 노드 역할 코드
29
+ node_role_code VARCHAR(64) NOT NULL DEFAULT 'body',
30
+
31
+ -- 노드 제목
32
+ title VARCHAR(512) NOT NULL,
33
+
34
+ -- TOC 표시 정책
35
+ toc_visibility VARCHAR(16) NOT NULL DEFAULT 'inherit'
36
+ CHECK (toc_visibility IN ('inherit', 'include', 'exclude')),
37
+
38
+ -- 번호 정책 코드
39
+ numbering_policy_code VARCHAR(64) NOT NULL DEFAULT 'inherit',
40
+
41
+ -- 수동 번호 override
42
+ numbering_override VARCHAR(64),
43
+
44
+ -- 형제 노드 내 정렬 순서
45
+ sort_order INTEGER NOT NULL DEFAULT 0,
46
+
47
+ -- 생성 시각
48
+ created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
49
+
50
+ -- 수정 시각
51
+ updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
52
+
53
+ -- 확장 메타데이터
54
+ metadata_json JSON
55
+ CHECK (metadata_json IS NULL OR json_valid(metadata_json)),
56
+
57
+ FOREIGN KEY (document_id)
58
+ REFERENCES document_documents (document_id)
59
+ ON DELETE CASCADE,
60
+
61
+ FOREIGN KEY (parent_node_id)
62
+ REFERENCES document_nodes (node_id)
63
+ ON DELETE CASCADE,
64
+
65
+ UNIQUE (document_id, parent_node_id, sort_order)
66
+ )
67
+ ```
68
+
69
+ </details>
70
+
71
+ ## Columns
72
+
73
+ | Name | Type | Default | Nullable | Children | Parents | Comment |
74
+ | --------------------- | ------------ | ----------------- | -------- | ----------------------------------------------------------------------------- | ------------------------------------------- | ---------------------- |
75
+ | node_id | CHAR(36) | | true | [document_nodes](document_nodes.md) [document_contents](document_contents.md) | | 노드 식별자 |
76
+ | document_id | CHAR(36) | | false | | [document_documents](document_documents.md) | 소속 문서 식별자 |
77
+ | parent_node_id | CHAR(36) | | true | | [document_nodes](document_nodes.md) | 상위 노드 식별자 |
78
+ | node_level | INTEGER | | false | | | node level |
79
+ | node_role_code | VARCHAR(64) | 'body' | false | | | 노드 역할 코드 |
80
+ | title | VARCHAR(512) | | false | | | 노드 제목 |
81
+ | toc_visibility | VARCHAR(16) | 'inherit' | false | | | TOC 표시 정책 |
82
+ | numbering_policy_code | VARCHAR(64) | 'inherit' | false | | | 번호 정책 코드 |
83
+ | numbering_override | VARCHAR(64) | | true | | | 수동 번호 override |
84
+ | sort_order | INTEGER | 0 | false | | | 형제 노드 내 정렬 순서 |
85
+ | created_at | DATETIME | CURRENT_TIMESTAMP | false | | | 생성 시각 |
86
+ | updated_at | DATETIME | CURRENT_TIMESTAMP | false | | | 수정 시각 |
87
+ | metadata_json | JSON | | true | | | 확장 메타데이터 |
88
+
89
+ ## Constraints
90
+
91
+ | Name | Type | Definition |
92
+ | --------------------------------- | ----------- | ---------------------------------------------------------------------------------------------------------------------- |
93
+ | node_id | PRIMARY KEY | PRIMARY KEY (node_id) |
94
+ | - (Foreign key ID: 0) | FOREIGN KEY | FOREIGN KEY (parent_node_id) REFERENCES document_nodes (node_id) ON UPDATE NO ACTION ON DELETE CASCADE MATCH NONE |
95
+ | - (Foreign key ID: 1) | FOREIGN KEY | FOREIGN KEY (document_id) REFERENCES document_documents (document_id) ON UPDATE NO ACTION ON DELETE CASCADE MATCH NONE |
96
+ | sqlite_autoindex_document_nodes_2 | UNIQUE | UNIQUE (document_id, parent_node_id, sort_order) |
97
+ | sqlite_autoindex_document_nodes_1 | PRIMARY KEY | PRIMARY KEY (node_id) |
98
+ | - | CHECK | CHECK (length(node_id) = 36) |
99
+ | - | CHECK | CHECK (length(document_id) = 36) |
100
+ | - | CHECK | CHECK (parent_node_id IS NULL OR length(parent_node_id) = 36) |
101
+ | - | CHECK | CHECK (node_level >= 1) |
102
+ | - | CHECK | CHECK (toc_visibility IN ('inherit', 'include', 'exclude')) |
103
+ | - | CHECK | CHECK (metadata_json IS NULL OR json_valid(metadata_json)) |
104
+
105
+ ## Indexes
106
+
107
+ | Name | Definition |
108
+ | ---------------------------------------- | ------------------------------------------------------------------------------------------------------------------------ |
109
+ | idx_document_nodes_document_level_order | CREATE INDEX idx_document_nodes_document_level_order<br /> ON document_nodes (document_id, node_level, sort_order) |
110
+ | idx_document_nodes_document_parent_order | CREATE INDEX idx_document_nodes_document_parent_order<br /> ON document_nodes (document_id, parent_node_id, sort_order) |
111
+ | sqlite_autoindex_document_nodes_2 | UNIQUE (document_id, parent_node_id, sort_order) |
112
+ | sqlite_autoindex_document_nodes_1 | PRIMARY KEY (node_id) |
113
+
114
+ ## Relations
115
+
116
+ ![er](document_nodes.svg)
117
+
118
+ ---
119
+
120
+ > Generated by [tbls](https://github.com/k1LoW/tbls)
@@ -0,0 +1,98 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
3
+ "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
4
+ <!-- Generated by graphviz version 12.1.2 (20240928.0832)
5
+ -->
6
+ <!-- Title: document_nodes Pages: 1 -->
7
+ <svg width="459pt" height="760pt"
8
+ viewBox="0.00 0.00 458.77 760.40" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
9
+ <g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 756.4)">
10
+ <title>document_nodes</title>
11
+ <polygon fill="white" stroke="none" points="-4,4 -4,-756.4 454.77,-756.4 454.77,4 -4,4"/>
12
+ <!-- document_nodes -->
13
+ <g id="node1" class="node">
14
+ <title>document_nodes</title>
15
+ <polygon fill="#efefef" stroke="none" points="73.55,-399.4 73.55,-445.4 354.44,-445.4 354.44,-399.4 73.55,-399.4"/>
16
+ <polygon fill="none" stroke="black" points="73.55,-399.4 73.55,-445.4 354.44,-445.4 354.44,-399.4 73.55,-399.4"/>
17
+ <text text-anchor="start" x="118.38" y="-423.2" font-family="Arial Bold" font-size="18.00">document_nodes</text>
18
+ <text text-anchor="start" x="240.36" y="-423.2" font-family="Arial" font-size="14.00">    </text>
19
+ <text text-anchor="start" x="271.47" y="-423.2" font-family="Arial" font-size="14.00" fill="#666666">[table]</text>
20
+ <text text-anchor="start" x="118.29" y="-408.8" font-family="Arial" font-size="14.00" fill="#333333">문서의 계층 node tree를 관리한다.</text>
21
+ <polygon fill="none" stroke="black" points="73.55,-368.6 73.55,-399.4 354.44,-399.4 354.44,-368.6 73.55,-368.6"/>
22
+ <text text-anchor="start" x="80.55" y="-380.8" font-family="Arial" font-size="14.00">node_id </text>
23
+ <text text-anchor="start" x="134.26" y="-380.8" font-family="Arial" font-size="14.00" fill="#666666">[CHAR(36)]</text>
24
+ <text text-anchor="start" x="206.61" y="-380.8" font-family="Arial" font-size="14.00"> 노드 식별자</text>
25
+ <polygon fill="none" stroke="black" points="73.55,-337.8 73.55,-368.6 354.44,-368.6 354.44,-337.8 73.55,-337.8"/>
26
+ <text text-anchor="start" x="80.55" y="-350" font-family="Arial" font-size="14.00">document_id </text>
27
+ <text text-anchor="start" x="164.6" y="-350" font-family="Arial" font-size="14.00" fill="#666666">[CHAR(36)]</text>
28
+ <text text-anchor="start" x="236.95" y="-350" font-family="Arial" font-size="14.00"> 소속 문서 식별자</text>
29
+ <polygon fill="none" stroke="black" points="73.55,-307 73.55,-337.8 354.44,-337.8 354.44,-307 73.55,-307"/>
30
+ <text text-anchor="start" x="80.55" y="-319.2" font-family="Arial" font-size="14.00">parent_node_id </text>
31
+ <text text-anchor="start" x="181.75" y="-319.2" font-family="Arial" font-size="14.00" fill="#666666">[CHAR(36)]</text>
32
+ <text text-anchor="start" x="254.09" y="-319.2" font-family="Arial" font-size="14.00"> 상위 노드 식별자</text>
33
+ <polygon fill="none" stroke="black" stroke-width="3" points="72.05,-305.5 72.05,-446.9 355.94,-446.9 355.94,-305.5 72.05,-305.5"/>
34
+ </g>
35
+ <!-- document_nodes&#45;&gt;document_nodes -->
36
+ <g id="edge1" class="edge">
37
+ <title>document_nodes:parent_node_id&#45;&gt;document_nodes:node_id</title>
38
+ <path fill="none" stroke="black" d="M216.22,-347.94C222.92,-442.71 222.18,-623.5 214,-623.5 205.52,-623.5 205.03,-484.3 212.51,-399.21"/>
39
+ <polygon fill="black" stroke="black" points="216.23,-347.96 219.95,-337.64 215.82,-342.64 215.49,-338.32 215.49,-338.32 215.49,-338.32 215.82,-342.64 210.98,-338.33 216.23,-347.96"/>
40
+ </g>
41
+ <!-- document_documents -->
42
+ <g id="node3" class="node">
43
+ <title>document_documents</title>
44
+ <polygon fill="#efefef" stroke="none" points="43.6,-135.6 43.6,-181.6 384.39,-181.6 384.39,-135.6 43.6,-135.6"/>
45
+ <polygon fill="none" stroke="black" points="43.6,-135.6 43.6,-181.6 384.39,-181.6 384.39,-135.6 43.6,-135.6"/>
46
+ <text text-anchor="start" x="100.39" y="-159.4" font-family="Arial Bold" font-size="18.00">document_documents</text>
47
+ <text text-anchor="start" x="258.35" y="-159.4" font-family="Arial" font-size="14.00">    </text>
48
+ <text text-anchor="start" x="289.47" y="-159.4" font-family="Arial" font-size="14.00" fill="#666666">[table]</text>
49
+ <text text-anchor="start" x="53.34" y="-145" font-family="Arial" font-size="14.00" fill="#333333">문서 단위 메타데이터, 작성자, taxonomy, 상태를 관리한다.</text>
50
+ <polygon fill="none" stroke="black" points="43.6,-104.8 43.6,-135.6 384.39,-135.6 384.39,-104.8 43.6,-104.8"/>
51
+ <text text-anchor="start" x="50.6" y="-117" font-family="Arial" font-size="14.00">document_id </text>
52
+ <text text-anchor="start" x="134.66" y="-117" font-family="Arial" font-size="14.00" fill="#666666">[CHAR(36)]</text>
53
+ <text text-anchor="start" x="207" y="-117" font-family="Arial" font-size="14.00"> 문서 식별자</text>
54
+ <polygon fill="none" stroke="black" points="43.6,-74 43.6,-104.8 384.39,-104.8 384.39,-74 43.6,-74"/>
55
+ <text text-anchor="start" x="50.6" y="-86.2" font-family="Arial" font-size="14.00">taxonomy_id </text>
56
+ <text text-anchor="start" x="133.87" y="-86.2" font-family="Arial" font-size="14.00" fill="#666666">[CHAR(36)]</text>
57
+ <text text-anchor="start" x="206.22" y="-86.2" font-family="Arial" font-size="14.00"> 적용 taxonomy 식별자</text>
58
+ <polygon fill="none" stroke="black" points="43.6,-43.2 43.6,-74 384.39,-74 384.39,-43.2 43.6,-43.2"/>
59
+ <text text-anchor="start" x="50.6" y="-55.4" font-family="Arial" font-size="14.00">source_document_id </text>
60
+ <text text-anchor="start" x="184.46" y="-55.4" font-family="Arial" font-size="14.00" fill="#666666">[CHAR(36)]</text>
61
+ <text text-anchor="start" x="256.81" y="-55.4" font-family="Arial" font-size="14.00"> 파생 원본 문서 식별자</text>
62
+ </g>
63
+ <!-- document_nodes&#45;&gt;document_documents -->
64
+ <g id="edge3" class="edge">
65
+ <title>document_nodes:document_id&#45;&gt;document_documents:document_id</title>
66
+ <path fill="none" stroke="black" d="M365.6,-352.45C461.69,-337.98 486.33,-120.2 385.39,-120.2"/>
67
+ <polygon fill="black" stroke="black" points="365.75,-352.43 355.44,-348.69 360.43,-352.83 356.11,-353.15 356.11,-353.15 356.11,-353.15 360.43,-352.83 356.11,-357.66 365.75,-352.43"/>
68
+ </g>
69
+ <!-- document_contents -->
70
+ <g id="node2" class="node">
71
+ <title>document_contents</title>
72
+ <polygon fill="#efefef" stroke="none" points="43.2,-663.2 43.2,-709.2 384.79,-709.2 384.79,-663.2 43.2,-663.2"/>
73
+ <polygon fill="none" stroke="black" points="43.2,-663.2 43.2,-709.2 384.79,-709.2 384.79,-663.2 43.2,-663.2"/>
74
+ <text text-anchor="start" x="109.39" y="-687" font-family="Arial Bold" font-size="18.00">document_contents</text>
75
+ <text text-anchor="start" x="249.35" y="-687" font-family="Arial" font-size="14.00">    </text>
76
+ <text text-anchor="start" x="280.47" y="-687" font-family="Arial" font-size="14.00" fill="#666666">[table]</text>
77
+ <text text-anchor="start" x="50.2" y="-672.6" font-family="Arial" font-size="14.00" fill="#333333">특정 document node에 붙는 block collection을 관리한다.</text>
78
+ <polygon fill="none" stroke="black" points="43.2,-632.4 43.2,-663.2 384.79,-663.2 384.79,-632.4 43.2,-632.4"/>
79
+ <text text-anchor="start" x="50.2" y="-644.6" font-family="Arial" font-size="14.00">content_id </text>
80
+ <text text-anchor="start" x="118.7" y="-644.6" font-family="Arial" font-size="14.00" fill="#666666">[CHAR(36)]</text>
81
+ <text text-anchor="start" x="191.04" y="-644.6" font-family="Arial" font-size="14.00"> content 식별자</text>
82
+ <polygon fill="none" stroke="black" points="43.2,-601.6 43.2,-632.4 384.79,-632.4 384.79,-601.6 43.2,-601.6"/>
83
+ <text text-anchor="start" x="50.2" y="-613.8" font-family="Arial" font-size="14.00">document_id </text>
84
+ <text text-anchor="start" x="134.25" y="-613.8" font-family="Arial" font-size="14.00" fill="#666666">[CHAR(36)]</text>
85
+ <text text-anchor="start" x="206.6" y="-613.8" font-family="Arial" font-size="14.00"> 소속 문서 식별자</text>
86
+ <polygon fill="none" stroke="black" points="43.2,-570.8 43.2,-601.6 384.79,-601.6 384.79,-570.8 43.2,-570.8"/>
87
+ <text text-anchor="start" x="50.2" y="-583" font-family="Arial" font-size="14.00">node_id </text>
88
+ <text text-anchor="start" x="103.92" y="-583" font-family="Arial" font-size="14.00" fill="#666666">[CHAR(36)]</text>
89
+ <text text-anchor="start" x="176.26" y="-583" font-family="Arial" font-size="14.00"> 소속 노드 식별자</text>
90
+ </g>
91
+ <!-- document_contents&#45;&gt;document_nodes -->
92
+ <g id="edge2" class="edge">
93
+ <title>document_contents:node_id&#45;&gt;document_nodes:node_id</title>
94
+ <path fill="none" stroke="black" d="M214.84,-559.51C224.77,-503.8 319.88,-549.79 354.44,-491.6 378.87,-450.48 403.27,-384 355.44,-384"/>
95
+ <polygon fill="black" stroke="black" points="214.84,-559.5 209.54,-569.1 214.4,-564.82 214.05,-569.13 214.05,-569.13 214.05,-569.13 214.4,-564.82 218.51,-569.83 214.84,-559.5"/>
96
+ </g>
97
+ </g>
98
+ </svg>
@@ -0,0 +1,107 @@
1
+ # document_revisions
2
+
3
+ ## Description
4
+
5
+ 하나 이상의 변경 이벤트를 묶는 의미 있는 변경 단위를 관리한다.
6
+
7
+ <details>
8
+ <summary><strong>Table Definition</strong></summary>
9
+
10
+ ```sql
11
+ CREATE TABLE document_revisions (
12
+ -- revision 식별자
13
+ revision_id CHAR(36) PRIMARY KEY
14
+ CHECK (length(revision_id) = 36),
15
+
16
+ -- 소속 문서 식별자
17
+ document_id CHAR(36) NOT NULL
18
+ CHECK (length(document_id) = 36),
19
+
20
+ -- 문서별 revision 순번
21
+ revision_no INTEGER NOT NULL
22
+ CHECK (revision_no >= 1),
23
+
24
+ -- revision 제목
25
+ revision_title VARCHAR(256) NOT NULL,
26
+
27
+ -- revision 사유
28
+ revision_reason TEXT,
29
+
30
+ -- revision 생성 당시 문서 상태
31
+ document_status_code VARCHAR(32) NOT NULL
32
+ CHECK (document_status_code IN ('in_review', 'approved', 'published', 'archived')),
33
+
34
+ -- revision 생성자 유형
35
+ created_by_type_code VARCHAR(32) NOT NULL DEFAULT 'user'
36
+ CHECK (created_by_type_code IN ('user', 'agent', 'system')),
37
+
38
+ -- revision 생성자 식별자
39
+ created_by_id VARCHAR(128),
40
+
41
+ -- revision 생성자 표시명
42
+ created_by_name VARCHAR(128),
43
+
44
+ -- 생성 시각
45
+ created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
46
+
47
+ -- revision 요약/확장 메타데이터
48
+ metadata_json JSON
49
+ CHECK (metadata_json IS NULL OR json_valid(metadata_json)),
50
+
51
+ FOREIGN KEY (document_id)
52
+ REFERENCES document_documents (document_id)
53
+ ON DELETE CASCADE,
54
+
55
+ UNIQUE (document_id, revision_no)
56
+ )
57
+ ```
58
+
59
+ </details>
60
+
61
+ ## Columns
62
+
63
+ | Name | Type | Default | Nullable | Children | Parents | Comment |
64
+ | -------------------- | ------------ | ----------------- | -------- | --------------------------------------------------------------------------------------------- | ------------------------------------------- | ----------------------------- |
65
+ | revision_id | CHAR(36) | | true | [document_change_events](document_change_events.md) [document_versions](document_versions.md) | | revision 식별자 |
66
+ | document_id | CHAR(36) | | false | | [document_documents](document_documents.md) | 소속 문서 식별자 |
67
+ | revision_no | INTEGER | | false | | | 문서별 revision 순번 |
68
+ | revision_title | VARCHAR(256) | | false | | | revision 제목 |
69
+ | revision_reason | TEXT | | true | | | revision 사유 |
70
+ | document_status_code | VARCHAR(32) | | false | | | revision 생성 당시 문서 상태 |
71
+ | created_by_type_code | VARCHAR(32) | 'user' | false | | | revision 생성자 유형 |
72
+ | created_by_id | VARCHAR(128) | | true | | | revision 생성자 식별자 |
73
+ | created_by_name | VARCHAR(128) | | true | | | revision 생성자 표시명 |
74
+ | created_at | DATETIME | CURRENT_TIMESTAMP | false | | | 생성 시각 |
75
+ | metadata_json | JSON | | true | | | revision 요약/확장 메타데이터 |
76
+
77
+ ## Constraints
78
+
79
+ | Name | Type | Definition |
80
+ | ------------------------------------- | ----------- | ---------------------------------------------------------------------------------------------------------------------- |
81
+ | revision_id | PRIMARY KEY | PRIMARY KEY (revision_id) |
82
+ | - (Foreign key ID: 0) | FOREIGN KEY | FOREIGN KEY (document_id) REFERENCES document_documents (document_id) ON UPDATE NO ACTION ON DELETE CASCADE MATCH NONE |
83
+ | sqlite_autoindex_document_revisions_2 | UNIQUE | UNIQUE (document_id, revision_no) |
84
+ | sqlite_autoindex_document_revisions_1 | PRIMARY KEY | PRIMARY KEY (revision_id) |
85
+ | - | CHECK | CHECK (length(revision_id) = 36) |
86
+ | - | CHECK | CHECK (length(document_id) = 36) |
87
+ | - | CHECK | CHECK (revision_no >= 1) |
88
+ | - | CHECK | CHECK (document_status_code IN ('in_review', 'approved', 'published', 'archived')) |
89
+ | - | CHECK | CHECK (created_by_type_code IN ('user', 'agent', 'system')) |
90
+ | - | CHECK | CHECK (metadata_json IS NULL OR json_valid(metadata_json)) |
91
+
92
+ ## Indexes
93
+
94
+ | Name | Definition |
95
+ | ------------------------------------- | ----------------------------------------------------------------------------------------------------------- |
96
+ | idx_document_revisions_created_at | CREATE INDEX idx_document_revisions_created_at<br /> ON document_revisions (document_id, created_at) |
97
+ | idx_document_revisions_status | CREATE INDEX idx_document_revisions_status<br /> ON document_revisions (document_id, document_status_code) |
98
+ | sqlite_autoindex_document_revisions_2 | UNIQUE (document_id, revision_no) |
99
+ | sqlite_autoindex_document_revisions_1 | PRIMARY KEY (revision_id) |
100
+
101
+ ## Relations
102
+
103
+ ![er](document_revisions.svg)
104
+
105
+ ---
106
+
107
+ > Generated by [tbls](https://github.com/k1LoW/tbls)
@@ -0,0 +1,116 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
3
+ "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
4
+ <!-- Generated by graphviz version 12.1.2 (20240928.0832)
5
+ -->
6
+ <!-- Title: document_revisions Pages: 1 -->
7
+ <svg width="758pt" height="730pt"
8
+ viewBox="0.00 0.00 758.08 729.60" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
9
+ <g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 725.6)">
10
+ <title>document_revisions</title>
11
+ <polygon fill="white" stroke="none" points="-4,4 -4,-725.6 754.08,-725.6 754.08,4 -4,4"/>
12
+ <!-- document_revisions -->
13
+ <g id="node1" class="node">
14
+ <title>document_revisions</title>
15
+ <polygon fill="#efefef" stroke="none" points="199.03,-368.6 199.03,-414.6 555.32,-414.6 555.32,-368.6 199.03,-368.6"/>
16
+ <polygon fill="none" stroke="black" points="199.03,-368.6 199.03,-414.6 555.32,-414.6 555.32,-368.6 199.03,-368.6"/>
17
+ <text text-anchor="start" x="270.06" y="-392.4" font-family="Arial Bold" font-size="18.00">document_revisions</text>
18
+ <text text-anchor="start" x="415.04" y="-392.4" font-family="Arial" font-size="14.00">    </text>
19
+ <text text-anchor="start" x="446.15" y="-392.4" font-family="Arial" font-size="14.00" fill="#666666">[table]</text>
20
+ <text text-anchor="start" x="206.03" y="-378" font-family="Arial" font-size="14.00" fill="#333333">하나 이상의 변경 이벤트를 묶는 의미 있는 변경 단위를 관리한다.</text>
21
+ <polygon fill="none" stroke="black" points="199.03,-337.8 199.03,-368.6 555.32,-368.6 555.32,-337.8 199.03,-337.8"/>
22
+ <text text-anchor="start" x="206.03" y="-350" font-family="Arial" font-size="14.00">revision_id </text>
23
+ <text text-anchor="start" x="276.84" y="-350" font-family="Arial" font-size="14.00" fill="#666666">[CHAR(36)]</text>
24
+ <text text-anchor="start" x="349.19" y="-350" font-family="Arial" font-size="14.00"> revision 식별자</text>
25
+ <polygon fill="none" stroke="black" points="199.03,-307 199.03,-337.8 555.32,-337.8 555.32,-307 199.03,-307"/>
26
+ <text text-anchor="start" x="206.03" y="-319.2" font-family="Arial" font-size="14.00">document_id </text>
27
+ <text text-anchor="start" x="290.09" y="-319.2" font-family="Arial" font-size="14.00" fill="#666666">[CHAR(36)]</text>
28
+ <text text-anchor="start" x="362.43" y="-319.2" font-family="Arial" font-size="14.00"> 소속 문서 식별자</text>
29
+ <polygon fill="none" stroke="black" stroke-width="3" points="197.53,-305.5 197.53,-416.1 556.82,-416.1 556.82,-305.5 197.53,-305.5"/>
30
+ </g>
31
+ <!-- document_documents -->
32
+ <g id="node4" class="node">
33
+ <title>document_documents</title>
34
+ <polygon fill="#efefef" stroke="none" points="206.78,-135.6 206.78,-181.6 547.57,-181.6 547.57,-135.6 206.78,-135.6"/>
35
+ <polygon fill="none" stroke="black" points="206.78,-135.6 206.78,-181.6 547.57,-181.6 547.57,-135.6 206.78,-135.6"/>
36
+ <text text-anchor="start" x="263.57" y="-159.4" font-family="Arial Bold" font-size="18.00">document_documents</text>
37
+ <text text-anchor="start" x="421.53" y="-159.4" font-family="Arial" font-size="14.00">    </text>
38
+ <text text-anchor="start" x="452.65" y="-159.4" font-family="Arial" font-size="14.00" fill="#666666">[table]</text>
39
+ <text text-anchor="start" x="216.52" y="-145" font-family="Arial" font-size="14.00" fill="#333333">문서 단위 메타데이터, 작성자, taxonomy, 상태를 관리한다.</text>
40
+ <polygon fill="none" stroke="black" points="206.78,-104.8 206.78,-135.6 547.57,-135.6 547.57,-104.8 206.78,-104.8"/>
41
+ <text text-anchor="start" x="213.78" y="-117" font-family="Arial" font-size="14.00">document_id </text>
42
+ <text text-anchor="start" x="297.84" y="-117" font-family="Arial" font-size="14.00" fill="#666666">[CHAR(36)]</text>
43
+ <text text-anchor="start" x="370.18" y="-117" font-family="Arial" font-size="14.00"> 문서 식별자</text>
44
+ <polygon fill="none" stroke="black" points="206.78,-74 206.78,-104.8 547.57,-104.8 547.57,-74 206.78,-74"/>
45
+ <text text-anchor="start" x="213.78" y="-86.2" font-family="Arial" font-size="14.00">taxonomy_id </text>
46
+ <text text-anchor="start" x="297.05" y="-86.2" font-family="Arial" font-size="14.00" fill="#666666">[CHAR(36)]</text>
47
+ <text text-anchor="start" x="369.4" y="-86.2" font-family="Arial" font-size="14.00"> 적용 taxonomy 식별자</text>
48
+ <polygon fill="none" stroke="black" points="206.78,-43.2 206.78,-74 547.57,-74 547.57,-43.2 206.78,-43.2"/>
49
+ <text text-anchor="start" x="213.78" y="-55.4" font-family="Arial" font-size="14.00">source_document_id </text>
50
+ <text text-anchor="start" x="347.64" y="-55.4" font-family="Arial" font-size="14.00" fill="#666666">[CHAR(36)]</text>
51
+ <text text-anchor="start" x="419.99" y="-55.4" font-family="Arial" font-size="14.00"> 파생 원본 문서 식별자</text>
52
+ </g>
53
+ <!-- document_revisions&#45;&gt;document_documents -->
54
+ <g id="edge3" class="edge">
55
+ <title>document_revisions:document_id&#45;&gt;document_documents:document_id</title>
56
+ <path fill="none" stroke="black" d="M377.92,-295.62C388.27,-228.42 504.48,-292.35 547.57,-224.8 572.57,-185.6 595.06,-120.2 548.57,-120.2"/>
57
+ <polygon fill="black" stroke="black" points="377.91,-295.69 372.71,-305.35 377.53,-301.01 377.22,-305.33 377.22,-305.33 377.22,-305.33 377.53,-301.01 381.69,-305.99 377.91,-295.69"/>
58
+ </g>
59
+ <!-- document_change_events -->
60
+ <g id="node2" class="node">
61
+ <title>document_change_events</title>
62
+ <polygon fill="#efefef" stroke="none" points="43.2,-632.4 43.2,-678.4 327.15,-678.4 327.15,-632.4 43.2,-632.4"/>
63
+ <polygon fill="none" stroke="black" points="43.2,-632.4 43.2,-678.4 327.15,-678.4 327.15,-632.4 43.2,-632.4"/>
64
+ <text text-anchor="start" x="57.58" y="-656.2" font-family="Arial Bold" font-size="18.00">document_change_events</text>
65
+ <text text-anchor="start" x="243.51" y="-656.2" font-family="Arial" font-size="14.00">    </text>
66
+ <text text-anchor="start" x="274.63" y="-656.2" font-family="Arial" font-size="14.00" fill="#666666">[table]</text>
67
+ <text text-anchor="start" x="50.2" y="-641.8" font-family="Arial" font-size="14.00" fill="#333333">revision에 속하는 로그성 변경 이벤트를 관리한다.</text>
68
+ <polygon fill="none" stroke="black" points="43.2,-601.6 43.2,-632.4 327.15,-632.4 327.15,-601.6 43.2,-601.6"/>
69
+ <text text-anchor="start" x="50.2" y="-613.8" font-family="Arial" font-size="14.00">event_id </text>
70
+ <text text-anchor="start" x="107.02" y="-613.8" font-family="Arial" font-size="14.00" fill="#666666">[CHAR(36)]</text>
71
+ <text text-anchor="start" x="179.37" y="-613.8" font-family="Arial" font-size="14.00"> event 식별자</text>
72
+ <polygon fill="none" stroke="black" points="43.2,-570.8 43.2,-601.6 327.15,-601.6 327.15,-570.8 43.2,-570.8"/>
73
+ <text text-anchor="start" x="50.2" y="-583" font-family="Arial" font-size="14.00">revision_id </text>
74
+ <text text-anchor="start" x="121.01" y="-583" font-family="Arial" font-size="14.00" fill="#666666">[CHAR(36)]</text>
75
+ <text text-anchor="start" x="193.36" y="-583" font-family="Arial" font-size="14.00"> 소속 revision 식별자</text>
76
+ <polygon fill="none" stroke="black" points="43.2,-540 43.2,-570.8 327.15,-570.8 327.15,-540 43.2,-540"/>
77
+ <text text-anchor="start" x="50.2" y="-552.2" font-family="Arial" font-size="14.00">document_id </text>
78
+ <text text-anchor="start" x="134.25" y="-552.2" font-family="Arial" font-size="14.00" fill="#666666">[CHAR(36)]</text>
79
+ <text text-anchor="start" x="206.6" y="-552.2" font-family="Arial" font-size="14.00"> 소속 문서 식별자</text>
80
+ </g>
81
+ <!-- document_change_events&#45;&gt;document_revisions -->
82
+ <g id="edge1" class="edge">
83
+ <title>document_change_events:revision_id&#45;&gt;document_revisions:revision_id</title>
84
+ <path fill="none" stroke="black" d="M338.23,-584.62C364.58,-575.15 348.97,-525.26 327.15,-496.8 291.17,-449.86 234.97,-507.78 199.03,-460.8 169.97,-422.82 150.21,-353.2 198.03,-353.2"/>
85
+ <polygon fill="black" stroke="black" points="338.36,-584.6 327.79,-581.7 333.09,-585.43 328.81,-586.1 328.81,-586.1 328.81,-586.1 333.09,-585.43 329.18,-590.59 338.36,-584.6"/>
86
+ </g>
87
+ <!-- document_versions -->
88
+ <g id="node3" class="node">
89
+ <title>document_versions</title>
90
+ <polygon fill="#efefef" stroke="none" points="431.47,-632.4 431.47,-678.4 706.88,-678.4 706.88,-632.4 431.47,-632.4"/>
91
+ <polygon fill="none" stroke="black" points="431.47,-632.4 431.47,-678.4 706.88,-678.4 706.88,-632.4 431.47,-632.4"/>
92
+ <text text-anchor="start" x="464.56" y="-656.2" font-family="Arial Bold" font-size="18.00">document_versions</text>
93
+ <text text-anchor="start" x="604.54" y="-656.2" font-family="Arial" font-size="14.00">    </text>
94
+ <text text-anchor="start" x="635.65" y="-656.2" font-family="Arial" font-size="14.00" fill="#666666">[table]</text>
95
+ <text text-anchor="start" x="447.41" y="-641.8" font-family="Arial" font-size="14.00" fill="#333333">검토/승인/배포 기준본 snapshot을 관리한다.</text>
96
+ <polygon fill="none" stroke="black" points="431.47,-601.6 431.47,-632.4 706.88,-632.4 706.88,-601.6 431.47,-601.6"/>
97
+ <text text-anchor="start" x="438.47" y="-613.8" font-family="Arial" font-size="14.00">version_id </text>
98
+ <text text-anchor="start" x="506.17" y="-613.8" font-family="Arial" font-size="14.00" fill="#666666">[CHAR(36)]</text>
99
+ <text text-anchor="start" x="578.52" y="-613.8" font-family="Arial" font-size="14.00"> version 식별자</text>
100
+ <polygon fill="none" stroke="black" points="431.47,-570.8 431.47,-601.6 706.88,-601.6 706.88,-570.8 431.47,-570.8"/>
101
+ <text text-anchor="start" x="438.47" y="-583" font-family="Arial" font-size="14.00">document_id </text>
102
+ <text text-anchor="start" x="522.52" y="-583" font-family="Arial" font-size="14.00" fill="#666666">[CHAR(36)]</text>
103
+ <text text-anchor="start" x="594.87" y="-583" font-family="Arial" font-size="14.00"> 소속 문서 식별자</text>
104
+ <polygon fill="none" stroke="black" points="431.47,-540 431.47,-570.8 706.88,-570.8 706.88,-540 431.47,-540"/>
105
+ <text text-anchor="start" x="438.47" y="-552.2" font-family="Arial" font-size="14.00">revision_id </text>
106
+ <text text-anchor="start" x="509.28" y="-552.2" font-family="Arial" font-size="14.00" fill="#666666">[CHAR(36)]</text>
107
+ <text text-anchor="start" x="581.63" y="-552.2" font-family="Arial" font-size="14.00"> 기준 revision 식별자</text>
108
+ </g>
109
+ <!-- document_versions&#45;&gt;document_revisions -->
110
+ <g id="edge2" class="edge">
111
+ <title>document_versions:revision_id&#45;&gt;document_revisions:revision_id</title>
112
+ <path fill="none" stroke="black" d="M420.51,-552.58C408.23,-543.43 418.25,-514.1 431.47,-496.8 466.27,-451.25 520.69,-506.48 555.32,-460.8 584.21,-422.69 604.14,-353.2 556.32,-353.2"/>
113
+ <polygon fill="black" stroke="black" points="420.53,-552.59 428.92,-559.64 425.66,-554.04 429.83,-555.22 429.83,-555.22 429.83,-555.22 425.66,-554.04 431.37,-550.98 420.53,-552.59"/>
114
+ </g>
115
+ </g>
116
+ </svg>
@@ -0,0 +1,126 @@
1
+ # document_versions
2
+
3
+ ## Description
4
+
5
+ 검토/승인/배포 기준본 snapshot을 관리한다.
6
+
7
+ <details>
8
+ <summary><strong>Table Definition</strong></summary>
9
+
10
+ ```sql
11
+ CREATE TABLE document_versions (
12
+ -- version 식별자
13
+ version_id CHAR(36) PRIMARY KEY
14
+ CHECK (length(version_id) = 36),
15
+
16
+ -- 소속 문서 식별자
17
+ document_id CHAR(36) NOT NULL
18
+ CHECK (length(document_id) = 36),
19
+
20
+ -- 기준 revision 식별자
21
+ revision_id CHAR(36) NOT NULL
22
+ CHECK (length(revision_id) = 36),
23
+
24
+ -- 문서별 version 순번
25
+ version_no INTEGER NOT NULL
26
+ CHECK (version_no >= 1),
27
+
28
+ -- 표시 버전
29
+ version_label VARCHAR(64),
30
+
31
+ -- snapshot 유형
32
+ snapshot_type_code VARCHAR(32) NOT NULL
33
+ CHECK (snapshot_type_code IN ('review', 'approval', 'publication', 'manual')),
34
+
35
+ -- snapshot 당시 문서 상태
36
+ document_status_code VARCHAR(32) NOT NULL
37
+ CHECK (document_status_code IN ('in_review', 'approved', 'published', 'archived')),
38
+
39
+ -- 작은 snapshot 또는 manifest
40
+ snapshot_json JSON
41
+ CHECK (snapshot_json IS NULL OR json_valid(snapshot_json)),
42
+
43
+ -- snapshot checksum
44
+ checksum CHAR(64)
45
+ CHECK (checksum IS NULL OR length(checksum) = 64),
46
+
47
+ -- 생성자 유형
48
+ created_by_type_code VARCHAR(32) NOT NULL DEFAULT 'user'
49
+ CHECK (created_by_type_code IN ('user', 'agent', 'system')),
50
+
51
+ -- 생성자 식별자
52
+ created_by_id VARCHAR(128),
53
+
54
+ -- 생성자 표시명
55
+ created_by_name VARCHAR(128),
56
+
57
+ -- 생성 시각
58
+ created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
59
+
60
+ FOREIGN KEY (document_id)
61
+ REFERENCES document_documents (document_id)
62
+ ON DELETE CASCADE,
63
+
64
+ FOREIGN KEY (revision_id)
65
+ REFERENCES document_revisions (revision_id)
66
+ ON DELETE CASCADE,
67
+
68
+ UNIQUE (document_id, version_no)
69
+ )
70
+ ```
71
+
72
+ </details>
73
+
74
+ ## Columns
75
+
76
+ | Name | Type | Default | Nullable | Parents | Comment |
77
+ | -------------------- | ------------ | ----------------- | -------- | ------------------------------------------- | --------------------------- |
78
+ | version_id | CHAR(36) | | true | | version 식별자 |
79
+ | document_id | CHAR(36) | | false | [document_documents](document_documents.md) | 소속 문서 식별자 |
80
+ | revision_id | CHAR(36) | | false | [document_revisions](document_revisions.md) | 기준 revision 식별자 |
81
+ | version_no | INTEGER | | false | | 문서별 version 순번 |
82
+ | version_label | VARCHAR(64) | | true | | 표시 버전 |
83
+ | snapshot_type_code | VARCHAR(32) | | false | | snapshot 유형 |
84
+ | document_status_code | VARCHAR(32) | | false | | snapshot 당시 문서 상태 |
85
+ | snapshot_json | JSON | | true | | 작은 snapshot 또는 manifest |
86
+ | checksum | CHAR(64) | | true | | snapshot checksum |
87
+ | created_by_type_code | VARCHAR(32) | 'user' | false | | 생성자 유형 |
88
+ | created_by_id | VARCHAR(128) | | true | | 생성자 식별자 |
89
+ | created_by_name | VARCHAR(128) | | true | | 생성자 표시명 |
90
+ | created_at | DATETIME | CURRENT_TIMESTAMP | false | | 생성 시각 |
91
+
92
+ ## Constraints
93
+
94
+ | Name | Type | Definition |
95
+ | ------------------------------------ | ----------- | ---------------------------------------------------------------------------------------------------------------------- |
96
+ | version_id | PRIMARY KEY | PRIMARY KEY (version_id) |
97
+ | - (Foreign key ID: 0) | FOREIGN KEY | FOREIGN KEY (revision_id) REFERENCES document_revisions (revision_id) ON UPDATE NO ACTION ON DELETE CASCADE MATCH NONE |
98
+ | - (Foreign key ID: 1) | FOREIGN KEY | FOREIGN KEY (document_id) REFERENCES document_documents (document_id) ON UPDATE NO ACTION ON DELETE CASCADE MATCH NONE |
99
+ | sqlite_autoindex_document_versions_2 | UNIQUE | UNIQUE (document_id, version_no) |
100
+ | sqlite_autoindex_document_versions_1 | PRIMARY KEY | PRIMARY KEY (version_id) |
101
+ | - | CHECK | CHECK (length(version_id) = 36) |
102
+ | - | CHECK | CHECK (length(document_id) = 36) |
103
+ | - | CHECK | CHECK (length(revision_id) = 36) |
104
+ | - | CHECK | CHECK (version_no >= 1) |
105
+ | - | CHECK | CHECK (snapshot_type_code IN ('review', 'approval', 'publication', 'manual')) |
106
+ | - | CHECK | CHECK (document_status_code IN ('in_review', 'approved', 'published', 'archived')) |
107
+ | - | CHECK | CHECK (snapshot_json IS NULL OR json_valid(snapshot_json)) |
108
+ | - | CHECK | CHECK (checksum IS NULL OR length(checksum) = 64) |
109
+ | - | CHECK | CHECK (created_by_type_code IN ('user', 'agent', 'system')) |
110
+
111
+ ## Indexes
112
+
113
+ | Name | Definition |
114
+ | ------------------------------------ | ----------------------------------------------------------------------------------------------------- |
115
+ | idx_document_versions_type | CREATE INDEX idx_document_versions_type<br /> ON document_versions (document_id, snapshot_type_code) |
116
+ | idx_document_versions_revision | CREATE INDEX idx_document_versions_revision<br /> ON document_versions (revision_id) |
117
+ | sqlite_autoindex_document_versions_2 | UNIQUE (document_id, version_no) |
118
+ | sqlite_autoindex_document_versions_1 | PRIMARY KEY (version_id) |
119
+
120
+ ## Relations
121
+
122
+ ![er](document_versions.svg)
123
+
124
+ ---
125
+
126
+ > Generated by [tbls](https://github.com/k1LoW/tbls)