Skip to content

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

Add schema update stub

Tianzhou Chen54ab8b368d48
diff --git a/frontend/src/components/QuickActionPanel.vue b/frontend/src/components/QuickActionPanel.vue
index 814e00afa2..4abb71d974 100644
--- a/frontend/src/components/QuickActionPanel.vue
+++ b/frontend/src/components/QuickActionPanel.vue
@@ -136,25 +136,30 @@
</div>
<div
- v-if="quickActionList.includes('datasource.schema.edit')"
+ v-if="quickActionList.includes('datasource.schema.update')"
class="flex flex-col items-center w-28"
>
- <button class="btn-icon-primary p-3">
- <svg
- class="w-6 h-6"
- fill="none"
- stroke="currentColor"
- viewBox="0 0 24 24"
- xmlns="http://www.w3.org/2000/svg"
- >
- <path
- stroke-linecap="round"
- stroke-linejoin="round"
- stroke-width="2"
- d="M3 10h18M3 14h18m-9-4v8m-7 0h14a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v8a2 2 0 002 2z"
- ></path>
- </svg>
- </button>
+ <router-link
+ to="/task/new?template=bytebase.datasource.schema.update"
+ class=""
+ >
+ <span class="btn-icon-primary inline-flex p-3">
+ <svg
+ class="w-6 h-6"
+ fill="none"
+ stroke="currentColor"
+ viewBox="0 0 24 24"
+ xmlns="http://www.w3.org/2000/svg"
+ >
+ <path
+ stroke-linecap="round"
+ stroke-linejoin="round"
+ stroke-width="2"
+ d="M3 10h18M3 14h18m-9-4v8m-7 0h14a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v8a2 2 0 002 2z"
+ ></path>
+ </svg>
+ </span>
+ </router-link>
<h3 class="mt-1 text-center text-base font-normal text-main">
Edit Schema
</h3>
diff --git a/frontend/src/plugins/task/template.ts b/frontend/src/plugins/task/template.ts
index 727a88a2ea..492c4d699f 100644
--- a/frontend/src/plugins/task/template.ts
+++ b/frontend/src/plugins/task/template.ts
@@ -78,4 +78,46 @@ export const taskTemplateList: TaskTemplate[] = [
},
],
},
+ {
+ type: "bytebase.datasource.schema.update",
+ buildTask: (ctx: TemplateContext): TaskNew => {
+ return {
+ type: "task",
+ attributes: {
+ name: "Update Schema",
+ type: "bytebase.datasource.schema.update",
+ content: "DDL: ",
+ stageProgressList: ctx.environmentList.map((env) => {
+ return {
+ id: env.id,
+ name: env.attributes.name,
+ type: "ENVIRONMENT",
+ status: "PENDING",
+ };
+ }),
+ creator: {
+ id: ctx.currentUser.id,
+ name: ctx.currentUser.attributes.name,
+ },
+ payload: {},
+ },
+ };
+ },
+ fieldList: [
+ {
+ category: "INPUT",
+ id: 1,
+ slug: "db",
+ name: "Database Name",
+ type: "String",
+ required: true,
+ preprocessor: (name: string): string => {
+ // In case caller passes corrupted data.
+ // Handled here instead of the caller, because it's
+ // preprocessor specific behavior to handle fallback.
+ return name?.toLowerCase();
+ },
+ },
+ ],
+ },
];
diff --git a/frontend/src/router/index.ts b/frontend/src/router/index.ts
index c431db25cb..55c0b78614 100644
--- a/frontend/src/router/index.ts
+++ b/frontend/src/router/index.ts
@@ -57,7 +57,7 @@ const routes: Array<RouteRecordRaw> = [
"instance.create",
"user.manage",
"datasource.create",
- "datasource.schema.edit",
+ "datasource.schema.update",
"ticket.create",
],
},
diff --git a/frontend/src/types/bytebase.ts b/frontend/src/types/bytebase.ts
index c03fec0388..7a3ed2d0c1 100644
--- a/frontend/src/types/bytebase.ts
+++ b/frontend/src/types/bytebase.ts
@@ -64,7 +64,9 @@ export type StageProgress = Stage & {
// Task
type TaskTypeGeneral = "bytebase.general";
-type TaskTypeDataSource = "bytebase.datasource.create";
+type TaskTypeDataSource =
+ | "bytebase.datasource.create"
+ | "bytebase.datasource.schema.update";
export type TaskType = TaskTypeGeneral | TaskTypeDataSource;