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:
Diego Imbert
2026-07-04 00:17:33 +02:00
co-authored by Claude Opus 4.8
parent fcf8629f92
commit 260d0c2d56
2 changed files with 24 additions and 1 deletions
+1 -1
View File
@@ -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",
+23
View File
@@ -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