Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
Add clickhouse to instance form
天舟0737c64fe962
diff --git a/frontend/src/assets/db-clickhouse.png b/frontend/src/assets/db-clickhouse.pngnew file mode 100644index 0000000000..a0988a4e7fBinary files /dev/null and b/frontend/src/assets/db-clickhouse.png differdiff --git a/frontend/src/components/InstanceEngineIcon.vue b/frontend/src/components/InstanceEngineIcon.vueindex 11925f8fc6..871fee3ea4 100644--- a/frontend/src/components/InstanceEngineIcon.vue+++ b/frontend/src/components/InstanceEngineIcon.vue@@ -1,6 +1,11 @@<template><div class="tooltip-wrapper"><span class="tooltip">{{ instance.engineVersion }}</span>+ <img+ v-if="instance.engine == 'CLICKHOUSE'"+ class="h-4 w-auto"+ src="../assets/db-clickhouse.png"+ /><imgv-if="instance.engine == 'MYSQL'"class="h-4 w-auto"diff --git a/frontend/src/components/InstanceForm.vue b/frontend/src/components/InstanceForm.vueindex 639f07d3a3..1ff173883b 100644--- a/frontend/src/components/InstanceForm.vue+++ b/frontend/src/components/InstanceForm.vue@@ -17,7 +17,7 @@ input[type="number"] {<div class="space-y-6 divide-y divide-block-border px-1"><div v-if="create" class="grid grid-cols-1 gap-4 sm:grid-cols-6"><template- v-for="(engine, index) in ['MYSQL', 'POSTGRES', 'TIDB']"+ v-for="(engine, index) in ['MYSQL', 'POSTGRES', 'TIDB', 'CLICKHOUSE']":key="index"><div@@ -38,7 +38,7 @@ input[type="number"] {<template v-if="engine == 'MYSQL'"><img class="h-8 w-auto" src="../assets/db-mysql.png" alt="" /></template>- <template v-if="engine == 'POSTGRES'">+ <template v-else-if="engine == 'POSTGRES'"><imgclass="h-8 w-auto"src="../assets/db-postgres.png"@@ -48,6 +48,13 @@ input[type="number"] {<template v-else-if="engine == 'TIDB'"><img class="h-8 w-auto" src="../assets/db-tidb.png" /></template>+ <template v-else-if="engine == 'CLICKHOUSE'">+ <img+ class="h-8 w-auto"+ src="../assets/db-clickhouse.png"+ alt=""+ />+ </template><p class="mt-1 text-center textlabel">{{ engineName(engine) }}</p>@@ -216,6 +223,7 @@ input[type="number"] {><templatev-if="+ state.instance.engine == 'CLICKHOUSE' ||state.instance.engine == 'MYSQL' ||state.instance.engine == 'TIDB'"@@ -305,6 +313,9 @@ input[type="number"] {type="text"class="textfield mt-1 w-full":disabled="!allowEdit"+ :placeholder="+ state.instance.engine == 'CLICKHOUSE' ? 'default' : ''+ ":value="state.instance.username"@input="state.instance.username = $event.target.value"/>@@ -536,7 +547,9 @@ export default {});const defaultPort = computed(() => {- if (state.instance.engine == "POSTGRES") {+ if (state.instance.engine == "CLICKHOUSE") {+ return "9000";+ } else if (state.instance.engine == "POSTGRES") {return "5432";} else if (state.instance.engine == "TIDB") {return "4000";@@ -546,6 +559,8 @@ export default {const engineName = (type: EngineType): string => {switch (type) {+ case "CLICKHOUSE":+ return "ClickHouse";case "MYSQL":return "MySQL";case "POSTGRES":@@ -557,6 +572,7 @@ export default {const grantStatement = (type: EngineType): string => {switch (type) {+ case "CLICKHOUSE":case "MYSQL":case "TIDB":return "CREATE USER bytebase@'%' IDENTIFIED BY 'YOUR_DB_PWD';\n\nGRANT ALTER, ALTER ROUTINE, CREATE, CREATE ROUTINE, CREATE VIEW, \nDELETE, DROP, EXECUTE, INDEX, INSERT, PROCESS, REFERENCES, \nSELECT, SHOW DATABASES, SHOW VIEW, TRIGGER, UPDATE, USAGE \nON *.* to bytebase@'%';";diff --git a/frontend/src/types/instance.ts b/frontend/src/types/instance.tsindex cd9ba9a7ee..3408771d18 100644--- a/frontend/src/types/instance.ts+++ b/frontend/src/types/instance.ts@@ -5,10 +5,11 @@ import { EnvironmentId, InstanceId, MigrationHistoryId } from "./id";import { Principal } from "./principal";import { VCSPushEvent } from "./vcs";-export type EngineType = "MYSQL" | "POSTGRES" | "TIDB";+export type EngineType = "CLICKHOUSE" | "MYSQL" | "POSTGRES" | "TIDB";export function defaultCharset(type: EngineType): string {switch (type) {+ case "CLICKHOUSE":case "MYSQL":case "TIDB":return "utf8mb4";@@ -19,6 +20,7 @@ export function defaultCharset(type: EngineType): string {export function defaultCollation(type: EngineType): string {switch (type) {+ case "CLICKHOUSE":case "MYSQL":case "TIDB":return "utf8mb4_general_ci";