Skip to content

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

Disable create button if sql statement is empty

天舟fa2828172fa8
diff --git a/frontend/src/components/IssueStatusTransitionButtonGroup.vue b/frontend/src/components/IssueStatusTransitionButtonGroup.vue
index 76b5ddd5d7..48468101df 100644
--- a/frontend/src/components/IssueStatusTransitionButtonGroup.vue
+++ b/frontend/src/components/IssueStatusTransitionButtonGroup.vue
@@ -394,6 +394,24 @@ export default {
return false;
}
+ if (
+ newIssue.type == "bb.issue.database.create" ||
+ newIssue.type == "bb.issue.database.schema.update"
+ ) {
+ for (const stage of newIssue.pipeline.stageList) {
+ for (const task of stage.taskList) {
+ if (
+ task.type == "bb.task.database.create" ||
+ task.type == "bb.task.database.schema.update"
+ ) {
+ if (isEmpty(task.statement)) {
+ return false;
+ }
+ }
+ }
+ }
+ }
+
for (const field of props.issueTemplate.inputFieldList) {
if (
field.type != "Boolean" && // Switch is boolean value which always is present
diff --git a/frontend/src/views/IssueTaskStatementPanel.vue b/frontend/src/views/IssueTaskStatementPanel.vue
index e60ec7d2c4..88ffd296fd 100644
--- a/frontend/src/views/IssueTaskStatementPanel.vue
+++ b/frontend/src/views/IssueTaskStatementPanel.vue
@@ -2,6 +2,7 @@
<div class="flex justify-between">
<div class="textlabel">
{{ rollback ? "Rollback SQL" : "SQL" }}
+ <span v-if="create && !rollback" class="text-red-600">*</span>
</div>
</div>
<label class="sr-only">SQL statement</label>
@@ -18,7 +19,11 @@
outline-none
"
:class="state.editing ? 'focus:ring-control focus-visible:ring-2' : ''"
- placeholder="Add SQL statement..."
+ :placeholder="
+ create && rollback
+ ? 'Add SQL statement...'
+ : '(Required) Add SQL statement...'
+ "
v-model="state.editStatement"
@input="
(e) => {