@lyku/lockstep-pg 1.3.1 → 1.5.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/README.md +1 -59
- package/package.json +31 -31
- package/pipeline.svg +1 -0
- package/src/buildTableIndexCommand.d.ts.map +1 -1
- package/src/buildTableIndexCommand.js +21 -6
- package/src/buildTableIndexCommand.js.map +1 -1
- package/src/buildTableTriggerCommands.d.ts +13 -1
- package/src/buildTableTriggerCommands.d.ts.map +1 -1
- package/src/buildTableTriggerCommands.js +33 -14
- package/src/buildTableTriggerCommands.js.map +1 -1
- package/src/createTable.d.ts.map +1 -1
- package/src/createTable.js +16 -2
- package/src/createTable.js.map +1 -1
- package/src/dateToPostgresString.js +2 -2
- package/src/dateToPostgresString.js.map +1 -1
- package/src/diff.d.ts +12 -0
- package/src/diff.d.ts.map +1 -1
- package/src/diff.js +113 -6
- package/src/diff.js.map +1 -1
- package/src/drift.d.ts +8 -11
- package/src/drift.d.ts.map +1 -1
- package/src/drift.js +1 -298
- package/src/drift.js.map +1 -1
- package/src/form.d.ts.map +1 -1
- package/src/form.js +43 -2
- package/src/form.js.map +1 -1
- package/src/generateSql.d.ts.map +1 -1
- package/src/generateSql.js +69 -8
- package/src/generateSql.js.map +1 -1
- package/src/index.d.ts +3 -3
- package/src/index.d.ts.map +1 -1
- package/src/index.js +2 -4
- package/src/index.js.map +1 -1
- package/src/introspect.d.ts +12 -0
- package/src/introspect.d.ts.map +1 -1
- package/src/introspect.js +195 -34
- package/src/introspect.js.map +1 -1
- package/src/mapColumnType.d.ts.map +1 -1
- package/src/mapColumnType.js +6 -0
- package/src/mapColumnType.js.map +1 -1
- package/src/mapSnowflakeType.d.ts +9 -0
- package/src/mapSnowflakeType.d.ts.map +1 -0
- package/src/mapSnowflakeType.js +19 -0
- package/src/mapSnowflakeType.js.map +1 -0
- package/src/migrate.d.ts +11 -9
- package/src/migrate.d.ts.map +1 -1
- package/src/migrate.js +28 -345
- package/src/migrate.js.map +1 -1
- package/src/seed.d.ts.map +1 -1
- package/src/seed.js +6 -1
- package/src/seed.js.map +1 -1
package/README.md
CHANGED
|
@@ -86,65 +86,7 @@ const sql = generateSeedSql({ tables });
|
|
|
86
86
|
|
|
87
87
|
<!-- Generated from libs/lockstep-core/diagrams/pipeline.mmd — do not edit manually -->
|
|
88
88
|
|
|
89
|
-
|
|
90
|
-
graph TD
|
|
91
|
-
input-tables["Table Schemas<br/><small>PostgresRecordModel</small>"]
|
|
92
|
-
input-api["API Definitions<br/><small>TsonHandlerModel</small>"]
|
|
93
|
-
|
|
94
|
-
core-jsonmodels["generateJsonModels"]
|
|
95
|
-
core-dbtypes["generateDbTypes"]
|
|
96
|
-
core-apitypes["generateApiTypes"]
|
|
97
|
-
core-validators["buildValidator"]
|
|
98
|
-
|
|
99
|
-
handles-gen["generateHandles"]
|
|
100
|
-
|
|
101
|
-
client-gen["generateTsClient"]
|
|
102
|
-
|
|
103
|
-
pg-drift["detectDrift"]
|
|
104
|
-
pg-migrate["generateMigration"]
|
|
105
|
-
|
|
106
|
-
output-jsonschemas["JSON Schemas +<br/>TypeScript Types"]
|
|
107
|
-
output-kysely["Kysely Database<br/>Interface"]
|
|
108
|
-
output-reqres["Request / Response<br/>TypeScript Types"]
|
|
109
|
-
output-handlers["Handler Factories<br/>+ Validators"]
|
|
110
|
-
output-client["Type-safe<br/>HTTP Client"]
|
|
111
|
-
output-sql["SQL Migrations"]
|
|
112
|
-
|
|
113
|
-
input-tables --> core-jsonmodels
|
|
114
|
-
core-jsonmodels --> output-jsonschemas
|
|
115
|
-
output-jsonschemas --> core-dbtypes
|
|
116
|
-
core-dbtypes --> output-kysely
|
|
117
|
-
|
|
118
|
-
input-api --> core-apitypes
|
|
119
|
-
core-apitypes --> output-reqres
|
|
120
|
-
input-api --> core-validators
|
|
121
|
-
|
|
122
|
-
output-reqres --> handles-gen
|
|
123
|
-
input-api --> handles-gen
|
|
124
|
-
core-validators -.-> handles-gen
|
|
125
|
-
handles-gen --> output-handlers
|
|
126
|
-
|
|
127
|
-
output-reqres --> client-gen
|
|
128
|
-
input-api --> client-gen
|
|
129
|
-
client-gen --> output-client
|
|
130
|
-
|
|
131
|
-
input-tables --> pg-drift
|
|
132
|
-
pg-drift --> pg-migrate
|
|
133
|
-
pg-migrate --> output-sql
|
|
134
|
-
|
|
135
|
-
classDef highlight fill:#4f46e5,stroke:#3730a3,color:#fff,stroke-width:2px
|
|
136
|
-
classDef dimmed fill:#f1f5f9,stroke:#cbd5e1,color:#94a3b8,stroke-width:1px
|
|
137
|
-
classDef inputNode fill:#fef3c7,stroke:#f59e0b,color:#92400e,stroke-width:1px
|
|
138
|
-
classDef outputNode fill:#d1fae5,stroke:#10b981,color:#065f46,stroke-width:1px
|
|
139
|
-
classDef ownedOutput fill:#a5b4fc,stroke:#4f46e5,color:#1e1b4b,stroke-width:2px
|
|
140
|
-
classDef ownedInput fill:#fde68a,stroke:#4f46e5,color:#1e1b4b,stroke-width:2px
|
|
141
|
-
class pg-drift,pg-migrate highlight
|
|
142
|
-
class core-jsonmodels,core-dbtypes,core-apitypes,core-validators,handles-gen,client-gen dimmed
|
|
143
|
-
class input-api inputNode
|
|
144
|
-
class output-jsonschemas,output-kysely,output-reqres,output-handlers,output-client outputNode
|
|
145
|
-
class input-tables ownedInput
|
|
146
|
-
class output-sql ownedOutput
|
|
147
|
-
```
|
|
89
|
+
<p align="center"><img src="./pipeline.svg" alt="lockstep-pg pipeline diagram" /></p>
|
|
148
90
|
|
|
149
91
|
## Drift types
|
|
150
92
|
|
package/package.json
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
2
|
+
"name": "@lyku/lockstep-pg",
|
|
3
|
+
"version": "1.5.0",
|
|
4
|
+
"description": "Schema-driven PostgreSQL migration toolkit: drift detection, introspection, and SQL generation for @lyku/lockstep-core models",
|
|
5
|
+
"main": "./src/index.js",
|
|
6
|
+
"types": "./src/index.d.ts",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"license": "GPL-3.0",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./src/index.d.ts",
|
|
12
|
+
"import": "./src/index.js",
|
|
13
|
+
"default": "./src/index.js"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"peerDependencies": {
|
|
17
|
+
"@lyku/lockstep-core": ">=0.2.0"
|
|
18
|
+
},
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"pg": "^8.0.0"
|
|
21
|
+
},
|
|
22
|
+
"keywords": [
|
|
23
|
+
"postgresql",
|
|
24
|
+
"migration",
|
|
25
|
+
"schema",
|
|
26
|
+
"drift",
|
|
27
|
+
"introspection",
|
|
28
|
+
"lockstep",
|
|
29
|
+
"lockstep-core"
|
|
30
|
+
],
|
|
31
|
+
"module": "./src/index.js"
|
|
32
|
+
}
|
package/pipeline.svg
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg id="my-svg" width="100%" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" class="flowchart" style="max-width: 1035.32px; background-color: transparent;" viewBox="0 0 1035.3203125 558" role="graphics-document document" aria-roledescription="flowchart-v2"><style>#my-svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#my-svg .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#my-svg .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#my-svg .error-icon{fill:#552222;}#my-svg .error-text{fill:#552222;stroke:#552222;}#my-svg .edge-thickness-normal{stroke-width:1px;}#my-svg .edge-thickness-thick{stroke-width:3.5px;}#my-svg .edge-pattern-solid{stroke-dasharray:0;}#my-svg .edge-thickness-invisible{stroke-width:0;fill:none;}#my-svg .edge-pattern-dashed{stroke-dasharray:3;}#my-svg .edge-pattern-dotted{stroke-dasharray:2;}#my-svg .marker{fill:#333333;stroke:#333333;}#my-svg .marker.cross{stroke:#333333;}#my-svg svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#my-svg p{margin:0;}#my-svg .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#my-svg .cluster-label text{fill:#333;}#my-svg .cluster-label span{color:#333;}#my-svg .cluster-label span p{background-color:transparent;}#my-svg .label text,#my-svg span{fill:#333;color:#333;}#my-svg .node rect,#my-svg .node circle,#my-svg .node ellipse,#my-svg .node polygon,#my-svg .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#my-svg .rough-node .label text,#my-svg .node .label text,#my-svg .image-shape .label,#my-svg .icon-shape .label{text-anchor:middle;}#my-svg .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#my-svg .rough-node .label,#my-svg .node .label,#my-svg .image-shape .label,#my-svg .icon-shape .label{text-align:center;}#my-svg .node.clickable{cursor:pointer;}#my-svg .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#my-svg .arrowheadPath{fill:#333333;}#my-svg .edgePath .path{stroke:#333333;stroke-width:2.0px;}#my-svg .flowchart-link{stroke:#333333;fill:none;}#my-svg .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#my-svg .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#my-svg .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#my-svg .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#my-svg .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#my-svg .cluster text{fill:#333;}#my-svg .cluster span{color:#333;}#my-svg div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#my-svg .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#my-svg rect.text{fill:none;stroke-width:0;}#my-svg .icon-shape,#my-svg .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#my-svg .icon-shape p,#my-svg .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#my-svg .icon-shape .label rect,#my-svg .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#my-svg .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#my-svg .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#my-svg :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;}#my-svg .highlight>*{fill:#4f46e5!important;stroke:#3730a3!important;color:#fff!important;stroke-width:2px!important;}#my-svg .highlight span{fill:#4f46e5!important;stroke:#3730a3!important;color:#fff!important;stroke-width:2px!important;}#my-svg .highlight tspan{fill:#fff!important;}#my-svg .dimmed>*{fill:#f1f5f9!important;stroke:#cbd5e1!important;color:#94a3b8!important;stroke-width:1px!important;}#my-svg .dimmed span{fill:#f1f5f9!important;stroke:#cbd5e1!important;color:#94a3b8!important;stroke-width:1px!important;}#my-svg .dimmed tspan{fill:#94a3b8!important;}#my-svg .inputNode>*{fill:#fef3c7!important;stroke:#f59e0b!important;color:#92400e!important;stroke-width:1px!important;}#my-svg .inputNode span{fill:#fef3c7!important;stroke:#f59e0b!important;color:#92400e!important;stroke-width:1px!important;}#my-svg .inputNode tspan{fill:#92400e!important;}#my-svg .outputNode>*{fill:#d1fae5!important;stroke:#10b981!important;color:#065f46!important;stroke-width:1px!important;}#my-svg .outputNode span{fill:#d1fae5!important;stroke:#10b981!important;color:#065f46!important;stroke-width:1px!important;}#my-svg .outputNode tspan{fill:#065f46!important;}#my-svg .ownedOutput>*{fill:#a5b4fc!important;stroke:#4f46e5!important;color:#1e1b4b!important;stroke-width:2px!important;}#my-svg .ownedOutput span{fill:#a5b4fc!important;stroke:#4f46e5!important;color:#1e1b4b!important;stroke-width:2px!important;}#my-svg .ownedOutput tspan{fill:#1e1b4b!important;}#my-svg .ownedInput>*{fill:#fde68a!important;stroke:#4f46e5!important;color:#1e1b4b!important;stroke-width:2px!important;}#my-svg .ownedInput span{fill:#fde68a!important;stroke:#4f46e5!important;color:#1e1b4b!important;stroke-width:2px!important;}#my-svg .ownedInput tspan{fill:#1e1b4b!important;}</style><g><marker id="my-svg_flowchart-v2-pointEnd" class="marker flowchart-v2" viewBox="0 0 10 10" refX="5" refY="5" markerUnits="userSpaceOnUse" markerWidth="8" markerHeight="8" orient="auto"><path d="M 0 0 L 10 5 L 0 10 z" class="arrowMarkerPath" style="stroke-width: 1; stroke-dasharray: 1, 0;"/></marker><marker id="my-svg_flowchart-v2-pointStart" class="marker flowchart-v2" viewBox="0 0 10 10" refX="4.5" refY="5" markerUnits="userSpaceOnUse" markerWidth="8" markerHeight="8" orient="auto"><path d="M 0 5 L 10 10 L 10 0 z" class="arrowMarkerPath" style="stroke-width: 1; stroke-dasharray: 1, 0;"/></marker><marker id="my-svg_flowchart-v2-circleEnd" class="marker flowchart-v2" viewBox="0 0 10 10" refX="11" refY="5" markerUnits="userSpaceOnUse" markerWidth="11" markerHeight="11" orient="auto"><circle cx="5" cy="5" r="5" class="arrowMarkerPath" style="stroke-width: 1; stroke-dasharray: 1, 0;"/></marker><marker id="my-svg_flowchart-v2-circleStart" class="marker flowchart-v2" viewBox="0 0 10 10" refX="-1" refY="5" markerUnits="userSpaceOnUse" markerWidth="11" markerHeight="11" orient="auto"><circle cx="5" cy="5" r="5" class="arrowMarkerPath" style="stroke-width: 1; stroke-dasharray: 1, 0;"/></marker><marker id="my-svg_flowchart-v2-crossEnd" class="marker cross flowchart-v2" viewBox="0 0 11 11" refX="12" refY="5.2" markerUnits="userSpaceOnUse" markerWidth="11" markerHeight="11" orient="auto"><path d="M 1,1 l 9,9 M 10,1 l -9,9" class="arrowMarkerPath" style="stroke-width: 2; stroke-dasharray: 1, 0;"/></marker><marker id="my-svg_flowchart-v2-crossStart" class="marker cross flowchart-v2" viewBox="0 0 11 11" refX="-1" refY="5.2" markerUnits="userSpaceOnUse" markerWidth="11" markerHeight="11" orient="auto"><path d="M 1,1 l 9,9 M 10,1 l -9,9" class="arrowMarkerPath" style="stroke-width: 2; stroke-dasharray: 1, 0;"/></marker><g class="root"><g class="clusters"/><g class="edgePaths"><path d="M744.994,86L736.586,90.167C728.178,94.333,711.363,102.667,702.955,110.333C694.547,118,694.547,125,694.547,128.5L694.547,132" id="L_input-tables_core-jsonmodels_0" class="edge-thickness-normal edge-pattern-solid edge-thickness-normal edge-pattern-solid flowchart-link" style=";" data-edge="true" data-et="edge" data-id="L_input-tables_core-jsonmodels_0" data-points="W3sieCI6NzQ0Ljk5Mzk1NzUxOTUzMTIsInkiOjg2fSx7IngiOjY5NC41NDY4NzUsInkiOjExMX0seyJ4Ijo2OTQuNTQ2ODc1LCJ5IjoxMzZ9XQ==" marker-end="url(#my-svg_flowchart-v2-pointEnd)"/><path d="M694.547,190L694.547,194.167C694.547,198.333,694.547,206.667,694.547,214.333C694.547,222,694.547,229,694.547,232.5L694.547,236" id="L_core-jsonmodels_output-jsonschemas_0" class="edge-thickness-normal edge-pattern-solid edge-thickness-normal edge-pattern-solid flowchart-link" style=";" data-edge="true" data-et="edge" data-id="L_core-jsonmodels_output-jsonschemas_0" data-points="W3sieCI6Njk0LjU0Njg3NSwieSI6MTkwfSx7IngiOjY5NC41NDY4NzUsInkiOjIxNX0seyJ4Ijo2OTQuNTQ2ODc1LCJ5IjoyNDB9XQ==" marker-end="url(#my-svg_flowchart-v2-pointEnd)"/><path d="M694.547,318L694.547,322.167C694.547,326.333,694.547,334.667,694.547,342.333C694.547,350,694.547,357,694.547,360.5L694.547,364" id="L_output-jsonschemas_core-dbtypes_0" class="edge-thickness-normal edge-pattern-solid edge-thickness-normal edge-pattern-solid flowchart-link" style=";" data-edge="true" data-et="edge" data-id="L_output-jsonschemas_core-dbtypes_0" data-points="W3sieCI6Njk0LjU0Njg3NSwieSI6MzE4fSx7IngiOjY5NC41NDY4NzUsInkiOjM0M30seyJ4Ijo2OTQuNTQ2ODc1LCJ5IjozNjh9XQ==" marker-end="url(#my-svg_flowchart-v2-pointEnd)"/><path d="M694.547,422L694.547,426.167C694.547,430.333,694.547,438.667,694.547,446.333C694.547,454,694.547,461,694.547,464.5L694.547,468" id="L_core-dbtypes_output-kysely_0" class="edge-thickness-normal edge-pattern-solid edge-thickness-normal edge-pattern-solid flowchart-link" style=";" data-edge="true" data-et="edge" data-id="L_core-dbtypes_output-kysely_0" data-points="W3sieCI6Njk0LjU0Njg3NSwieSI6NDIyfSx7IngiOjY5NC41NDY4NzUsInkiOjQ0N30seyJ4Ijo2OTQuNTQ2ODc1LCJ5Ijo0NzJ9XQ==" marker-end="url(#my-svg_flowchart-v2-pointEnd)"/><path d="M219.156,75.195L201.046,81.163C182.935,87.13,146.714,99.065,128.603,108.533C110.492,118,110.492,125,110.492,128.5L110.492,132" id="L_input-api_core-apitypes_0" class="edge-thickness-normal edge-pattern-solid edge-thickness-normal edge-pattern-solid flowchart-link" style=";" data-edge="true" data-et="edge" data-id="L_input-api_core-apitypes_0" data-points="W3sieCI6MjE5LjE1NjI1LCJ5Ijo3NS4xOTUzMTgxNTYyMjIzNH0seyJ4IjoxMTAuNDkyMTg3NSwieSI6MTExfSx7IngiOjExMC40OTIxODc1LCJ5IjoxMzZ9XQ==" marker-end="url(#my-svg_flowchart-v2-pointEnd)"/><path d="M110.492,190L110.492,194.167C110.492,198.333,110.492,206.667,110.492,214.333C110.492,222,110.492,229,110.492,232.5L110.492,236" id="L_core-apitypes_output-reqres_0" class="edge-thickness-normal edge-pattern-solid edge-thickness-normal edge-pattern-solid flowchart-link" style=";" data-edge="true" data-et="edge" data-id="L_core-apitypes_output-reqres_0" data-points="W3sieCI6MTEwLjQ5MjE4NzUsInkiOjE5MH0seyJ4IjoxMTAuNDkyMTg3NSwieSI6MjE1fSx7IngiOjExMC40OTIxODc1LCJ5IjoyNDB9XQ==" marker-end="url(#my-svg_flowchart-v2-pointEnd)"/><path d="M390.297,79.572L404.057,84.81C417.818,90.048,445.339,100.524,459.099,114.429C472.859,128.333,472.859,145.667,472.859,163C472.859,180.333,472.859,197.667,472.859,211.833C472.859,226,472.859,237,472.859,242.5L472.859,248" id="L_input-api_core-validators_0" class="edge-thickness-normal edge-pattern-solid edge-thickness-normal edge-pattern-solid flowchart-link" style=";" data-edge="true" data-et="edge" data-id="L_input-api_core-validators_0" data-points="W3sieCI6MzkwLjI5Njg3NSwieSI6NzkuNTcyNDY0MTA0ODI3ODR9LHsieCI6NDcyLjg1OTM3NSwieSI6MTExfSx7IngiOjQ3Mi44NTkzNzUsInkiOjE2M30seyJ4Ijo0NzIuODU5Mzc1LCJ5IjoyMTV9LHsieCI6NDcyLjg1OTM3NSwieSI6MjUyfV0=" marker-end="url(#my-svg_flowchart-v2-pointEnd)"/><path d="M212.984,314.604L226.608,319.337C240.232,324.069,267.479,333.535,285.81,342.019C304.141,350.502,313.555,358.005,318.262,361.756L322.969,365.507" id="L_output-reqres_handles-gen_0" class="edge-thickness-normal edge-pattern-solid edge-thickness-normal edge-pattern-solid flowchart-link" style=";" data-edge="true" data-et="edge" data-id="L_output-reqres_handles-gen_0" data-points="W3sieCI6MjEyLjk4NDM3NSwieSI6MzE0LjYwNDEwNDgyNTcxNDU2fSx7IngiOjI5NC43MjY1NjI1LCJ5IjozNDN9LHsieCI6MzI2LjA5Njc1NDgwNzY5MjMsInkiOjM2OH1d" marker-end="url(#my-svg_flowchart-v2-pointEnd)"/><path d="M338.395,86L341.992,90.167C345.589,94.333,352.783,102.667,356.38,115.5C359.977,128.333,359.977,145.667,359.977,163C359.977,180.333,359.977,197.667,359.977,217C359.977,236.333,359.977,257.667,359.977,279C359.977,300.333,359.977,321.667,359.977,335.833C359.977,350,359.977,357,359.977,360.5L359.977,364" id="L_input-api_handles-gen_0" class="edge-thickness-normal edge-pattern-solid edge-thickness-normal edge-pattern-solid flowchart-link" style=";" data-edge="true" data-et="edge" data-id="L_input-api_handles-gen_0" data-points="W3sieCI6MzM4LjM5NDUzMTI1LCJ5Ijo4Nn0seyJ4IjozNTkuOTc2NTYyNSwieSI6MTExfSx7IngiOjM1OS45NzY1NjI1LCJ5IjoxNjN9LHsieCI6MzU5Ljk3NjU2MjUsInkiOjIxNX0seyJ4IjozNTkuOTc2NTYyNSwieSI6Mjc5fSx7IngiOjM1OS45NzY1NjI1LCJ5IjozNDN9LHsieCI6MzU5Ljk3NjU2MjUsInkiOjM2OH1d" marker-end="url(#my-svg_flowchart-v2-pointEnd)"/><path d="M472.859,306L472.859,312.167C472.859,318.333,472.859,330.667,464.42,340.721C455.98,350.775,439.101,358.551,430.661,362.439L422.222,366.326" id="L_core-validators_handles-gen_0" class="edge-thickness-normal edge-pattern-dotted edge-thickness-normal edge-pattern-solid flowchart-link" style=";" data-edge="true" data-et="edge" data-id="L_core-validators_handles-gen_0" data-points="W3sieCI6NDcyLjg1OTM3NSwieSI6MzA2fSx7IngiOjQ3Mi44NTkzNzUsInkiOjM0M30seyJ4Ijo0MTguNTg4NzkyMDY3MzA3NywieSI6MzY4fV0=" marker-end="url(#my-svg_flowchart-v2-pointEnd)"/><path d="M359.977,422L359.977,426.167C359.977,430.333,359.977,438.667,359.977,446.333C359.977,454,359.977,461,359.977,464.5L359.977,468" id="L_handles-gen_output-handlers_0" class="edge-thickness-normal edge-pattern-solid edge-thickness-normal edge-pattern-solid flowchart-link" style=";" data-edge="true" data-et="edge" data-id="L_handles-gen_output-handlers_0" data-points="W3sieCI6MzU5Ljk3NjU2MjUsInkiOjQyMn0seyJ4IjozNTkuOTc2NTYyNSwieSI6NDQ3fSx7IngiOjM1OS45NzY1NjI1LCJ5Ijo0NzJ9XQ==" marker-end="url(#my-svg_flowchart-v2-pointEnd)"/><path d="M110.492,318L110.492,322.167C110.492,326.333,110.492,334.667,111.752,342.372C113.011,350.077,115.53,357.154,116.789,360.693L118.049,364.232" id="L_output-reqres_client-gen_0" class="edge-thickness-normal edge-pattern-solid edge-thickness-normal edge-pattern-solid flowchart-link" style=";" data-edge="true" data-et="edge" data-id="L_output-reqres_client-gen_0" data-points="W3sieCI6MTEwLjQ5MjE4NzUsInkiOjMxOH0seyJ4IjoxMTAuNDkyMTg3NSwieSI6MzQzfSx7IngiOjExOS4zOTAxNzQyNzg4NDYxNiwieSI6MzY4fV0=" marker-end="url(#my-svg_flowchart-v2-pointEnd)"/><path d="M286.445,86L284.492,90.167C282.539,94.333,278.633,102.667,276.68,115.5C274.727,128.333,274.727,145.667,274.727,163C274.727,180.333,274.727,197.667,274.727,217C274.727,236.333,274.727,257.667,274.727,279C274.727,300.333,274.727,321.667,263.678,336.276C252.629,350.885,230.531,358.77,219.482,362.713L208.433,366.656" id="L_input-api_client-gen_0" class="edge-thickness-normal edge-pattern-solid edge-thickness-normal edge-pattern-solid flowchart-link" style=";" data-edge="true" data-et="edge" data-id="L_input-api_client-gen_0" data-points="W3sieCI6Mjg2LjQ0NTMxMjUsInkiOjg2fSx7IngiOjI3NC43MjY1NjI1LCJ5IjoxMTF9LHsieCI6Mjc0LjcyNjU2MjUsInkiOjE2M30seyJ4IjoyNzQuNzI2NTYyNSwieSI6MjE1fSx7IngiOjI3NC43MjY1NjI1LCJ5IjoyNzl9LHsieCI6Mjc0LjcyNjU2MjUsInkiOjM0M30seyJ4IjoyMDQuNjY1NzE1MTQ0MjMwNzcsInkiOjM2OH1d" marker-end="url(#my-svg_flowchart-v2-pointEnd)"/><path d="M129,422L129,426.167C129,430.333,129,438.667,129,446.333C129,454,129,461,129,464.5L129,468" id="L_client-gen_output-client_0" class="edge-thickness-normal edge-pattern-solid edge-thickness-normal edge-pattern-solid flowchart-link" style=";" data-edge="true" data-et="edge" data-id="L_client-gen_output-client_0" data-points="W3sieCI6MTI5LCJ5Ijo0MjJ9LHsieCI6MTI5LCJ5Ijo0NDd9LHsieCI6MTI5LCJ5Ijo0NzJ9XQ==" marker-end="url(#my-svg_flowchart-v2-pointEnd)"/><path d="M890.201,86L897.307,90.167C904.413,94.333,918.624,102.667,925.73,110.333C932.836,118,932.836,125,932.836,128.5L932.836,132" id="L_input-tables_pg-drift_0" class="edge-thickness-normal edge-pattern-solid edge-thickness-normal edge-pattern-solid flowchart-link" style=";" data-edge="true" data-et="edge" data-id="L_input-tables_pg-drift_0" data-points="W3sieCI6ODkwLjIwMTM1NDk4MDQ2ODgsInkiOjg2fSx7IngiOjkzMi44MzU5Mzc1LCJ5IjoxMTF9LHsieCI6OTMyLjgzNTkzNzUsInkiOjEzNn1d" marker-end="url(#my-svg_flowchart-v2-pointEnd)"/><path d="M932.836,190L932.836,194.167C932.836,198.333,932.836,206.667,932.836,216.333C932.836,226,932.836,237,932.836,242.5L932.836,248" id="L_pg-drift_pg-migrate_0" class="edge-thickness-normal edge-pattern-solid edge-thickness-normal edge-pattern-solid flowchart-link" style=";" data-edge="true" data-et="edge" data-id="L_pg-drift_pg-migrate_0" data-points="W3sieCI6OTMyLjgzNTkzNzUsInkiOjE5MH0seyJ4Ijo5MzIuODM1OTM3NSwieSI6MjE1fSx7IngiOjkzMi44MzU5Mzc1LCJ5IjoyNTJ9XQ==" marker-end="url(#my-svg_flowchart-v2-pointEnd)"/><path d="M932.836,306L932.836,312.167C932.836,318.333,932.836,330.667,932.836,340.333C932.836,350,932.836,357,932.836,360.5L932.836,364" id="L_pg-migrate_output-sql_0" class="edge-thickness-normal edge-pattern-solid edge-thickness-normal edge-pattern-solid flowchart-link" style=";" data-edge="true" data-et="edge" data-id="L_pg-migrate_output-sql_0" data-points="W3sieCI6OTMyLjgzNTkzNzUsInkiOjMwNn0seyJ4Ijo5MzIuODM1OTM3NSwieSI6MzQzfSx7IngiOjkzMi44MzU5Mzc1LCJ5IjozNjh9XQ==" marker-end="url(#my-svg_flowchart-v2-pointEnd)"/></g><g class="edgeLabels"><g class="edgeLabel"><g class="label" data-id="L_input-tables_core-jsonmodels_0" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" class="labelBkg" style="display: table-cell; white-space: nowrap; line-height: 1.5; max-width: 200px; text-align: center;"><span class="edgeLabel"></span></div></foreignObject></g></g><g class="edgeLabel"><g class="label" data-id="L_core-jsonmodels_output-jsonschemas_0" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" class="labelBkg" style="display: table-cell; white-space: nowrap; line-height: 1.5; max-width: 200px; text-align: center;"><span class="edgeLabel"></span></div></foreignObject></g></g><g class="edgeLabel"><g class="label" data-id="L_output-jsonschemas_core-dbtypes_0" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" class="labelBkg" style="display: table-cell; white-space: nowrap; line-height: 1.5; max-width: 200px; text-align: center;"><span class="edgeLabel"></span></div></foreignObject></g></g><g class="edgeLabel"><g class="label" data-id="L_core-dbtypes_output-kysely_0" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" class="labelBkg" style="display: table-cell; white-space: nowrap; line-height: 1.5; max-width: 200px; text-align: center;"><span class="edgeLabel"></span></div></foreignObject></g></g><g class="edgeLabel"><g class="label" data-id="L_input-api_core-apitypes_0" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" class="labelBkg" style="display: table-cell; white-space: nowrap; line-height: 1.5; max-width: 200px; text-align: center;"><span class="edgeLabel"></span></div></foreignObject></g></g><g class="edgeLabel"><g class="label" data-id="L_core-apitypes_output-reqres_0" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" class="labelBkg" style="display: table-cell; white-space: nowrap; line-height: 1.5; max-width: 200px; text-align: center;"><span class="edgeLabel"></span></div></foreignObject></g></g><g class="edgeLabel"><g class="label" data-id="L_input-api_core-validators_0" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" class="labelBkg" style="display: table-cell; white-space: nowrap; line-height: 1.5; max-width: 200px; text-align: center;"><span class="edgeLabel"></span></div></foreignObject></g></g><g class="edgeLabel"><g class="label" data-id="L_output-reqres_handles-gen_0" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" class="labelBkg" style="display: table-cell; white-space: nowrap; line-height: 1.5; max-width: 200px; text-align: center;"><span class="edgeLabel"></span></div></foreignObject></g></g><g class="edgeLabel"><g class="label" data-id="L_input-api_handles-gen_0" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" class="labelBkg" style="display: table-cell; white-space: nowrap; line-height: 1.5; max-width: 200px; text-align: center;"><span class="edgeLabel"></span></div></foreignObject></g></g><g class="edgeLabel"><g class="label" data-id="L_core-validators_handles-gen_0" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" class="labelBkg" style="display: table-cell; white-space: nowrap; line-height: 1.5; max-width: 200px; text-align: center;"><span class="edgeLabel"></span></div></foreignObject></g></g><g class="edgeLabel"><g class="label" data-id="L_handles-gen_output-handlers_0" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" class="labelBkg" style="display: table-cell; white-space: nowrap; line-height: 1.5; max-width: 200px; text-align: center;"><span class="edgeLabel"></span></div></foreignObject></g></g><g class="edgeLabel"><g class="label" data-id="L_output-reqres_client-gen_0" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" class="labelBkg" style="display: table-cell; white-space: nowrap; line-height: 1.5; max-width: 200px; text-align: center;"><span class="edgeLabel"></span></div></foreignObject></g></g><g class="edgeLabel"><g class="label" data-id="L_input-api_client-gen_0" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" class="labelBkg" style="display: table-cell; white-space: nowrap; line-height: 1.5; max-width: 200px; text-align: center;"><span class="edgeLabel"></span></div></foreignObject></g></g><g class="edgeLabel"><g class="label" data-id="L_client-gen_output-client_0" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" class="labelBkg" style="display: table-cell; white-space: nowrap; line-height: 1.5; max-width: 200px; text-align: center;"><span class="edgeLabel"></span></div></foreignObject></g></g><g class="edgeLabel"><g class="label" data-id="L_input-tables_pg-drift_0" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" class="labelBkg" style="display: table-cell; white-space: nowrap; line-height: 1.5; max-width: 200px; text-align: center;"><span class="edgeLabel"></span></div></foreignObject></g></g><g class="edgeLabel"><g class="label" data-id="L_pg-drift_pg-migrate_0" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" class="labelBkg" style="display: table-cell; white-space: nowrap; line-height: 1.5; max-width: 200px; text-align: center;"><span class="edgeLabel"></span></div></foreignObject></g></g><g class="edgeLabel"><g class="label" data-id="L_pg-migrate_output-sql_0" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" class="labelBkg" style="display: table-cell; white-space: nowrap; line-height: 1.5; max-width: 200px; text-align: center;"><span class="edgeLabel"></span></div></foreignObject></g></g></g><g class="nodes"><g class="node default ownedInput" id="flowchart-input-tables-0" transform="translate(823.69140625, 47)"><rect class="basic label-container" style="fill:#fde68a !important;stroke:#4f46e5 !important;stroke-width:2px !important" x="-95.9375" y="-39" width="191.875" height="78"/><g class="label" style="color:#1e1b4b !important" transform="translate(-65.9375, -24)"><rect/><foreignObject width="131.875" height="48"><div style="color: rgb(30, 27, 75) !important; display: table-cell; white-space: nowrap; line-height: 1.5; max-width: 200px; text-align: center;" xmlns="http://www.w3.org/1999/xhtml"><span style="color:#1e1b4b !important" class="nodeLabel"><p>Table Schemas<br /><small>PostgresRecordModel</small></p></span></div></foreignObject></g></g><g class="node default inputNode" id="flowchart-input-api-1" transform="translate(304.7265625, 47)"><rect class="basic label-container" style="fill:#fef3c7 !important;stroke:#f59e0b !important;stroke-width:1px !important" x="-85.5703125" y="-39" width="171.140625" height="78"/><g class="label" style="color:#92400e !important" transform="translate(-55.5703125, -24)"><rect/><foreignObject width="111.140625" height="48"><div style="color: rgb(146, 64, 14) !important; display: table-cell; white-space: nowrap; line-height: 1.5; max-width: 200px; text-align: center;" xmlns="http://www.w3.org/1999/xhtml"><span style="color:#92400e !important" class="nodeLabel"><p>API Definitions<br /><small>TsonHandlerModel</small></p></span></div></foreignObject></g></g><g class="node default dimmed" id="flowchart-core-jsonmodels-2" transform="translate(694.546875, 163)"><rect class="basic label-container" style="fill:#f1f5f9 !important;stroke:#cbd5e1 !important;stroke-width:1px !important" x="-104.2734375" y="-27" width="208.546875" height="54"/><g class="label" style="color:#94a3b8 !important" transform="translate(-74.2734375, -12)"><rect/><foreignObject width="148.546875" height="24"><div style="color: rgb(148, 163, 184) !important; display: table-cell; white-space: nowrap; line-height: 1.5; max-width: 200px; text-align: center;" xmlns="http://www.w3.org/1999/xhtml"><span style="color:#94a3b8 !important" class="nodeLabel"><p>generateJsonModels</p></span></div></foreignObject></g></g><g class="node default dimmed" id="flowchart-core-dbtypes-3" transform="translate(694.546875, 395)"><rect class="basic label-container" style="fill:#f1f5f9 !important;stroke:#cbd5e1 !important;stroke-width:1px !important" x="-93.15625" y="-27" width="186.3125" height="54"/><g class="label" style="color:#94a3b8 !important" transform="translate(-63.15625, -12)"><rect/><foreignObject width="126.3125" height="24"><div style="color: rgb(148, 163, 184) !important; display: table-cell; white-space: nowrap; line-height: 1.5; max-width: 200px; text-align: center;" xmlns="http://www.w3.org/1999/xhtml"><span style="color:#94a3b8 !important" class="nodeLabel"><p>generateDbTypes</p></span></div></foreignObject></g></g><g class="node default dimmed" id="flowchart-core-apitypes-4" transform="translate(110.4921875, 163)"><rect class="basic label-container" style="fill:#f1f5f9 !important;stroke:#cbd5e1 !important;stroke-width:1px !important" x="-94.4921875" y="-27" width="188.984375" height="54"/><g class="label" style="color:#94a3b8 !important" transform="translate(-64.4921875, -12)"><rect/><foreignObject width="128.984375" height="24"><div style="color: rgb(148, 163, 184) !important; display: table-cell; white-space: nowrap; line-height: 1.5; max-width: 200px; text-align: center;" xmlns="http://www.w3.org/1999/xhtml"><span style="color:#94a3b8 !important" class="nodeLabel"><p>generateApiTypes</p></span></div></foreignObject></g></g><g class="node default dimmed" id="flowchart-core-validators-5" transform="translate(472.859375, 279)"><rect class="basic label-container" style="fill:#f1f5f9 !important;stroke:#cbd5e1 !important;stroke-width:1px !important" x="-77.8828125" y="-27" width="155.765625" height="54"/><g class="label" style="color:#94a3b8 !important" transform="translate(-47.8828125, -12)"><rect/><foreignObject width="95.765625" height="24"><div style="color: rgb(148, 163, 184) !important; display: table-cell; white-space: nowrap; line-height: 1.5; max-width: 200px; text-align: center;" xmlns="http://www.w3.org/1999/xhtml"><span style="color:#94a3b8 !important" class="nodeLabel"><p>buildValidator</p></span></div></foreignObject></g></g><g class="node default dimmed" id="flowchart-handles-gen-6" transform="translate(359.9765625, 395)"><rect class="basic label-container" style="fill:#f1f5f9 !important;stroke:#cbd5e1 !important;stroke-width:1px !important" x="-90.9375" y="-27" width="181.875" height="54"/><g class="label" style="color:#94a3b8 !important" transform="translate(-60.9375, -12)"><rect/><foreignObject width="121.875" height="24"><div style="color: rgb(148, 163, 184) !important; display: table-cell; white-space: nowrap; line-height: 1.5; max-width: 200px; text-align: center;" xmlns="http://www.w3.org/1999/xhtml"><span style="color:#94a3b8 !important" class="nodeLabel"><p>generateHandles</p></span></div></foreignObject></g></g><g class="node default dimmed" id="flowchart-client-gen-7" transform="translate(129, 395)"><rect class="basic label-container" style="fill:#f1f5f9 !important;stroke:#cbd5e1 !important;stroke-width:1px !important" x="-90.0390625" y="-27" width="180.078125" height="54"/><g class="label" style="color:#94a3b8 !important" transform="translate(-60.0390625, -12)"><rect/><foreignObject width="120.078125" height="24"><div style="color: rgb(148, 163, 184) !important; display: table-cell; white-space: nowrap; line-height: 1.5; max-width: 200px; text-align: center;" xmlns="http://www.w3.org/1999/xhtml"><span style="color:#94a3b8 !important" class="nodeLabel"><p>generateTsClient</p></span></div></foreignObject></g></g><g class="node default highlight" id="flowchart-pg-drift-8" transform="translate(932.8359375, 163)"><rect class="basic label-container" style="fill:#4f46e5 !important;stroke:#3730a3 !important;stroke-width:2px !important" x="-66.4609375" y="-27" width="132.921875" height="54"/><g class="label" style="color:#fff !important" transform="translate(-36.4609375, -12)"><rect/><foreignObject width="72.921875" height="24"><div style="color: rgb(255, 255, 255) !important; display: table-cell; white-space: nowrap; line-height: 1.5; max-width: 200px; text-align: center;" xmlns="http://www.w3.org/1999/xhtml"><span style="color:#fff !important" class="nodeLabel"><p>detectDrift</p></span></div></foreignObject></g></g><g class="node default highlight" id="flowchart-pg-migrate-9" transform="translate(932.8359375, 279)"><rect class="basic label-container" style="fill:#4f46e5 !important;stroke:#3730a3 !important;stroke-width:2px !important" x="-94.484375" y="-27" width="188.96875" height="54"/><g class="label" style="color:#fff !important" transform="translate(-64.484375, -12)"><rect/><foreignObject width="128.96875" height="24"><div style="color: rgb(255, 255, 255) !important; display: table-cell; white-space: nowrap; line-height: 1.5; max-width: 200px; text-align: center;" xmlns="http://www.w3.org/1999/xhtml"><span style="color:#fff !important" class="nodeLabel"><p>generateMigration</p></span></div></foreignObject></g></g><g class="node default outputNode" id="flowchart-output-jsonschemas-10" transform="translate(694.546875, 279)"><rect class="basic label-container" style="fill:#d1fae5 !important;stroke:#10b981 !important;stroke-width:1px !important" x="-93.8046875" y="-39" width="187.609375" height="78"/><g class="label" style="color:#065f46 !important" transform="translate(-63.8046875, -24)"><rect/><foreignObject width="127.609375" height="48"><div style="color: rgb(6, 95, 70) !important; display: table-cell; white-space: nowrap; line-height: 1.5; max-width: 200px; text-align: center;" xmlns="http://www.w3.org/1999/xhtml"><span style="color:#065f46 !important" class="nodeLabel"><p>JSON Schemas +<br />TypeScript Types</p></span></div></foreignObject></g></g><g class="node default outputNode" id="flowchart-output-kysely-11" transform="translate(694.546875, 511)"><rect class="basic label-container" style="fill:#d1fae5 !important;stroke:#10b981 !important;stroke-width:1px !important" x="-90.03125" y="-39" width="180.0625" height="78"/><g class="label" style="color:#065f46 !important" transform="translate(-60.03125, -24)"><rect/><foreignObject width="120.0625" height="48"><div style="color: rgb(6, 95, 70) !important; display: table-cell; white-space: nowrap; line-height: 1.5; max-width: 200px; text-align: center;" xmlns="http://www.w3.org/1999/xhtml"><span style="color:#065f46 !important" class="nodeLabel"><p>Kysely Database<br />Interface</p></span></div></foreignObject></g></g><g class="node default outputNode" id="flowchart-output-reqres-12" transform="translate(110.4921875, 279)"><rect class="basic label-container" style="fill:#d1fae5 !important;stroke:#10b981 !important;stroke-width:1px !important" x="-102.4921875" y="-39" width="204.984375" height="78"/><g class="label" style="color:#065f46 !important" transform="translate(-72.4921875, -24)"><rect/><foreignObject width="144.984375" height="48"><div style="color: rgb(6, 95, 70) !important; display: table-cell; white-space: nowrap; line-height: 1.5; max-width: 200px; text-align: center;" xmlns="http://www.w3.org/1999/xhtml"><span style="color:#065f46 !important" class="nodeLabel"><p>Request / Response<br />TypeScript Types</p></span></div></foreignObject></g></g><g class="node default outputNode" id="flowchart-output-handlers-13" transform="translate(359.9765625, 511)"><rect class="basic label-container" style="fill:#d1fae5 !important;stroke:#10b981 !important;stroke-width:1px !important" x="-93.140625" y="-39" width="186.28125" height="78"/><g class="label" style="color:#065f46 !important" transform="translate(-63.140625, -24)"><rect/><foreignObject width="126.28125" height="48"><div style="color: rgb(6, 95, 70) !important; display: table-cell; white-space: nowrap; line-height: 1.5; max-width: 200px; text-align: center;" xmlns="http://www.w3.org/1999/xhtml"><span style="color:#065f46 !important" class="nodeLabel"><p>Handler Factories<br />+ Validators</p></span></div></foreignObject></g></g><g class="node default outputNode" id="flowchart-output-client-14" transform="translate(129, 511)"><rect class="basic label-container" style="fill:#d1fae5 !important;stroke:#10b981 !important;stroke-width:1px !important" x="-73.421875" y="-39" width="146.84375" height="78"/><g class="label" style="color:#065f46 !important" transform="translate(-43.421875, -24)"><rect/><foreignObject width="86.84375" height="48"><div style="color: rgb(6, 95, 70) !important; display: table-cell; white-space: nowrap; line-height: 1.5; max-width: 200px; text-align: center;" xmlns="http://www.w3.org/1999/xhtml"><span style="color:#065f46 !important" class="nodeLabel"><p>Type-safe<br />HTTP Client</p></span></div></foreignObject></g></g><g class="node default ownedOutput" id="flowchart-output-sql-15" transform="translate(932.8359375, 395)"><rect class="basic label-container" style="fill:#a5b4fc !important;stroke:#4f46e5 !important;stroke-width:2px !important" x="-84.8359375" y="-27" width="169.671875" height="54"/><g class="label" style="color:#1e1b4b !important" transform="translate(-54.8359375, -12)"><rect/><foreignObject width="109.671875" height="24"><div style="color: rgb(30, 27, 75) !important; display: table-cell; white-space: nowrap; line-height: 1.5; max-width: 200px; text-align: center;" xmlns="http://www.w3.org/1999/xhtml"><span style="color:#1e1b4b !important" class="nodeLabel"><p>SQL Migrations</p></span></div></foreignObject></g></g></g></g></g></svg>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildTableIndexCommand.d.ts","sourceRoot":"","sources":["../../../../libs/lockstep-pg/src/buildTableIndexCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAE9E,wBAAgB,uBAAuB,CACtC,CAAC,SAAS,kBAAkB,CAAC,mBAAmB,CAAC,EAChD,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"buildTableIndexCommand.d.ts","sourceRoot":"","sources":["../../../../libs/lockstep-pg/src/buildTableIndexCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAE9E,wBAAgB,uBAAuB,CACtC,CAAC,SAAS,kBAAkB,CAAC,mBAAmB,CAAC,EAChD,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,YAkE5B"}
|
|
@@ -21,13 +21,28 @@ export function buildTableIndexCommands(tableName, model) {
|
|
|
21
21
|
indexName = `idx_${tableName}_${index.map((c) => c.split(' ')[0]).join('_')}`;
|
|
22
22
|
}
|
|
23
23
|
else {
|
|
24
|
-
// Object format with optional custom name
|
|
24
|
+
// Object format with optional custom name, where clause, or raw expression list
|
|
25
25
|
const objIndex = index;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
if (objIndex.raw !== undefined) {
|
|
27
|
+
// Expression / functional index: literal column-list SQL, emitted verbatim
|
|
28
|
+
// (no identifier quoting) so casts/expressions like ((columns[1])::numeric) work.
|
|
29
|
+
indexColumns = [objIndex.raw];
|
|
30
|
+
indexName = objIndex.name ?? `idx_${tableName}_expr`;
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
const cols = Array.isArray(objIndex.columns)
|
|
34
|
+
? objIndex.columns
|
|
35
|
+
: [objIndex.columns];
|
|
36
|
+
indexColumns = cols.map((col) => {
|
|
37
|
+
const parts = col.split(' ');
|
|
38
|
+
const colName = parts[0];
|
|
39
|
+
const modifiers = parts.slice(1).join(' ');
|
|
40
|
+
return modifiers ? `"${colName}" ${modifiers}` : `"${colName}"`;
|
|
41
|
+
});
|
|
42
|
+
indexName =
|
|
43
|
+
objIndex.name ??
|
|
44
|
+
`idx_${tableName}_${cols.map((c) => c.split(' ')[0]).join('_')}`;
|
|
45
|
+
}
|
|
31
46
|
// Support partial indexes with WHERE clause
|
|
32
47
|
if (objIndex.where) {
|
|
33
48
|
whereClause = objIndex.where;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildTableIndexCommand.js","sourceRoot":"","sources":["../../../../libs/lockstep-pg/src/buildTableIndexCommand.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,uBAAuB,CAErC,SAAiB,EAAE,KAAQ;IAC5B,MAAM,YAAY,GAAa,EAAE,CAAC;IAClC,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC;QACnB,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;YAC/B,IAAI,YAAsB,CAAC;YAC3B,IAAI,SAAiB,CAAC;YACtB,IAAI,WAA+B,CAAC;YAEpC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;gBAC/B,sBAAsB;gBACtB,YAAY,GAAG,CAAC,IAAI,KAAK,GAAG,CAAC,CAAC;gBAC9B,SAAS,GAAG,OAAO,SAAS,IAAI,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YACvD,CAAC;iBAAM,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;gBACjC,qBAAqB;gBACrB,YAAY,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;oBAChC,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;oBAC7B,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;oBACzB,MAAM,SAAS,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,0BAA0B;oBACtE,OAAO,SAAS,CAAC,CAAC,CAAC,IAAI,OAAO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IAAI,OAAO,KAAK,SAAS,EAAE,CAAC,CAAC,CAAC,IAAI,OAAO,GAAG,CAAC;oBACjE,CAAC,CAAC,CAAC;oBACH,SAAS;wBACR,QAAQ,CAAC,IAAI;4BACb,OAAO,SAAS,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;gBACnE,CAAC;gBACD,4CAA4C;gBAC5C,IAAI,QAAQ,CAAC,KAAK,EAAE,CAAC;oBACpB,WAAW,GAAG,QAAQ,CAAC,KAAK,CAAC;gBAC9B,CAAC;YACF,CAAC;YAED,IAAI,UAAU,GAAG,+BAA+B,SAAS,SAAS,SAAS,MAAM,YAAY,CAAC,IAAI,CACjG,IAAI,CACJ,GAAG,CAAC;YACL,IAAI,WAAW,EAAE,CAAC;gBACjB,UAAU,IAAI,WAAW,WAAW,EAAE,CAAC;YACxC,CAAC;YACD,UAAU,IAAI,GAAG,CAAC;YAClB,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC/B,CAAC,CAAC,CAAC;IACJ,CAAC;IAED,OAAO,YAAY,CAAC;AACrB,CAAC"}
|
|
@@ -1,3 +1,15 @@
|
|
|
1
|
-
import { PostgresRecordModel, PostgresTableModel } from '@lyku/lockstep-core';
|
|
1
|
+
import { PostgresRecordModel, PostgresTableModel, PostgresTriggerModel } from '@lyku/lockstep-core';
|
|
2
|
+
/**
|
|
3
|
+
* Deterministic trigger name: the explicit `name`, else the positional
|
|
4
|
+
* `{table}_trigger_{i+1}`. Drift detection and DDL generation MUST agree on
|
|
5
|
+
* this, so both go through here.
|
|
6
|
+
*/
|
|
7
|
+
export declare function triggerName(tableName: string, trigger: PostgresTriggerModel, index: number): string;
|
|
8
|
+
/**
|
|
9
|
+
* The CREATE-FUNCTION + CREATE-TRIGGER pair for a single trigger. Idempotent
|
|
10
|
+
* (CREATE OR REPLACE FUNCTION + DROP/CREATE TRIGGER), so it's safe to re-run and
|
|
11
|
+
* safe to emit from a drift migration onto an existing table.
|
|
12
|
+
*/
|
|
13
|
+
export declare function buildTriggerCommands(tableName: string, trigger: PostgresTriggerModel, index: number): string[];
|
|
2
14
|
export declare function buildTableTriggerCommands<T extends PostgresTableModel<PostgresRecordModel>>(tableName: string, model: T): string[];
|
|
3
15
|
//# sourceMappingURL=buildTableTriggerCommands.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildTableTriggerCommands.d.ts","sourceRoot":"","sources":["../../../../libs/lockstep-pg/src/buildTableTriggerCommands.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"buildTableTriggerCommands.d.ts","sourceRoot":"","sources":["../../../../libs/lockstep-pg/src/buildTableTriggerCommands.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,EACpB,MAAM,qBAAqB,CAAC;AAE7B;;;;GAIG;AACH,wBAAgB,WAAW,CAC1B,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,oBAAoB,EAC7B,KAAK,EAAE,MAAM,GACX,MAAM,CAER;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CACnC,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,oBAAoB,EAC7B,KAAK,EAAE,MAAM,GACX,MAAM,EAAE,CAoBV;AAED,wBAAgB,yBAAyB,CACxC,CAAC,SAAS,kBAAkB,CAAC,mBAAmB,CAAC,EAChD,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,YAS5B"}
|
|
@@ -1,21 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deterministic trigger name: the explicit `name`, else the positional
|
|
3
|
+
* `{table}_trigger_{i+1}`. Drift detection and DDL generation MUST agree on
|
|
4
|
+
* this, so both go through here.
|
|
5
|
+
*/
|
|
6
|
+
export function triggerName(tableName, trigger, index) {
|
|
7
|
+
return trigger.name ?? `${tableName}_trigger_${index + 1}`;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* The CREATE-FUNCTION + CREATE-TRIGGER pair for a single trigger. Idempotent
|
|
11
|
+
* (CREATE OR REPLACE FUNCTION + DROP/CREATE TRIGGER), so it's safe to re-run and
|
|
12
|
+
* safe to emit from a drift migration onto an existing table.
|
|
13
|
+
*/
|
|
14
|
+
export function buildTriggerCommands(tableName, trigger, index) {
|
|
15
|
+
const name = triggerName(tableName, trigger, index);
|
|
16
|
+
const timing = 'before' in trigger ? 'BEFORE' : 'AFTER';
|
|
17
|
+
const event = 'before' in trigger ? trigger.before : trigger.after;
|
|
18
|
+
return [
|
|
19
|
+
`CREATE OR REPLACE FUNCTION ${name}_fn()\n` +
|
|
20
|
+
`RETURNS TRIGGER AS $$\n` +
|
|
21
|
+
`BEGIN\n` +
|
|
22
|
+
`${trigger.sql}\n` +
|
|
23
|
+
`END;\n` +
|
|
24
|
+
`$$ LANGUAGE plpgsql;\n`,
|
|
25
|
+
`DROP TRIGGER IF EXISTS ${name} ON "${tableName}";\n` +
|
|
26
|
+
`CREATE TRIGGER ${name}\n` +
|
|
27
|
+
`${timing} ${event.toUpperCase()}\n` +
|
|
28
|
+
`ON "${tableName}"\n` +
|
|
29
|
+
`FOR EACH ROW\n` +
|
|
30
|
+
`EXECUTE FUNCTION ${name}_fn();`,
|
|
31
|
+
];
|
|
32
|
+
}
|
|
1
33
|
export function buildTableTriggerCommands(tableName, model) {
|
|
2
34
|
const triggerQueries = [];
|
|
3
35
|
if (model.triggers) {
|
|
4
36
|
model.triggers.forEach((trigger, i) => {
|
|
5
|
-
|
|
6
|
-
const timing = 'before' in trigger ? 'BEFORE' : 'AFTER';
|
|
7
|
-
const event = 'before' in trigger ? trigger.before : trigger.after;
|
|
8
|
-
triggerQueries.push(`CREATE OR REPLACE FUNCTION ${triggerName}_fn()\n` +
|
|
9
|
-
`RETURNS TRIGGER AS $$\n` +
|
|
10
|
-
`BEGIN\n` +
|
|
11
|
-
`${trigger.sql}\n` +
|
|
12
|
-
`END;\n` +
|
|
13
|
-
`$$ LANGUAGE plpgsql;\n`, `DROP TRIGGER IF EXISTS ${triggerName} ON "${tableName}";\n` +
|
|
14
|
-
`CREATE TRIGGER ${triggerName}\n` +
|
|
15
|
-
`${timing} ${event.toUpperCase()}\n` +
|
|
16
|
-
`ON "${tableName}"\n` +
|
|
17
|
-
`FOR EACH ROW\n` +
|
|
18
|
-
`EXECUTE FUNCTION ${triggerName}_fn();`);
|
|
37
|
+
triggerQueries.push(...buildTriggerCommands(tableName, trigger, i));
|
|
19
38
|
});
|
|
20
39
|
}
|
|
21
40
|
return triggerQueries;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildTableTriggerCommands.js","sourceRoot":"","sources":["../../../../libs/lockstep-pg/src/buildTableTriggerCommands.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"buildTableTriggerCommands.js","sourceRoot":"","sources":["../../../../libs/lockstep-pg/src/buildTableTriggerCommands.ts"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAC1B,SAAiB,EACjB,OAA6B,EAC7B,KAAa;IAEb,OAAO,OAAO,CAAC,IAAI,IAAI,GAAG,SAAS,YAAY,KAAK,GAAG,CAAC,EAAE,CAAC;AAC5D,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CACnC,SAAiB,EACjB,OAA6B,EAC7B,KAAa;IAEb,MAAM,IAAI,GAAG,WAAW,CAAC,SAAS,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;IACpD,MAAM,MAAM,GAAG,QAAQ,IAAI,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC;IACxD,MAAM,KAAK,GAAG,QAAQ,IAAI,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC;IAEnE,OAAO;QACN,8BAA8B,IAAI,SAAS;YAC1C,yBAAyB;YACzB,SAAS;YACT,GAAG,OAAO,CAAC,GAAG,IAAI;YAClB,QAAQ;YACR,wBAAwB;QAEzB,0BAA0B,IAAI,QAAQ,SAAS,MAAM;YACpD,kBAAkB,IAAI,IAAI;YAC1B,GAAG,MAAM,IAAI,KAAK,CAAC,WAAW,EAAE,IAAI;YACpC,OAAO,SAAS,KAAK;YACrB,gBAAgB;YAChB,oBAAoB,IAAI,QAAQ;KACjC,CAAC;AACH,CAAC;AAED,MAAM,UAAU,yBAAyB,CAEvC,SAAiB,EAAE,KAAQ;IAC5B,MAAM,cAAc,GAAa,EAAE,CAAC;IACpC,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;QACpB,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,CAAC,EAAE,EAAE;YACrC,cAAc,CAAC,IAAI,CAAC,GAAG,oBAAoB,CAAC,SAAS,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC;QACrE,CAAC,CAAC,CAAC;IACJ,CAAC;IAED,OAAO,cAAc,CAAC;AACvB,CAAC"}
|
package/src/createTable.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createTable.d.ts","sourceRoot":"","sources":["../../../../libs/lockstep-pg/src/createTable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAa9E,eAAO,MAAM,yBAAyB,GACrC,WAAW,MAAM,EACjB,OAAO,kBAAkB,CAAC,mBAAmB,CAAC,
|
|
1
|
+
{"version":3,"file":"createTable.d.ts","sourceRoot":"","sources":["../../../../libs/lockstep-pg/src/createTable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAa9E,eAAO,MAAM,yBAAyB,GACrC,WAAW,MAAM,EACjB,OAAO,kBAAkB,CAAC,mBAAmB,CAAC,WAqD9C,CAAC"}
|
package/src/createTable.js
CHANGED
|
@@ -14,8 +14,12 @@ function formatDefault(def) {
|
|
|
14
14
|
export const buildTableCreationCommand = (tableName, model) => {
|
|
15
15
|
const { schema } = model;
|
|
16
16
|
const required = 'required' in schema ? schema.required : [];
|
|
17
|
+
// Managed (infra) columns are emitted alongside the record-schema columns but
|
|
18
|
+
// are not part of `schema.properties` (so they stay out of the domain type).
|
|
19
|
+
// They are nullable-with-default; NOT NULL still derives only from `required`.
|
|
20
|
+
const managed = Object.entries(model.managedColumns ?? {});
|
|
17
21
|
const columns = 'properties' in schema
|
|
18
|
-
? Object.entries(schema.properties)
|
|
22
|
+
? [...Object.entries(schema.properties), ...managed]
|
|
19
23
|
.map(([columnName, columnSchema]) => {
|
|
20
24
|
const columnType = mapColumnType(columnName, columnSchema);
|
|
21
25
|
const notNull = required.includes(columnName) ? ' NOT NULL' : '';
|
|
@@ -40,7 +44,17 @@ export const buildTableCreationCommand = (tableName, model) => {
|
|
|
40
44
|
.map((k) => `"${k}"`)
|
|
41
45
|
.join(', ')})`
|
|
42
46
|
: '';
|
|
43
|
-
|
|
47
|
+
// Foreign keys — model shape: { column: { referencedTable: referencedColumn } }.
|
|
48
|
+
// Emitted inline so a table created from a model round-trips with its FKs (the referenced
|
|
49
|
+
// table must already exist; generateCreateTablesSql topologically orders tables for that).
|
|
50
|
+
const fks = model.foreignKeys
|
|
51
|
+
? Object.entries(model.foreignKeys)
|
|
52
|
+
.flatMap(([column, ref]) => ref
|
|
53
|
+
? Object.entries(ref).map(([refTable, refColumn]) => `, FOREIGN KEY ("${column}") REFERENCES "${refTable}" ("${refColumn}")`)
|
|
54
|
+
: [])
|
|
55
|
+
.join('')
|
|
56
|
+
: '';
|
|
57
|
+
const createTableQuery = `CREATE TABLE IF NOT EXISTS "${tableName}" (${columns} ${primary} ${uni}${fks});`;
|
|
44
58
|
return createTableQuery;
|
|
45
59
|
};
|
|
46
60
|
//# sourceMappingURL=createTable.js.map
|
package/src/createTable.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createTable.js","sourceRoot":"","sources":["../../../../libs/lockstep-pg/src/createTable.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,SAAS,aAAa,CAAC,GAAY;IAClC,IAAI,GAAG,KAAK,IAAI;QAAE,OAAO,MAAM,CAAC;IAChC,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI,IAAI,KAAK,IAAI,GAAG,EAAE,CAAC;QAC7D,OAAQ,GAAuB,CAAC,GAAG,CAAC;IACrC,CAAC;IACD,IAAI,OAAO,GAAG,KAAK,QAAQ;QAAE,OAAO,IAAI,GAAG,GAAG,CAAC;IAC/C,IAAI,OAAO,GAAG,KAAK,SAAS;QAAE,OAAO,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;IAC5D,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;AACpB,CAAC;AAED,MAAM,CAAC,MAAM,yBAAyB,GAAG,CACxC,SAAiB,EACjB,KAA8C,EAC7C,EAAE;IACH,MAAM,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;IACzB,MAAM,QAAQ,GAAG,UAAU,IAAI,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;IAC7D,MAAM,OAAO,GACZ,YAAY,IAAI,MAAM;QACrB,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"createTable.js","sourceRoot":"","sources":["../../../../libs/lockstep-pg/src/createTable.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,SAAS,aAAa,CAAC,GAAY;IAClC,IAA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,OAAO,SAAS,IAAI,CACxE;YACF,CAAC,CAAC,EAAE,CACL;aACA,IAAI,CAAC,EAAE,CAAC;QACX,CAAC,CAAC,EAAE,CAAC;IACN,MAAM,gBAAgB,GAAG,+BAA+B,SAAS,MAAM,OAAO,IAAI,OAAO,IAAI,GAAG,GAAG,GAAG,IAAI,CAAC;IAC3G,OAAO,gBAAgB,CAAC;AACzB,CAAC,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export const dateToPostgresString = (date) => {
|
|
2
2
|
// Ensure we're working with a Date object
|
|
3
3
|
const dateObj = date instanceof Date ? date : new Date(date);
|
|
4
|
-
// Format: YYYY-MM-DD HH:MM:SS.sss
|
|
5
|
-
return dateObj.toISOString().slice(0,
|
|
4
|
+
// Format: YYYY-MM-DD HH:MM:SS.sss (slice(0,23) keeps milliseconds, drops the trailing 'Z')
|
|
5
|
+
return dateObj.toISOString().slice(0, 23).replace('T', ' ');
|
|
6
6
|
};
|
|
7
7
|
//# sourceMappingURL=dateToPostgresString.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dateToPostgresString.js","sourceRoot":"","sources":["../../../../libs/lockstep-pg/src/dateToPostgresString.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,IAAmB,EAAE,EAAE;IAC3D,0CAA0C;IAC1C,MAAM,OAAO,GAAG,IAAI,YAAY,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC;IAE7D,
|
|
1
|
+
{"version":3,"file":"dateToPostgresString.js","sourceRoot":"","sources":["../../../../libs/lockstep-pg/src/dateToPostgresString.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,IAAmB,EAAE,EAAE;IAC3D,0CAA0C;IAC1C,MAAM,OAAO,GAAG,IAAI,YAAY,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC;IAE7D,4FAA4F;IAC5F,OAAO,OAAO,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AAC7D,CAAC,CAAC"}
|
package/src/diff.d.ts
CHANGED
|
@@ -23,6 +23,7 @@ export type DiffOperation = {
|
|
|
23
23
|
fromType: string;
|
|
24
24
|
toType: string;
|
|
25
25
|
toArrayItemType: string | null;
|
|
26
|
+
toLength: number | null;
|
|
26
27
|
} | {
|
|
27
28
|
type: 'alter_column_nullable';
|
|
28
29
|
tableName: string;
|
|
@@ -39,6 +40,16 @@ export type DiffOperation = {
|
|
|
39
40
|
columnName: string;
|
|
40
41
|
oldValues: string[];
|
|
41
42
|
newValues: string[];
|
|
43
|
+
} | {
|
|
44
|
+
type: 'drop_sequence';
|
|
45
|
+
tableName: string;
|
|
46
|
+
columnName: string;
|
|
47
|
+
sequenceName: string;
|
|
48
|
+
} | {
|
|
49
|
+
type: 'create_sequence';
|
|
50
|
+
tableName: string;
|
|
51
|
+
columnName: string;
|
|
52
|
+
sequenceName: string;
|
|
42
53
|
} | {
|
|
43
54
|
type: 'add_index';
|
|
44
55
|
tableName: string;
|
|
@@ -55,6 +66,7 @@ export type DiffOperation = {
|
|
|
55
66
|
type: 'drop_unique_constraint';
|
|
56
67
|
tableName: string;
|
|
57
68
|
columns: string[];
|
|
69
|
+
constraintName?: string;
|
|
58
70
|
} | {
|
|
59
71
|
type: 'add_foreign_key';
|
|
60
72
|
tableName: string;
|
package/src/diff.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diff.d.ts","sourceRoot":"","sources":["../../../../libs/lockstep-pg/src/diff.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EACX,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,sBAAsB,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