Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
fix: version value when uploading files to changelist (#12489)
Liu Ji3ccd6f465f2b
diff --git a/frontend/src/components/Changelist/ChangelistDashboard/CreateChangelistPanel.vue b/frontend/src/components/Changelist/ChangelistDashboard/CreateChangelistPanel.vueindex 5346e3e16d..a0cfd77370 100644--- a/frontend/src/components/Changelist/ChangelistDashboard/CreateChangelistPanel.vue+++ b/frontend/src/components/Changelist/ChangelistDashboard/CreateChangelistPanel.vue@@ -160,6 +160,7 @@ import { Engine } from "@/types/proto/v1/common";import { Sheet } from "@/types/proto/v1/sheet_service";import { extractChangelistResourceName, setSheetStatement } from "@/utils";import { getErrorCode } from "@/utils/grpcweb";+import { fallbackVersionForChange } from "../common";import { readUpload, type ParsedFile } from "../import";import { useChangelistDashboardContext } from "./context";@@ -290,6 +291,7 @@ const doCreate = async () => {const changes = createdSheets.map((sheet) =>Change.fromPartial({sheet: sheet.name,+ version: fallbackVersionForChange(),}));diff --git a/frontend/src/components/Changelist/ChangelistDetail/AddChangePanel/AddChangePanel.vue b/frontend/src/components/Changelist/ChangelistDetail/AddChangePanel/AddChangePanel.vueindex 165509d8e3..cb0604eb57 100644--- a/frontend/src/components/Changelist/ChangelistDetail/AddChangePanel/AddChangePanel.vue+++ b/frontend/src/components/Changelist/ChangelistDetail/AddChangePanel/AddChangePanel.vue@@ -73,7 +73,6 @@<script setup lang="ts">import { asyncComputed } from "@vueuse/core";-import dayjs from "dayjs";import { File, History } from "lucide-vue-next";import { NRadio, NRadioGroup } from "naive-ui";import { zindexable as vZindexable } from "vdirs";@@ -101,6 +100,7 @@ import { useChangelistDetailContext } from "../context";import { provideAddChangeContext } from "./context";import { ChangeHistoryForm, RawSQLForm } from "./form";import { emptyRawSQLChange } from "./utils";+import { fallbackVersionForChange } from "../../common";const { t } = useI18n();const settingStore = useSettingV1Store();@@ -195,8 +195,7 @@ const doAddChange = async () => {change.version = changeHistory?.version || "";}if (change.version === "") {- // Example: 20240101061834.- change.version = dayjs().utc().format("YYYYMMDDHHmmss");+ change.version = fallbackVersionForChange();}return change;diff --git a/frontend/src/components/Changelist/ChangelistDetail/NavBar/ImportButton.vue b/frontend/src/components/Changelist/ChangelistDetail/NavBar/ImportButton.vueindex 1dd20124a0..ef0473c23f 100644--- a/frontend/src/components/Changelist/ChangelistDetail/NavBar/ImportButton.vue+++ b/frontend/src/components/Changelist/ChangelistDetail/NavBar/ImportButton.vue@@ -46,6 +46,7 @@ import { Sheet } from "@/types/proto/v1/sheet_service";import { setSheetStatement } from "@/utils";import { readUpload, type ParsedFile } from "../../import";import { useChangelistDetailContext } from "../context";+import { fallbackVersionForChange } from "../../common";const { t } = useI18n();const { changelist, project, isUpdating } = useChangelistDetailContext();@@ -101,6 +102,7 @@ const save = async (files: ParsedFile[]) => {const newChanges = createdSheets.map((sheet) =>Change.fromPartial({sheet: sheet.name,+ version: fallbackVersionForChange()}));const changelistPatch = Changelist.fromPartial({diff --git a/frontend/src/components/Changelist/common.ts b/frontend/src/components/Changelist/common.tsnew file mode 100644index 0000000000..fe4c020db3--- /dev/null+++ b/frontend/src/components/Changelist/common.ts@@ -0,0 +1,6 @@+import dayjs from "dayjs";++export const fallbackVersionForChange = () => {+ // Example: 20240101061834+ return dayjs().utc().format("YYYYMMDDHHmmss");+};