@lark-apaas/miaoda-cli 0.1.0-alpha.ca2912e → 0.1.0-alpha.eae0402
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/api/db/parsers.js
CHANGED
|
@@ -82,7 +82,6 @@ function toSummary(t, stats) {
|
|
|
82
82
|
columns: (t.fields ?? []).length,
|
|
83
83
|
estimated_row_count: typeof stats?.estimatedRowCount === "number" ? stats.estimatedRowCount : null,
|
|
84
84
|
size_bytes: typeof stats?.sizeBytes === "number" ? stats.sizeBytes : null,
|
|
85
|
-
updated_at: t.updatedAt,
|
|
86
85
|
};
|
|
87
86
|
}
|
|
88
87
|
/**
|
|
@@ -118,8 +117,6 @@ function toDetail(t, stats) {
|
|
|
118
117
|
indexes: rawIndexes.map(toIndex),
|
|
119
118
|
estimated_row_count: typeof stats?.estimatedRowCount === "number" ? stats.estimatedRowCount : null,
|
|
120
119
|
size_bytes: typeof stats?.sizeBytes === "number" ? stats.sizeBytes : null,
|
|
121
|
-
created_at: t.createdAt,
|
|
122
|
-
updated_at: t.updatedAt,
|
|
123
120
|
};
|
|
124
121
|
}
|
|
125
122
|
function toColumn(f) {
|
|
@@ -55,14 +55,14 @@ async function handleDbSchemaList(opts) {
|
|
|
55
55
|
return;
|
|
56
56
|
}
|
|
57
57
|
const tty = (0, render_1.isStdoutTty)();
|
|
58
|
-
// PRD 对齐:TTY 表头用 `size`(友好格式),non-TTY 用 `size_bytes
|
|
58
|
+
// PRD 对齐:TTY 表头用 `size`(友好格式),non-TTY 用 `size_bytes`(原始整数)。
|
|
59
|
+
// updated_at 暂时不展示——PG pg_catalog 不存真实表时间,详见 renderDetail 注释。
|
|
59
60
|
const headers = [
|
|
60
61
|
"name",
|
|
61
62
|
"description",
|
|
62
63
|
"estimated_row_count",
|
|
63
64
|
tty ? "size" : "size_bytes",
|
|
64
65
|
"columns",
|
|
65
|
-
"updated_at",
|
|
66
66
|
];
|
|
67
67
|
const rows = tables.map((t) => [
|
|
68
68
|
t.name,
|
|
@@ -70,7 +70,6 @@ async function handleDbSchemaList(opts) {
|
|
|
70
70
|
t.estimated_row_count === null ? "—" : String(t.estimated_row_count),
|
|
71
71
|
t.size_bytes === null ? "—" : (tty ? (0, render_1.formatSize)(t.size_bytes) : String(t.size_bytes)),
|
|
72
72
|
String(t.columns),
|
|
73
|
-
(0, render_1.formatTime)(t.updated_at, tty),
|
|
74
73
|
]);
|
|
75
74
|
(0, output_1.emit)(tty ? (0, render_1.renderAlignedTable)(headers, rows) : (0, render_1.renderTsv)(headers, rows));
|
|
76
75
|
}
|
|
@@ -123,7 +122,10 @@ async function handleDbSchemaGet(table, opts) {
|
|
|
123
122
|
function renderDetail(d, tty) {
|
|
124
123
|
const systemFields = d.columns.filter((c) => c.name.startsWith("_"));
|
|
125
124
|
const userFields = d.columns.filter((c) => !c.name.startsWith("_"));
|
|
126
|
-
//
|
|
125
|
+
// header 布局:Name / Description / Columns(含"+ N system") / Estimated Rows / Size。
|
|
126
|
+
// 不展示 Created / Updated:PG pg_catalog 不存表创建时间,dataloom 用 OID
|
|
127
|
+
// 构造的伪时间戳(baseTime=2020-01-01 + OID 秒偏移),仅保排序意义、绝对值
|
|
128
|
+
// 误导性强,先去掉。后续如果接 ddl_change_log 取真实时间再加回。
|
|
127
129
|
const header = [
|
|
128
130
|
["Name", d.name],
|
|
129
131
|
["Description", d.description ?? "—"],
|
|
@@ -135,8 +137,6 @@ function renderDetail(d, tty) {
|
|
|
135
137
|
],
|
|
136
138
|
["Estimated Rows", d.estimated_row_count === null ? "—" : String(d.estimated_row_count)],
|
|
137
139
|
["Size", d.size_bytes === null ? "—" : (0, render_1.formatSize)(d.size_bytes)],
|
|
138
|
-
["Created", (0, render_1.formatTime)(d.created_at, tty)],
|
|
139
|
-
["Updated", (0, render_1.formatTime)(d.updated_at, tty)],
|
|
140
140
|
];
|
|
141
141
|
const colHeaders = ["column", "type", "nullable", "default", "comment"];
|
|
142
142
|
const colRows = userFields.map((c) => [
|