Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: improve ux for risingwave (#7525)

h3n4l96510b5a07e1
diff --git a/backend/plugin/db/risingwave/risingwave.go b/backend/plugin/db/risingwave/risingwave.go
index 54b19826bc..4344384114 100644
--- a/backend/plugin/db/risingwave/risingwave.go
+++ b/backend/plugin/db/risingwave/risingwave.go
@@ -217,7 +217,7 @@ func (driver *Driver) getDatabases(ctx context.Context) ([]*storepb.DatabaseSche
func (driver *Driver) getVersion(ctx context.Context) (string, error) {
// Likes PostgreSQL 9.5-RisingWave-1.1.0 (f41ff20612323dc56f654939cfa3be9ca684b52f)
// We will return 1.1.0
- regexp := regexp.MustCompile(`(?m)PostgreSQL (?P<PG_VERSION>.*)-RisingWave-(?P<RISINGWAVE_VERSION>\d+\.\d+\.\d+) \((?P<BUILD_SHA>.*)\)$`)
+ regexp := regexp.MustCompile(`(?m)PostgreSQL (?P<PG_VERSION>.*)-RisingWave-(?P<RISINGWAVE_VERSION>.*) \((?P<BUILD_SHA>.*)\)$`)
query := "SELECT version();"
var version string
if err := driver.db.QueryRowContext(ctx, query).Scan(&version); err != nil {
diff --git a/backend/runner/taskrun/executor.go b/backend/runner/taskrun/executor.go
index d0aa973ea6..1504e41b23 100644
--- a/backend/runner/taskrun/executor.go
+++ b/backend/runner/taskrun/executor.go
@@ -550,6 +550,10 @@ func isWriteBack(ctx context.Context, stores *store.Store, license enterpriseAPI
if instance == nil {
return "", errors.Errorf("cannot found instance %d", task.InstanceID)
}
+ if instance.Engine == db.RisingWave {
+ return "", nil
+ }
+
if err := license.IsFeatureEnabledForInstance(api.FeatureVCSSchemaWriteBack, instance); err != nil {
log.Debug(err.Error(), zap.String("instance", instance.ResourceID))
return "", nil
diff --git a/frontend/src/components/Issue/TaskRunTable.vue b/frontend/src/components/Issue/TaskRunTable.vue
index f8f6b27218..e2e4c88874 100644
--- a/frontend/src/components/Issue/TaskRunTable.vue
+++ b/frontend/src/components/Issue/TaskRunTable.vue
@@ -146,6 +146,7 @@ const commentLink = (task: Task, taskRun: TaskRun): CommentLink => {
case "bb.task.database.schema.baseline":
case "bb.task.database.schema.update":
case "bb.task.database.schema.update-sdl":
+ case "bb.task.general":
case "bb.task.database.data.update": {
const db = useDatabaseV1Store().getDatabaseByUID(
String(task.database!.id)
diff --git a/frontend/src/views/ChangeHistoryDetail.vue b/frontend/src/views/ChangeHistoryDetail.vue
index 9c0f2b5116..42c7e61c39 100644
--- a/frontend/src/views/ChangeHistoryDetail.vue
+++ b/frontend/src/views/ChangeHistoryDetail.vue
@@ -140,88 +140,90 @@
class="border px-2 whitespace-pre-wrap w-full"
:code="changeHistory.statement"
/>
- <a
- id="schema"
- href="#schema"
- class="flex items-center text-lg text-main mt-6 hover:underline capitalize"
- >
- Schema {{ $t("common.snapshot") }}
- <button
- tabindex="-1"
- class="btn-icon ml-1"
- @click.prevent="copySchema"
- >
- <heroicons-outline:clipboard class="w-6 h-6" />
- </button>
- </a>
-
- <div v-if="hasDrift" class="flex items-center space-x-2 mt-2">
- <div class="flex items-center text-sm font-normal">
- <heroicons-outline:exclamation-circle
- class="w-5 h-5 mr-0.5 text-error"
- />
- <span>{{ $t("change-history.schema-drift-detected") }}</span>
- </div>
- <div
- class="normal-link text-sm"
- data-label="bb-change-history-view-drift-button"
- @click="state.viewDrift = true"
+ <template v-if="showSchemaSnapshot">
+ <a
+ id="schema"
+ href="#schema"
+ class="flex items-center text-lg text-main mt-6 hover:underline capitalize"
>
- {{ $t("change-history.view-drift") }}
+ Schema {{ $t("common.snapshot") }}
+ <button
+ tabindex="-1"
+ class="btn-icon ml-1"
+ @click.prevent="copySchema"
+ >
+ <heroicons-outline:clipboard class="w-6 h-6" />
+ </button>
+ </a>
+
+ <div v-if="hasDrift" class="flex items-center space-x-2 mt-2">
+ <div class="flex items-center text-sm font-normal">
+ <heroicons-outline:exclamation-circle
+ class="w-5 h-5 mr-0.5 text-error"
+ />
+ <span>{{ $t("change-history.schema-drift-detected") }}</span>
+ </div>
+ <div
+ class="normal-link text-sm"
+ data-label="bb-change-history-view-drift-button"
+ @click="state.viewDrift = true"
+ >
+ {{ $t("change-history.view-drift") }}
+ </div>
</div>
- </div>
- <div class="flex flex-row items-center space-x-2 mt-2">
- <BBSwitch
- v-if="allowShowDiff"
- :label="$t('change-history.show-diff')"
- :value="state.showDiff"
- data-label="bb-change-history-diff-switch"
- @toggle="state.showDiff = $event"
- />
- <div class="textinfolabel">
- <i18n-t
- v-if="state.showDiff"
- tag="span"
- keypath="change-history.left-vs-right"
- >
- <template #prevLink>
- <router-link
- v-if="previousHistory"
- class="normal-link"
- :to="previousHistoryLink"
- >
- ({{ previousHistory.version }})
- </router-link>
+ <div class="flex flex-row items-center space-x-2 mt-2">
+ <BBSwitch
+ v-if="allowShowDiff"
+ :label="$t('change-history.show-diff')"
+ :value="state.showDiff"
+ data-label="bb-change-history-diff-switch"
+ @toggle="state.showDiff = $event"
+ />
+ <div class="textinfolabel">
+ <i18n-t
+ v-if="state.showDiff"
+ tag="span"
+ keypath="change-history.left-vs-right"
+ >
+ <template #prevLink>
+ <router-link
+ v-if="previousHistory"
+ class="normal-link"
+ :to="previousHistoryLink"
+ >
+ ({{ previousHistory.version }})
+ </router-link>
+ </template>
+ </i18n-t>
+ <template v-else>
+ {{ $t("change-history.schema-snapshot-after-change") }}
</template>
- </i18n-t>
- <template v-else>
- {{ $t("change-history.schema-snapshot-after-change") }}
- </template>
+ </div>
+ <div v-if="!allowShowDiff" class="text-sm font-normal text-accent">
+ ({{ $t("change-history.no-schema-change") }})
+ </div>
</div>
- <div v-if="!allowShowDiff" class="text-sm font-normal text-accent">
- ({{ $t("change-history.no-schema-change") }})
- </div>
- </div>
- <code-diff
- v-if="state.showDiff"
- class="mt-4 w-full"
- :old-string="changeHistory.prevSchema"
- :new-string="changeHistory.schema"
- output-format="side-by-side"
- data-label="bb-change-history-code-diff-block"
- />
- <template v-else>
- <highlight-code-block
- v-if="changeHistory.schema"
- class="border mt-2 px-2 whitespace-pre-wrap w-full"
- :code="changeHistory.schema"
- data-label="bb-change-history-code-block"
+ <code-diff
+ v-if="state.showDiff"
+ class="mt-4 w-full"
+ :old-string="changeHistory.prevSchema"
+ :new-string="changeHistory.schema"
+ output-format="side-by-side"
+ data-label="bb-change-history-code-diff-block"
/>
- <div v-else class="mt-2">
- {{ $t("change-history.current-schema-empty") }}
- </div>
+ <template v-else>
+ <highlight-code-block
+ v-if="changeHistory.schema"
+ class="border mt-2 px-2 whitespace-pre-wrap w-full"
+ :code="changeHistory.schema"
+ data-label="bb-change-history-code-block"
+ />
+ <div v-else class="mt-2">
+ {{ $t("change-history.current-schema-empty") }}
+ </div>
+ </template>
</template>
</div>
</main>
@@ -283,8 +285,10 @@ import {
useDBSchemaV1Store,
useDatabaseV1Store,
useUserStore,
+ useInstanceV1Store,
} from "@/store";
import { AffectedTable } from "@/types/changeHistory";
+import { Engine } from "@/types/proto/v1/common";
import {
ChangeHistory,
ChangeHistory_Type,
@@ -313,9 +317,14 @@ const props = defineProps<{
const databaseStore = useDatabaseV1Store();
const dbSchemaStore = useDBSchemaV1Store();
+const instanceStore = useInstanceV1Store();
const changeHistoryStore = useChangeHistoryStore();
const selectedAffectedTable = ref<AffectedTable | undefined>();
+const v1Instance = computed(() => {
+ return instanceStore.getInstanceByName(`instances/${props.instance}`);
+});
+
const database = computed(() => {
return databaseStore.getDatabaseByName(changeHistoryParent.value);
});
@@ -336,6 +345,10 @@ const affectedTables = computed(() => {
return getAffectedTablesOfChangeHistory(changeHistory.value);
});
+const showSchemaSnapshot = computed(() => {
+ return v1Instance.value.engine !== Engine.RISINGWAVE;
+});
+
watch(
changeHistoryParent,
async (parent) => {