Skip to content

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

Remove “Admin” data source type. For v1, we don’t need SUPER privilege, RW is sufficient

天舟b9b87f6f29ef
diff --git a/frontend/src/components/DataSourceTable.vue b/frontend/src/components/DataSourceTable.vue
index dd42e2a1cd..b355f95453 100644
--- a/frontend/src/components/DataSourceTable.vue
+++ b/frontend/src/components/DataSourceTable.vue
@@ -112,7 +112,6 @@ export default {
});
const dataSourceSectionList = computed(() => {
- const adminList = [];
const readWriteList = [];
const readOnlyList = [];
for (const item of store.getters["dataSource/dataSourceListByInstanceId"](
@@ -125,9 +124,7 @@ export default {
.toLowerCase()
.includes(state.searchText.toLowerCase())
) {
- if (item.type === "ADMIN") {
- adminList.push(item);
- } else if (item.type === "RW") {
+ if (item.type === "RW") {
readWriteList.push(item);
} else if (item.type === "RO") {
readOnlyList.push(item);
@@ -135,10 +132,6 @@ export default {
}
}
const dataSource = [];
- dataSource.push({
- title: "Admin",
- list: adminList,
- });
dataSource.push({
title: "Read and write",
list: readWriteList,
diff --git a/frontend/src/miragejs/factories/dataSource.js b/frontend/src/miragejs/factories/dataSource.js
index 59f97a1ee1..b34d5f7030 100644
--- a/frontend/src/miragejs/factories/dataSource.js
+++ b/frontend/src/miragejs/factories/dataSource.js
@@ -12,13 +12,10 @@ export default {
return Date.now() - i * 3600 * 1000;
},
type(i) {
- if (i % 3 == 0) {
- return "ADMIN";
- }
- if (i % 3 == 1) {
+ if (i % 2 == 0) {
return "RW";
}
- if (i % 3 == 2) {
+ if (i % 2 == 1) {
return "RO";
}
},
diff --git a/frontend/src/miragejs/factories/instance.js b/frontend/src/miragejs/factories/instance.js
index 047ea95ad7..e7eb10aace 100644
--- a/frontend/src/miragejs/factories/instance.js
+++ b/frontend/src/miragejs/factories/instance.js
@@ -42,7 +42,7 @@ export default {
server.create("dataSource", {
instance,
name: instance.name + " admin ds1",
- type: "ADMIN",
+ type: "RW",
});
for (let i = 0; i < 3; i++) {
@@ -54,19 +54,19 @@ export default {
server.create("dataSource", {
instance,
database,
- name: instance.name + " " + " admin ds2",
- type: "ADMIN",
- username: "root",
- password: "pwdRoot",
+ name: instance.name + " " + " rw ds2",
+ type: "RW",
+ username: "rootRW",
+ password: "pwdRW",
});
server.create("dataSource", {
instance,
database,
- name: instance.name + " " + " rw ds3",
- type: "RW",
- username: "rootRW",
- password: "pwdRW",
+ name: instance.name + " " + " ro ds3",
+ type: "RO",
+ username: "rootRO",
+ password: "pwdRO",
});
server.create("dataSource", {
diff --git a/frontend/src/store/modules/dataSource.ts b/frontend/src/store/modules/dataSource.ts
index a7b0d105c2..268c2985f0 100644
--- a/frontend/src/store/modules/dataSource.ts
+++ b/frontend/src/store/modules/dataSource.ts
@@ -38,7 +38,7 @@ const getters = {
const list = state.dataSourceListByInstanceId.get(instanceId);
if (list) {
for (const item of list) {
- if (item.type == "ADMIN") {
+ if (item.type == "RW") {
return item;
}
}
diff --git a/frontend/src/types/bytebase.ts b/frontend/src/types/bytebase.ts
index 1cf21572f8..8e94ae885a 100644
--- a/frontend/src/types/bytebase.ts
+++ b/frontend/src/types/bytebase.ts
@@ -231,7 +231,7 @@ export type Instance = {
};
export type InstanceNew = Omit<Instance, "id">;
-export type DataSourceType = "ADMIN" | "RW" | "RO";
+export type DataSourceType = "RW" | "RO";
// Data Source
export type DataSource = {
id: string;
diff --git a/frontend/src/views/InstanceDetail.vue b/frontend/src/views/InstanceDetail.vue
index 204da7725f..0d8a76f9bf 100644
--- a/frontend/src/views/InstanceDetail.vue
+++ b/frontend/src/views/InstanceDetail.vue
@@ -117,17 +117,17 @@ input[type="number"] {
/>
</div>
</div>
- <!-- Datasource Info -->
+ <!-- Read/Write Datasource Info -->
<div class="pt-6">
<div class="flex justify-between">
<div>
<h3 class="text-lg leading-6 font-medium text-gray-900">
- Admin Data Source Info
+ Read/Write Data Source Info
</h3>
<p class="mt-1 text-sm text-gray-500">
- This data source usually has admin/super privilege and is the
- default data source used by the instance owner (e.g. DBA) connecting
- to the instance to perform administrative operations.
+ This is the data source used by bytebase to perform DDL and
+ non-SELECT DML operations. Note, bytebase does NOT need admin/SUPER
+ privilege. TODO: Add grant statement.
</p>
</div>
</div>
@@ -309,8 +309,8 @@ import EnvironmentSelect from "../components/EnvironmentSelect.vue";
import { Instance, InstanceNew, DataSource, DataSourceNew } from "../types";
const INIT_DATA_SOURCE: DataSourceNew = {
- name: "Admin Data Source",
- type: "ADMIN",
+ name: "Read/Write Data Source",
+ type: "RW",
username: "root",
};