@housekit/kit 0.1.33 → 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.
Files changed (2) hide show
  1. package/dist/index.js +24 -3
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -8637,10 +8637,18 @@ function normalizeClause(val) {
8637
8637
  return val.expression;
8638
8638
  return String(val);
8639
8639
  }
8640
+ function normalizePartitionExpr(val) {
8641
+ if (!val)
8642
+ return;
8643
+ let normalized = val.toLowerCase().replace(/\s+/g, "");
8644
+ return normalized;
8645
+ }
8640
8646
  function normalizeTtlExpr(val) {
8641
8647
  if (!val)
8642
8648
  return;
8643
- return val.toLowerCase().replace(/\s+/g, "").replace(/tointervalday\((\d+)\)/g, "interval$1day");
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;
8644
8652
  }
8645
8653
  function canonicalName(name) {
8646
8654
  return name.toLowerCase().replace(/[^a-z0-9]/g, "");
@@ -8771,8 +8779,21 @@ function diffTable(table, localCols, remote, opts) {
8771
8779
  const compare = (label, local, remoteValue, action) => {
8772
8780
  if (!local && !remoteValue)
8773
8781
  return;
8774
- const l = label === "ttl" ? normalizeTtlExpr(normalizeClause(local)) : normalizeClause(local);
8775
- const r = label === "ttl" ? normalizeTtlExpr(normalizeClause(remoteValue)) : normalizeClause(remoteValue);
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
+ }
8776
8797
  if ((l || "unset") !== (r || "unset")) {
8777
8798
  optionChanges.push(label);
8778
8799
  if (action)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@housekit/kit",
3
- "version": "0.1.33",
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.39",
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",