@housekit/kit 0.1.32 → 0.1.34
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/dist/index.js +40 -4
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -8448,7 +8448,22 @@ function resolveDatabase(config, name) {
|
|
|
8448
8448
|
const selected = pickDatabase(config, name);
|
|
8449
8449
|
let url = selected.db.url;
|
|
8450
8450
|
if (!url && selected.db.host) {
|
|
8451
|
-
|
|
8451
|
+
let host = selected.db.host;
|
|
8452
|
+
if (!host.startsWith("http://") && !host.startsWith("https://")) {
|
|
8453
|
+
host = `http://${host}`;
|
|
8454
|
+
}
|
|
8455
|
+
if (selected.db.port) {
|
|
8456
|
+
try {
|
|
8457
|
+
const parsed = new URL(host);
|
|
8458
|
+
if (!parsed.port) {
|
|
8459
|
+
parsed.port = String(selected.db.port);
|
|
8460
|
+
host = parsed.toString().replace(/\/$/, "");
|
|
8461
|
+
}
|
|
8462
|
+
} catch {
|
|
8463
|
+
host = `${host}:${selected.db.port}`;
|
|
8464
|
+
}
|
|
8465
|
+
}
|
|
8466
|
+
url = host;
|
|
8452
8467
|
}
|
|
8453
8468
|
url = url || "http://localhost:8123";
|
|
8454
8469
|
const client = createClient({
|
|
@@ -8622,10 +8637,18 @@ function normalizeClause(val) {
|
|
|
8622
8637
|
return val.expression;
|
|
8623
8638
|
return String(val);
|
|
8624
8639
|
}
|
|
8640
|
+
function normalizePartitionExpr(val) {
|
|
8641
|
+
if (!val)
|
|
8642
|
+
return;
|
|
8643
|
+
let normalized = val.toLowerCase().replace(/\s+/g, "");
|
|
8644
|
+
return normalized;
|
|
8645
|
+
}
|
|
8625
8646
|
function normalizeTtlExpr(val) {
|
|
8626
8647
|
if (!val)
|
|
8627
8648
|
return;
|
|
8628
|
-
|
|
8649
|
+
let normalized = val.toLowerCase().replace(/\s+/g, "");
|
|
8650
|
+
normalized = normalized.replace(/tointerval(day|year|month|week|hour|minute|second)\((\d+)\)/g, "interval$2$1").replace(/interval\s*(\d+)\s*(day|year|month|week|hour|minute|second)/g, "interval$1$2");
|
|
8651
|
+
return normalized;
|
|
8629
8652
|
}
|
|
8630
8653
|
function canonicalName(name) {
|
|
8631
8654
|
return name.toLowerCase().replace(/[^a-z0-9]/g, "");
|
|
@@ -8756,8 +8779,21 @@ function diffTable(table, localCols, remote, opts) {
|
|
|
8756
8779
|
const compare = (label, local, remoteValue, action) => {
|
|
8757
8780
|
if (!local && !remoteValue)
|
|
8758
8781
|
return;
|
|
8759
|
-
|
|
8760
|
-
|
|
8782
|
+
let l;
|
|
8783
|
+
let r;
|
|
8784
|
+
if (label === "ttl") {
|
|
8785
|
+
l = normalizeTtlExpr(normalizeClause(local));
|
|
8786
|
+
r = normalizeTtlExpr(normalizeClause(remoteValue));
|
|
8787
|
+
} else if (label === "partitionBy") {
|
|
8788
|
+
l = normalizePartitionExpr(normalizeClause(local));
|
|
8789
|
+
r = normalizePartitionExpr(normalizeClause(remoteValue));
|
|
8790
|
+
if (l && r && l.startsWith(r + "(")) {
|
|
8791
|
+
return;
|
|
8792
|
+
}
|
|
8793
|
+
} else {
|
|
8794
|
+
l = normalizeClause(local);
|
|
8795
|
+
r = normalizeClause(remoteValue);
|
|
8796
|
+
}
|
|
8761
8797
|
if ((l || "unset") !== (r || "unset")) {
|
|
8762
8798
|
optionChanges.push(label);
|
|
8763
8799
|
if (action)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@housekit/kit",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.34",
|
|
4
4
|
"description": "CLI tool for HouseKit - manage ClickHouse schemas, migrations, and database operations with type-safe workflows.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
50
|
"@clickhouse/client": "^1.14.0",
|
|
51
|
-
"@housekit/orm": "^0.1.
|
|
51
|
+
"@housekit/orm": "^0.1.40",
|
|
52
52
|
"boxen": "8.0.1",
|
|
53
53
|
"chalk": "^5.6.2",
|
|
54
54
|
"cli-table3": "^0.6.5",
|