Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
Try creating the migration schema if updating connetion related info
天舟e38316f353b1
diff --git a/frontend/src/components/InstanceForm.vue b/frontend/src/components/InstanceForm.vueindex c8c374e528..1666408b0a 100644--- a/frontend/src/components/InstanceForm.vue+++ b/frontend/src/components/InstanceForm.vue@@ -342,15 +342,15 @@ input[type="number"] {<!-- Action Button Group --><div class="pt-4"><!-- Create button group -->- <div v-if="create" class="flex justify-between">+ <div v-if="create" class="flex justify-end items-center"><div>- <BBSpin v-if="state.creating" :title="'Creating...'" />+ <BBSpin v-if="state.creatingOrUpdating" :title="'Creating...'" /></div>- <div>+ <div class="ml-2"><buttontype="button"class="btn-normal py-2 px-4"- :disabled="state.creating"+ :disabled="state.creatingOrUpdating"@click.prevent="cancel">Cancel@@ -358,7 +358,7 @@ input[type="number"] {<buttontype="button"class="btn-primary ml-3 inline-flex justify-center py-2 px-4"- :disabled="!allowCreate || state.creating"+ :disabled="!allowCreate || state.creatingOrUpdating"@click.prevent="tryCreate">Create@@ -366,12 +366,15 @@ input[type="number"] {</div></div><!-- Update button group -->- <div v-else class="flex justify-end">+ <div v-else class="flex justify-end items-center">+ <div>+ <BBSpin v-if="state.creatingOrUpdating" :title="'Updating...'" />+ </div><buttonv-if="allowEdit"type="button"- class="btn-normal ml-3 inline-flex justify-center py-2 px-4"- :disabled="!valueChanged"+ class="btn-normal ml-2 inline-flex justify-center py-2 px-4"+ :disabled="!valueChanged || state.creatingOrUpdating"@click.prevent="doUpdate">Update@@ -428,7 +431,7 @@ interface LocalState {showCreateInstanceWarningModal: boolean;createInstanceWarning: string;showCreateUserExample: boolean;- creating: boolean;+ creatingOrUpdating: boolean;}export default {@@ -472,7 +475,7 @@ export default {showCreateInstanceWarningModal: false,createInstanceWarning: "",showCreateUserExample: props.create,- creating: false,+ creatingOrUpdating: false,});const allowCreate = computed(() => {@@ -559,11 +562,11 @@ export default {// stored in that data source object instead of in the instance self.// Conceptually, data source is the proper place to store connnection info (thinking of DSN)const doCreate = () => {- state.creating = true;+ state.creatingOrUpdating = true;store.dispatch("instance/createInstance", state.instance).then((createdInstance) => {- state.creating = false;+ state.creatingOrUpdating = false;emit("dismiss");router.push(`/instance/${instanceSlug(createdInstance)}`);@@ -600,12 +603,14 @@ export default {patchedInstance.password = state.updatedPassword;}+ state.creatingOrUpdating = true;store.dispatch("instance/patchInstance", {instanceId: (state.instance as Instance).id,instancePatch: patchedInstance,}).then((instance) => {+ state.creatingOrUpdating = false;state.originalInstance = instance;// Make hard copy since we are going to make equal comparsion to determine the update button enable state.state.instance = cloneDeep(state.originalInstance!);diff --git a/frontend/src/store/modules/instance.ts b/frontend/src/store/modules/instance.tsindex defd9a39ca..cafdfdf9d0 100644--- a/frontend/src/store/modules/instance.ts+++ b/frontend/src/store/modules/instance.ts@@ -267,12 +267,18 @@ const actions = {}) {const data = (- await axios.patch(`/api/instance/${instanceId}`, {- data: {- type: "instancePatch",- attributes: instancePatch,+ await axios.patch(+ `/api/instance/${instanceId}`,+ {+ data: {+ type: "instancePatch",+ attributes: instancePatch,+ },},- })+ {+ timeout: CREATE_MIGRATION_SCHEMA_TIMEOUT,+ }+ )).data;const updatedInstance = convert(data.data, data.included, rootGetters);diff --git a/server/instance.go b/server/instance.goindex 39f8b526be..deec6320bb 100644--- a/server/instance.go+++ b/server/instance.go@@ -161,9 +161,14 @@ func (s *Server) registerInstanceRoutes(g *echo.Group) {return err}+ // Try immediately setup the migration schema, sync the engine version and schema after updating any connection related info.if instancePatch.Host != nil || instancePatch.Port != nil || instancePatch.Username != nil || instancePatch.Password != nil {- // Try immediately sync the engine version and schema after updating any connection related info.- s.SyncEngineVersionAndSchema(instance)+ db, err := GetDatabaseDriver(instance, "", s.l)+ if err == nil {+ defer db.Close(context.Background())+ db.SetupMigrationIfNeeded(context.Background())+ s.SyncEngineVersionAndSchema(instance)+ }}c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)