Skip to content

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

Require to specify branch_filter

天舟7a770fcb6428
diff --git a/backend/store/migration/0001_init_schema.up.sql b/backend/store/migration/0001_init_schema.up.sql
index b342dbce6d..1870f40725 100644
--- a/backend/store/migration/0001_init_schema.up.sql
+++ b/backend/store/migration/0001_init_schema.up.sql
@@ -712,7 +712,7 @@ CREATE TABLE repo (
base_directory TEXT NOT NULL DEFAULT '',
-- Branch we are interested.
-- For GitLab, this corresponds to webhook's push_events_branch_filter. Wildcard is supported
- branch_filter TEXT NOT NULL DEFAULT '',
+ branch_filter TEXT NOT NULL CHECK (trim(branch_filter) != ''),
-- Repo id from the corresponding VCS provider.
-- For GitLab, this is the project id. e.g. 123
external_id TEXT NOT NULL,
diff --git a/backend/store/seed/0170_repo.sql b/backend/store/seed/0170_repo.sql
index dd73fb117e..dc274f4489 100644
--- a/backend/store/seed/0170_repo.sql
+++ b/backend/store/seed/0170_repo.sql
@@ -25,7 +25,7 @@ VALUES
"bytebase-test/project1",
"http://gitlab.bytebase.com/bytebase-test/project1",
"bytebase",
- "feature/*",
+ "master",
-- Refers to the bytebase-test/project1
"7",
-- Refers to the webhook in bytebase-test/project1
diff --git a/frontend/src/components/RepositoryDetail.vue b/frontend/src/components/RepositoryDetail.vue
index 1ae61d3265..52ccf0fbfa 100644
--- a/frontend/src/components/RepositoryDetail.vue
+++ b/frontend/src/components/RepositoryDetail.vue
@@ -54,6 +54,7 @@
<script lang="ts">
import { computed, PropType, reactive, watch } from "vue";
+import isEmpty from "lodash-es/isEmpty";
import RepositoryForm from "./RepositoryForm.vue";
import {
Repository,
@@ -112,9 +113,10 @@ export default {
const allowUpdate = computed(() => {
return (
- props.repository.baseDirectory !=
+ !isEmpty(state.repositoryConfig.branchFilter) &&
+ (props.repository.baseDirectory !=
state.repositoryConfig.baseDirectory ||
- props.repository.branchFilter != state.repositoryConfig.branchFilter
+ props.repository.branchFilter != state.repositoryConfig.branchFilter)
);
});
diff --git a/frontend/src/components/RepositoryForm.vue b/frontend/src/components/RepositoryForm.vue
index 804a92d0a4..7bea02d7b9 100644
--- a/frontend/src/components/RepositoryForm.vue
+++ b/frontend/src/components/RepositoryForm.vue
@@ -52,18 +52,16 @@
/>
</div>
<div>
- <div class="textlabel">Branch</div>
+ <div class="textlabel">Branch <span class="text-red-600">*</span></div>
<div class="mt-1 textinfolabel">
- The branch where Bytebase observes the SQL file (.sql) change. If empty,
- then Bytebase will observe the default branch (normally it's the
- 'master' or 'main' branch).
+ The branch where Bytebase observes the SQL file (.sql) change.
</div>
<input
id="branch"
name="branch"
type="text"
class="textfield mt-2 w-full"
- placeholder="Default branch (normally 'master' or 'main')"
+ placeholder="e.g. master"
v-model="repositoryConfig.branchFilter"
/>
<div v-if="vcsType == 'GITLAB_SELF_HOST'" class="mt-2 textinfolabel">
diff --git a/frontend/src/components/RepositorySetupWizard.vue b/frontend/src/components/RepositorySetupWizard.vue
index dc89638753..0f864994b4 100644
--- a/frontend/src/components/RepositorySetupWizard.vue
+++ b/frontend/src/components/RepositorySetupWizard.vue
@@ -2,6 +2,7 @@
<div>
<BBStepTab
:stepItemList="stepList"
+ :allowNext="allowNext"
@try-change-step="tryChangeStep"
@try-finish="tryFinishSetup"
@cancel="cancel"
@@ -21,10 +22,11 @@
<script lang="ts">
import { reactive } from "@vue/reactivity";
-import { PropType } from "@vue/runtime-core";
-import { BBStepTabItem } from "../bbkit/types";
+import { computed, PropType } from "@vue/runtime-core";
import { useStore } from "vuex";
import { useRouter } from "vue-router";
+import isEmpty from "lodash-es/isEmpty";
+import { BBStepTabItem } from "../bbkit/types";
import RepositoryVCSProviderPanel from "./RepositoryVCSProviderPanel.vue";
import RepositorySelectionPanel from "./RepositorySelectionPanel.vue";
import RepositoryConfigPanel from "./RepositoryConfigPanel.vue";
@@ -98,6 +100,13 @@ export default {
currentStep: CHOOSE_PROVIDER_STEP,
});
+ const allowNext = computed((): boolean => {
+ if (state.currentStep == CONFIGURE_DEPLOY_STEP) {
+ return !isEmpty(state.config.repositoryConfig.branchFilter);
+ }
+ return true;
+ });
+
const tryChangeStep = (
oldStep: number,
newStep: number,
@@ -165,6 +174,7 @@ export default {
return {
state,
stepList,
+ allowNext,
tryChangeStep,
tryFinishSetup,
cancel,