Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
feat: add a promot for altering snowflake engine
zhouzilong202007ac975fe793
diff --git a/frontend/src/components/IssueSidebar.vue b/frontend/src/components/IssueSidebar.vueindex 2015308b7b..a662fa7e12 100644--- a/frontend/src/components/IssueSidebar.vue+++ b/frontend/src/components/IssueSidebar.vue@@ -191,7 +191,7 @@</template><script lang="ts">-import { computed, PropType, reactive } from "vue";+import { computed, ComputedRef, PropType, reactive } from "vue";import { useStore } from "vuex";import isEqual from "lodash-es/isEqual";import DatabaseSelect from "../components/DatabaseSelect.vue";@@ -253,6 +253,14 @@ export default {required: true,type: Boolean,},+ database: {+ required: true,+ type: Object as PropType<ComputedRef<Database> | ComputedRef<undefined>>,+ },+ instance: {+ required: true,+ type: Object as PropType<ComputedRef<Instance>>,+ },},components: {DatabaseSelect,@@ -277,24 +285,9 @@ export default {return props.issue.payload[field.id];};- const database = computed((): Database | undefined => {- if (props.create) {- const stage = props.selectedStage as StageCreate;- if (stage.taskList[0].databaseId) {- return store.getters["database/databaseById"](- stage.taskList[0].databaseId- );- }- return undefined;- }-- const stage = props.selectedStage as Stage;- return stage.taskList[0].database;- });-const databaseName = computed((): string | undefined => {- if (database.value) {- return database.value.name;+ if (props.database.value) {+ return props.database.value.name;}const stage = props.selectedStage as Stage;@@ -313,22 +306,6 @@ export default {return undefined;});- const instance = computed((): Instance => {- if (props.create) {- // If database is available, then we derive the instance from database because we always fetch database's instance.- // On the other hand, instance for stage.taskList[0].instanceId might not be loaded (e.g. when creating an update schema issue)- if (database.value) {- return database.value.instance;- }- const stage = props.selectedStage as StageCreate;- return store.getters["instance/instanceById"](- stage.taskList[0].instanceId- );- }- const stage = props.selectedStage as Stage;- return stage.taskList[0].instance;- });-const environment = computed((): Environment => {if (props.create) {const stage = props.selectedStage as StageCreate;@@ -404,16 +381,19 @@ export default {});const clickDatabase = () => {- if (database.value) {+ if (props.database.value) {router.push({name: "workspace.database.detail",params: {- databaseSlug: databaseSlug(database.value),+ databaseSlug: databaseSlug(props.database.value),},});} else {store- .dispatch("database/fetchDatabaseListByInstanceId", instance.value.id)+ .dispatch(+ "database/fetchDatabaseListByInstanceId",+ props.instance.value.id+ ).then((list: Database[]) => {for (const database of list) {if (database.name == databaseName.value) {@@ -435,8 +415,6 @@ export default {state,fieldValue,environment,- instance,- database,databaseName,project,showInstance,diff --git a/frontend/src/components/IssueTaskStatementPanel.vue b/frontend/src/components/IssueTaskStatementPanel.vueindex 083f153b50..6a395160bc 100644--- a/frontend/src/components/IssueTaskStatementPanel.vue+++ b/frontend/src/components/IssueTaskStatementPanel.vue@@ -11,6 +11,7 @@>{{ rollback ? "Rollback SQL" : "SQL" }}<span v-if="create && !rollback" class="text-red-600">*</span>+ <span class="text-accent">{{ hintForSQL }}</span><spanv-if="!create && !rollback && migrationType == 'BASELINE'"class="text-accent"@@ -193,6 +194,10 @@ export default {required: true,type: Boolean,},+ hintForSQL: {+ required: false,+ type: String,+ },},components: {},setup(props, { emit }) {diff --git a/frontend/src/views/IssueDetail.vue b/frontend/src/views/IssueDetail.vueindex 8f900dd362..a58d67d169 100644--- a/frontend/src/views/IssueDetail.vue+++ b/frontend/src/views/IssueDetail.vue@@ -123,6 +123,8 @@><IssueSidebar:issue="issue"+ :database="database"+ :instance="instance":create="state.create":selectedStage="selectedStage":inputFieldList="issueTemplate.inputFieldList"@@ -150,6 +152,7 @@list every IssueTaskStatementPanel for each stage and use v-if to show the active one. --><template v-if="state.create"><IssueTaskStatementPanel+ :hintForSQL="hintForSQL":statement="selectedStatement":create="state.create":allowEdit="true"@@ -167,6 +170,7 @@><template v-if="selectedStage.id == stage.id"><IssueTaskStatementPanel+ :hintForSQL="hintForSQL":statement="statement(stage)":create="state.create":allowEdit="allowEditStatement"@@ -247,6 +251,7 @@ import {watchEffect,reactive,ref,+ ComputedRef,} from "vue";import { useStore } from "vuex";import { useRouter } from "vue-router";@@ -281,6 +286,7 @@ import {IssuePatch,PrincipalId,Database,+ Instance,Environment,Stage,StageId,@@ -1171,9 +1177,50 @@ export default {return count > 1;});+ const database = computed((): Database | undefined => {+ const temp = selectedStage as unknown;+ if (create) {+ const stage = temp as ComputedRef<StageCreate>;+ const databaseId = stage.value.taskList[0].databaseId;+ if (databaseId) {+ return store.getters["database/databaseById"](databaseId);+ }++ return undefined;+ }+ const stage = temp as ComputedRef<Stage>;+ return stage.value.taskList[0].database;+ });++ const instance = computed((): Instance => {+ const temp = selectedStage as unknown;+ if (create) {+ // If database is available, then we derive the instance from database because we always fetch database's instance.+ // On the other hand, instance for stage.taskList[0].instanceId might not be loaded (e.g. when creating an update schema issue)+ if (database.value) {+ return database.value.instance;+ }+ const stage = temp as StageCreate;+ return store.getters["instance/instanceById"](+ stage.taskList[0].instanceId+ );+ }+ const stage = temp as Stage;+ return stage.taskList[0].instance;+ });++ const hintForSQL = computed(() => {+ return instance.value.engine === "SNOWFLAKE"+ ? ` your are altering a snowflake database, please add <schema> before each tabel altered`+ : "";+ });+return {state,issue,+ database,+ instance,+ hintForSQL,updateName,updateDescription,updateStatement,