mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-10-27 08:02:39 +00:00
fix: return datatable migration SQL from getItemValue for the diff drawer
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
fcf8629f92
commit
260d0c2d56
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "windmill-utils-internal",
|
||||
"version": "1.8.1",
|
||||
"version": "1.8.2",
|
||||
"description": "Internal utility functions for Windmill",
|
||||
"main": "dist/cjs/index.js",
|
||||
"module": "dist/esm/index.js",
|
||||
|
||||
@@ -868,6 +868,29 @@ export async function getItemValue(
|
||||
} else if (isTriggerKind(kind)) {
|
||||
const trigger = await provider.getTriggerValue(kind, { workspace, path });
|
||||
return stripTriggerOrScheduleRuntimeFields(trigger);
|
||||
} else if (kind === "datatable_migration") {
|
||||
// Surface the migration SQL so the diff drawer shows the up/down bodies a
|
||||
// reviewer needs to inspect before deploying.
|
||||
const { datatable, timestamp } = parseDatatableMigrationDeployPath(path);
|
||||
const migrations = (await provider.listDatatableMigrations({
|
||||
workspace,
|
||||
})) as {
|
||||
datatable: string;
|
||||
timestamp: number;
|
||||
name: string;
|
||||
code_up: string;
|
||||
code_down?: string;
|
||||
}[];
|
||||
const migration = migrations.find(
|
||||
(m) => m.datatable === datatable && m.timestamp === timestamp
|
||||
);
|
||||
if (migration) {
|
||||
return {
|
||||
name: migration.name,
|
||||
code_up: migration.code_up,
|
||||
code_down: migration.code_down ?? null,
|
||||
};
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
// Item may not exist
|
||||
|
||||
Reference in New Issue
Block a user