Skip to content

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

feat(differ): ignore backup schema for PG in schema synchronization (#14107)

rebelice29314bedaab5
diff --git a/backend/api/v1/database_service.go b/backend/api/v1/database_service.go
index fbb6bc8480..054597c329 100644
--- a/backend/api/v1/database_service.go
+++ b/backend/api/v1/database_service.go
@@ -29,6 +29,7 @@ import (
api "github.com/bytebase/bytebase/backend/legacyapi"
"github.com/bytebase/bytebase/backend/plugin/db"
"github.com/bytebase/bytebase/backend/plugin/parser/base"
+ "github.com/bytebase/bytebase/backend/plugin/parser/pg"
"github.com/bytebase/bytebase/backend/plugin/parser/plsql"
"github.com/bytebase/bytebase/backend/plugin/parser/sql/ast"
pgrawparser "github.com/bytebase/bytebase/backend/plugin/parser/sql/engine/pg"
@@ -706,6 +707,12 @@ func (s *DatabaseService) GetDatabaseSchema(ctx context.Context, request *v1pb.G
return nil, status.Errorf(codes.Internal, "failed to get concise schema, error %v", err.Error())
}
schema = conciseSchema
+ case storepb.Engine_POSTGRES:
+ conciseSchema, err := pg.FilterBackupSchema(schema)
+ if err != nil {
+ return nil, status.Errorf(codes.Internal, "failed to filter backup schema, error %v", err.Error())
+ }
+ schema = conciseSchema
default:
return nil, status.Errorf(codes.Unimplemented, "concise schema is not supported for engine %q", instance.Engine.String())
}
@@ -890,6 +897,12 @@ func (s *DatabaseService) GetChangeHistory(ctx context.Context, request *v1pb.Ge
return nil, status.Errorf(codes.Internal, "failed to get concise schema, error %v", err.Error())
}
converted.Schema = conciseSchema
+ case storepb.Engine_POSTGRES:
+ conciseSchema, err := pg.FilterBackupSchema(converted.Schema)
+ if err != nil {
+ return nil, status.Errorf(codes.Internal, "failed to filter the backup schema, error %v", err.Error())
+ }
+ converted.Schema = conciseSchema
default:
return nil, status.Errorf(codes.Unimplemented, "concise schema is not supported for engine %q", instance.Engine.String())
}
@@ -915,8 +928,19 @@ func (s *DatabaseService) DiffSchema(ctx context.Context, request *v1pb.DiffSche
}
strictMode := true
- if engine == storepb.Engine_ORACLE {
+
+ switch engine {
+ case storepb.Engine_ORACLE:
strictMode = false
+ case storepb.Engine_POSTGRES:
+ source, err = pg.FilterBackupSchema(source)
+ if err != nil {
+ return nil, status.Errorf(codes.Internal, "failed to filter backup schema, error: %v", err)
+ }
+ target, err = pg.FilterBackupSchema(target)
+ if err != nil {
+ return nil, status.Errorf(codes.Internal, "failed to filter backup schema, error: %v", err)
+ }
}
diff, err := base.SchemaDiff(engine, base.DiffContext{
diff --git a/backend/plugin/parser/pg/filter.go b/backend/plugin/parser/pg/filter.go
new file mode 100644
index 0000000000..7d7015361a
--- /dev/null
+++ b/backend/plugin/parser/pg/filter.go
@@ -0,0 +1,256 @@
+package pg
+
+import (
+ "github.com/antlr4-go/antlr/v4"
+ parser "github.com/bytebase/postgresql-parser"
+)
+
+const (
+ backupSchemaName = "bbdataarchive"
+)
+
+func FilterBackupSchema(schema string) (string, error) {
+ parseResult, err := ParsePostgreSQL(schema)
+ if err != nil {
+ return "", err
+ }
+
+ listener := &FilterBackupSchemaListener{
+ rewriter: *antlr.NewTokenStreamRewriter(parseResult.Tokens),
+ }
+ antlr.ParseTreeWalkerDefault.Walk(listener, parseResult.Tree)
+ return listener.rewriter.GetText(antlr.DefaultProgramName, antlr.Interval{
+ Start: 0,
+ Stop: parseResult.Tokens.Size() - 1,
+ }), nil
+}
+
+type FilterBackupSchemaListener struct {
+ *parser.BasePostgreSQLParserListener
+
+ rewriter antlr.TokenStreamRewriter
+}
+
+func (l *FilterBackupSchemaListener) EnterCreateschemastmt(ctx *parser.CreateschemastmtContext) {
+ var schemaName string
+ if ctx.Colid() != nil {
+ schemaName = NormalizePostgreSQLColid(ctx.Colid())
+ } else if ctx.Optschemaname() != nil {
+ schemaName = NormalizePostgreSQLColid(ctx.Optschemaname().Colid())
+ }
+ if schemaName == backupSchemaName {
+ start := ctx.GetStart().GetTokenIndex()
+ stop := getFollowingTwoNewLine(ctx.GetParser(), ctx.GetStop().GetTokenIndex()+1)
+ l.rewriter.DeleteDefault(start, stop)
+ }
+}
+
+func (l *FilterBackupSchemaListener) EnterCreatestmt(ctx *parser.CreatestmtContext) {
+ list := NormalizePostgreSQLQualifiedName(ctx.Qualified_name(0))
+ if len(list) != 2 {
+ return
+ }
+ schemaName := list[0]
+ if schemaName == backupSchemaName {
+ start := ctx.GetStart().GetTokenIndex()
+ stop := getFollowingTwoNewLine(ctx.GetParser(), ctx.GetStop().GetTokenIndex()+1)
+ l.rewriter.DeleteDefault(start, stop)
+ }
+}
+
+func (l *FilterBackupSchemaListener) EnterViewstmt(ctx *parser.ViewstmtContext) {
+ list := NormalizePostgreSQLQualifiedName(ctx.Qualified_name())
+ if len(list) != 2 {
+ return
+ }
+ schemaName := list[0]
+ if schemaName == backupSchemaName {
+ start := ctx.GetStart().GetTokenIndex()
+ stop := getFollowingTwoNewLine(ctx.GetParser(), ctx.GetStop().GetTokenIndex()+1)
+ l.rewriter.DeleteDefault(start, stop)
+ }
+}
+
+func (l *FilterBackupSchemaListener) EnterAltertablestmt(ctx *parser.AltertablestmtContext) {
+ var schemaName string
+
+ switch {
+ case ctx.Relation_expr() != nil:
+ list := NormalizePostgreSQLQualifiedName(ctx.Relation_expr().Qualified_name())
+ if len(list) != 2 {
+ return
+ }
+ schemaName = list[0]
+ case ctx.Qualified_name() != nil:
+ list := NormalizePostgreSQLQualifiedName(ctx.Qualified_name())
+ if len(list) != 2 {
+ return
+ }
+ schemaName = list[0]
+ }
+
+ if schemaName == backupSchemaName {
+ start := ctx.GetStart().GetTokenIndex()
+ stop := getFollowingTwoNewLine(ctx.GetParser(), ctx.GetStop().GetTokenIndex()+1)
+ l.rewriter.DeleteDefault(start, stop)
+ }
+}
+
+func (l *FilterBackupSchemaListener) EnterIndexstmt(ctx *parser.IndexstmtContext) {
+ var schemaName string
+ if ctx.Relation_expr() != nil {
+ list := NormalizePostgreSQLQualifiedName(ctx.Relation_expr().Qualified_name())
+ if len(list) != 2 {
+ return
+ }
+ schemaName = list[0]
+ }
+
+ if schemaName == backupSchemaName {
+ start := ctx.GetStart().GetTokenIndex()
+ stop := getFollowingTwoNewLine(ctx.GetParser(), ctx.GetStop().GetTokenIndex()+1)
+ l.rewriter.DeleteDefault(start, stop)
+ }
+}
+
+func (l *FilterBackupSchemaListener) EnterCreateseqstmt(ctx *parser.CreateseqstmtContext) {
+ var schemaName string
+ list := NormalizePostgreSQLQualifiedName(ctx.Qualified_name())
+ if len(list) != 2 {
+ return
+ }
+ schemaName = list[0]
+
+ if schemaName == backupSchemaName {
+ start := ctx.GetStart().GetTokenIndex()
+ stop := getFollowingTwoNewLine(ctx.GetParser(), ctx.GetStop().GetTokenIndex()+1)
+ l.rewriter.DeleteDefault(start, stop)
+ }
+}
+
+func (l *FilterBackupSchemaListener) EnterAlterseqstmt(ctx *parser.AlterseqstmtContext) {
+ var schemaName string
+ list := NormalizePostgreSQLQualifiedName(ctx.Qualified_name())
+ if len(list) != 2 {
+ return
+ }
+ schemaName = list[0]
+
+ if schemaName == backupSchemaName {
+ start := ctx.GetStart().GetTokenIndex()
+ stop := getFollowingTwoNewLine(ctx.GetParser(), ctx.GetStop().GetTokenIndex()+1)
+ l.rewriter.DeleteDefault(start, stop)
+ }
+}
+
+func (l *FilterBackupSchemaListener) EnterCreateextensionstmt(ctx *parser.CreateextensionstmtContext) {
+ var schemaName string
+ for _, item := range ctx.Create_extension_opt_list().AllCreate_extension_opt_item() {
+ if item.SCHEMA() != nil {
+ schemaName = normalizePostgreSQLName(item.Name())
+ }
+ }
+
+ if schemaName == backupSchemaName {
+ start := ctx.GetStart().GetTokenIndex()
+ stop := getFollowingTwoNewLine(ctx.GetParser(), ctx.GetStop().GetTokenIndex()+1)
+ l.rewriter.DeleteDefault(start, stop)
+ }
+}
+
+func (l *FilterBackupSchemaListener) EnterCreatefunctionstmt(ctx *parser.CreatefunctionstmtContext) {
+ list := normalizePostgreSQLFuncName(ctx.Func_name())
+
+ if len(list) != 2 {
+ return
+ }
+ schemaName := list[0]
+
+ if schemaName == backupSchemaName {
+ start := ctx.GetStart().GetTokenIndex()
+ stop := getFollowingTwoNewLine(ctx.GetParser(), ctx.GetStop().GetTokenIndex()+1)
+ l.rewriter.DeleteDefault(start, stop)
+ }
+}
+
+func (l *FilterBackupSchemaListener) EnterCreatetrigstmt(ctx *parser.CreatetrigstmtContext) {
+ list := NormalizePostgreSQLQualifiedName(ctx.Qualified_name())
+ if len(list) != 2 {
+ return
+ }
+ schemaName := list[0]
+
+ if schemaName == backupSchemaName {
+ start := ctx.GetStart().GetTokenIndex()
+ stop := getFollowingTwoNewLine(ctx.GetParser(), ctx.GetStop().GetTokenIndex()+1)
+ l.rewriter.DeleteDefault(start, stop)
+ }
+}
+
+func (l *FilterBackupSchemaListener) EnterDefinestmt(ctx *parser.DefinestmtContext) {
+ if ctx.TYPE_P() != nil {
+ return
+ }
+
+ list := NormalizePostgreSQLAnyName(ctx.Any_name(0))
+ if len(list) != 2 {
+ return
+ }
+ schemaName := list[0]
+
+ if schemaName == backupSchemaName {
+ start := ctx.GetStart().GetTokenIndex()
+ stop := getFollowingTwoNewLine(ctx.GetParser(), ctx.GetStop().GetTokenIndex()+1)
+ l.rewriter.DeleteDefault(start, stop)
+ }
+}
+
+func (l *FilterBackupSchemaListener) EnterCommentstmt(ctx *parser.CommentstmtContext) {
+ var schemaName string
+
+ switch {
+ case ctx.Object_type_any_name() != nil:
+ list := NormalizePostgreSQLAnyName(ctx.Any_name())
+ if len(list) == 2 {
+ schemaName = list[0]
+ }
+ case ctx.COLUMN() != nil:
+ list := NormalizePostgreSQLAnyName(ctx.Any_name())
+ if len(list) == 3 {
+ schemaName = list[0]
+ }
+ }
+
+ if schemaName == backupSchemaName {
+ start := ctx.GetStart().GetTokenIndex()
+ stop := getFollowingTwoNewLine(ctx.GetParser(), ctx.GetStop().GetTokenIndex()+1)
+ l.rewriter.DeleteDefault(start, stop)
+ }
+}
+
+func getFollowingTwoNewLine(p antlr.Parser, start int) int {
+ i := start
+ newLineCount := 0
+ for {
+ if i >= p.GetTokenStream().Size() {
+ return i
+ }
+ switch p.GetTokenStream().Get(i).GetTokenType() {
+ case antlr.TokenEOF:
+ return i
+ case parser.PostgreSQLLexerNewline:
+ newLineCount++
+ if newLineCount == 2 {
+ return i
+ }
+ case parser.PostgreSQLLexerSEMI:
+ i++
+ continue
+ default:
+ if p.GetTokenStream().Get(i).GetChannel() == antlr.TokenDefaultChannel {
+ return i - 1
+ }
+ }
+ i++
+ }
+}
diff --git a/backend/plugin/parser/pg/filter_test.go b/backend/plugin/parser/pg/filter_test.go
new file mode 100644
index 0000000000..3c6e54e2fa
--- /dev/null
+++ b/backend/plugin/parser/pg/filter_test.go
@@ -0,0 +1,49 @@
+package pg
+
+import (
+ "io"
+ "os"
+ "testing"
+
+ "github.com/stretchr/testify/require"
+ "gopkg.in/yaml.v3"
+)
+
+type filterTestCase struct {
+ Input string
+ Output string
+}
+
+func TestFilter(t *testing.T) {
+ const (
+ record = false
+ testDataPath = "test-data/filter.yaml"
+ )
+
+ a := require.New(t)
+ yamlFile, err := os.Open(testDataPath)
+ a.NoError(err)
+
+ var testCases []filterTestCase
+ byteValue, err := io.ReadAll(yamlFile)
+ a.NoError(err)
+ a.NoError(yamlFile.Close())
+ a.NoError(yaml.Unmarshal(byteValue, &testCases))
+
+ for i, tc := range testCases {
+ result, err := FilterBackupSchema(tc.Input)
+ a.NoError(err)
+ if record {
+ testCases[i].Output = result
+ } else {
+ a.Equal(tc.Output, result, "Input: %s", tc.Input)
+ }
+ }
+
+ if record {
+ byteValue, err := yaml.Marshal(testCases)
+ a.NoError(err)
+ err = os.WriteFile(testDataPath, byteValue, 0644)
+ a.NoError(err)
+ }
+}
diff --git a/backend/plugin/parser/pg/pg.go b/backend/plugin/parser/pg/pg.go
index 381b7590b9..557123f2b7 100644
--- a/backend/plugin/parser/pg/pg.go
+++ b/backend/plugin/parser/pg/pg.go
@@ -88,6 +88,39 @@ func normalizePostgreSQLName(ctx parser.INameContext) string {
return ""
}
+func normalizePostgreSQLFuncName(ctx parser.IFunc_nameContext) []string {
+ if ctx == nil {
+ return nil
+ }
+
+ switch {
+ case ctx.Builtin_function_name() != nil:
+ return []string{strings.ToLower(ctx.Builtin_function_name().GetText())}
+ case ctx.Type_function_name() != nil:
+ return []string{normalizePostgreSQLTypeFunctionName(ctx.Type_function_name())}
+ case ctx.Colid() != nil:
+ var result []string
+ result = append(result, NormalizePostgreSQLColid(ctx.Colid()))
+ result = append(result, normalizePostgreSQLIndirection(ctx.Indirection())...)
+ return result
+ default:
+ return []string{strings.ToLower(ctx.GetText())}
+ }
+}
+
+func normalizePostgreSQLTypeFunctionName(ctx parser.IType_function_nameContext) string {
+ if ctx == nil {
+ return ""
+ }
+
+ switch {
+ case ctx.Identifier() != nil:
+ return normalizePostgreSQLIdentifier(ctx.Identifier())
+ default:
+ return strings.ToLower(ctx.GetText())
+ }
+}
+
// NormalizePostgreSQLAnyName normalizes the given any name.
func NormalizePostgreSQLAnyName(ctx parser.IAny_nameContext) []string {
if ctx == nil {
diff --git a/backend/plugin/parser/pg/test-data/filter.yaml b/backend/plugin/parser/pg/test-data/filter.yaml
new file mode 100644
index 0000000000..222786dbe1
--- /dev/null
+++ b/backend/plugin/parser/pg/test-data/filter.yaml
@@ -0,0 +1,150 @@
+- input: |-
+ SET statement_timeout = 0;
+ SET lock_timeout = 0;
+ SET idle_in_transaction_session_timeout = 0;
+ SET client_encoding = 'UTF8';
+ SET standard_conforming_strings = on;
+ SELECT pg_catalog.set_config('search_path', '', false);
+ SET check_function_bodies = false;
+ SET xmloption = content;
+ SET client_min_messages = warning;
+ SET row_security = off;
+
+ CREATE SCHEMA bbdataarchive;
+
+ CREATE SCHEMA payment;
+
+ CREATE TABLE bbdataarchive._20240820154007_tdata (
+ a integer,
+ b integer
+ );
+
+ COMMENT ON TABLE bbdataarchive._20240820154007_tdata IS 'issue 377';
+
+ CREATE TABLE bbdataarchive._20240828141705_tdata (
+ a integer,
+ b integer
+ );
+
+ COMMENT ON TABLE bbdataarchive._20240828141705_tdata IS 'issue 379';
+
+ CREATE TABLE bbdataarchive._20240828145332_tdata (
+ a integer,
+ b integer
+ );
+
+ COMMENT ON TABLE bbdataarchive._20240828145332_tdata IS 'issue 380';
+
+ CREATE TABLE bbdataarchive._20240828150013_tdata (
+ a integer,
+ b integer
+ );
+
+ COMMENT ON TABLE bbdataarchive._20240828150013_tdata IS 'issue 382';
+
+ CREATE TABLE payment.ph (
+ pay_no character varying NOT NULL,
+ pay_acc_no character varying,
+ pay_month integer,
+ pay_amount numeric,
+ pay_notes text,
+ pay_date date
+ );
+
+ CREATE TABLE public.l_abc (
+ lst_id integer NOT NULL,
+ lst_acc_no character varying(50) NOT NULL,
+ lst_amount numeric(15,2) NOT NULL,
+ lst_code character varying(10) NOT NULL,
+ lst_month integer NOT NULL,
+ lst_date date NOT NULL
+ );
+
+ CREATE SEQUENCE public.l_abc_lst_id_seq
+ AS integer
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ ALTER SEQUENCE public.l_abc_lst_id_seq OWNED BY public.l_abc.lst_id;
+
+ CREATE TABLE public.my_table (
+ id integer NOT NULL,
+ data text
+ )
+ WITH (autovacuum_enabled='on');
+
+ CREATE SEQUENCE public.my_table_id_seq
+ AS integer
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ ALTER SEQUENCE public.my_table_id_seq OWNED BY public.my_table.id;
+
+ ALTER TABLE ONLY public.my_table
+ ADD CONSTRAINT my_table_pkey PRIMARY KEY (id);
+ output: |-
+ SET statement_timeout = 0;
+ SET lock_timeout = 0;
+ SET idle_in_transaction_session_timeout = 0;
+ SET client_encoding = 'UTF8';
+ SET standard_conforming_strings = on;
+ SELECT pg_catalog.set_config('search_path', '', false);
+ SET check_function_bodies = false;
+ SET xmloption = content;
+ SET client_min_messages = warning;
+ SET row_security = off;
+
+ CREATE SCHEMA payment;
+
+ CREATE TABLE payment.ph (
+ pay_no character varying NOT NULL,
+ pay_acc_no character varying,
+ pay_month integer,
+ pay_amount numeric,
+ pay_notes text,
+ pay_date date
+ );
+
+ CREATE TABLE public.l_abc (
+ lst_id integer NOT NULL,
+ lst_acc_no character varying(50) NOT NULL,
+ lst_amount numeric(15,2) NOT NULL,
+ lst_code character varying(10) NOT NULL,
+ lst_month integer NOT NULL,
+ lst_date date NOT NULL
+ );
+
+ CREATE SEQUENCE public.l_abc_lst_id_seq
+ AS integer
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ ALTER SEQUENCE public.l_abc_lst_id_seq OWNED BY public.l_abc.lst_id;
+
+ CREATE TABLE public.my_table (
+ id integer NOT NULL,
+ data text
+ )
+ WITH (autovacuum_enabled='on');
+
+ CREATE SEQUENCE public.my_table_id_seq
+ AS integer
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ ALTER SEQUENCE public.my_table_id_seq OWNED BY public.my_table.id;
+
+ ALTER TABLE ONLY public.my_table
+ ADD CONSTRAINT my_table_pkey PRIMARY KEY (id);
diff --git a/frontend/src/components/SyncDatabaseSchema/SelectTargetDatabasesView.vue b/frontend/src/components/SyncDatabaseSchema/SelectTargetDatabasesView.vue
index a68f07735e..0014dca595 100644
--- a/frontend/src/components/SyncDatabaseSchema/SelectTargetDatabasesView.vue
+++ b/frontend/src/components/SyncDatabaseSchema/SelectTargetDatabasesView.vue
@@ -254,6 +254,7 @@ import {
changeHistoryLink,
databaseV1Url,
getSheetStatement,
+ instanceV1SupportsConciseSchema,
isValidChangeHistoryName,
toClipboard,
} from "@/utils";
@@ -317,7 +318,7 @@ const project = computed(() => {
const displayOnlySourceDatabaseSchema = computed(() => {
if (props.sourceSchemaType === "SCHEMA_HISTORY_VERSION") {
- if (engine.value === Engine.ORACLE) {
+ if (instanceV1SupportsConciseSchema(engine.value)) {
return props.databaseSourceSchema?.conciseHistory || "";
}
}
@@ -360,7 +361,7 @@ const targetDatabaseList = computed(() => {
});
});
const targetDatabaseSchema = computed(() => {
- if (engine.value === Engine.ORACLE) {
+ if (instanceV1SupportsConciseSchema(engine.value)) {
return state.selectedDatabaseName
? conciseSchemaCache[state.selectedDatabaseName]
: "";
@@ -519,7 +520,7 @@ watch(
`${db.name}/schema`
);
databaseSchemaCache[name] = schema.schema;
- if (engine.value === Engine.ORACLE) {
+ if (instanceV1SupportsConciseSchema(engine.value)) {
const conciseSchema = await databaseStore.fetchDatabaseSchema(
`${db.name}/schema`,
false /* sdlFormat */,
diff --git a/frontend/src/types/proto/v1/database_service.ts b/frontend/src/types/proto/v1/database_service.ts
index f8916c3ce9..e7cfc7ed45 100644
--- a/frontend/src/types/proto/v1/database_service.ts
+++ b/frontend/src/types/proto/v1/database_service.ts
@@ -316,6 +316,7 @@ export interface GetDatabaseSchemaRequest {
/**
* When true, the schema dump will be concise.
* For Oracle, there will be tables and indexes only for Sync Schema.
+ * For Postgres, we'll filter the backup schema.
*/
concise: boolean;
}
@@ -1738,7 +1739,11 @@ export interface GetChangeHistoryRequest {
view: ChangeHistoryView;
/** Format the schema dump into SDL format. */
sdlFormat: boolean;
- /** When true, the schema dump will be concise. */
+ /**
+ * When true, the schema dump will be concise.
+ * For Oracle, there will be tables and indexes only for Sync Schema.
+ * For Postgres, we'll filter the backup schema.
+ */
concise: boolean;
}
diff --git a/frontend/src/utils/v1/instance.ts b/frontend/src/utils/v1/instance.ts
index fa0ba11a2d..e554fbe53b 100644
--- a/frontend/src/utils/v1/instance.ts
+++ b/frontend/src/utils/v1/instance.ts
@@ -249,7 +249,10 @@ export const instanceV1SupportsConciseSchema = (
instanceOrEngine: Instance | InstanceResource | Engine
) => {
const engine = engineOfInstanceV1(instanceOrEngine);
- return [Engine.ORACLE].includes(engine);
+ return [
+ Engine.ORACLE,
+ Engine.POSTGRES,
+ ].includes(engine);
};
export const instanceV1SupportsTablePartition = (
diff --git a/proto/gen/grpc-doc/openapi.yaml b/proto/gen/grpc-doc/openapi.yaml
index d8c23b1364..089337ab08 100644
--- a/proto/gen/grpc-doc/openapi.yaml
+++ b/proto/gen/grpc-doc/openapi.yaml
@@ -1519,7 +1519,10 @@ paths:
type: boolean
- name: concise
in: query
- description: When true, the schema dump will be concise.
+ description: |-
+ When true, the schema dump will be concise.
+ For Oracle, there will be tables and indexes only for Sync Schema.
+ For Postgres, we'll filter the backup schema.
schema:
type: boolean
responses:
@@ -2066,6 +2069,7 @@ paths:
description: |-
When true, the schema dump will be concise.
For Oracle, there will be tables and indexes only for Sync Schema.
+ For Postgres, we'll filter the backup schema.
schema:
type: boolean
responses:
diff --git a/proto/gen/grpc-doc/v1/README.md b/proto/gen/grpc-doc/v1/README.md
index 49925988b3..2f7d2dbe0a 100644
--- a/proto/gen/grpc-doc/v1/README.md
+++ b/proto/gen/grpc-doc/v1/README.md
@@ -2383,7 +2383,7 @@ FunctionMetadata is the metadata for functions.
| name | [string](#string) | | The name of the change history to retrieve. Format: instances/{instance}/databases/{database}/changeHistories/{changeHistory} |
| view | [ChangeHistoryView](#bytebase-v1-ChangeHistoryView) | | |
| sdl_format | [bool](#bool) | | Format the schema dump into SDL format. |
-| concise | [bool](#bool) | | When true, the schema dump will be concise. |
+| concise | [bool](#bool) | | When true, the schema dump will be concise. For Oracle, there will be tables and indexes only for Sync Schema. For Postgres, we'll filter the backup schema. |
@@ -2432,7 +2432,7 @@ FunctionMetadata is the metadata for functions.
| ----- | ---- | ----- | ----------- |
| name | [string](#string) | | The name of the database to retrieve schema. Format: instances/{instance}/databases/{database}/schema |
| sdl_format | [bool](#bool) | | Format the schema dump into SDL format. |
-| concise | [bool](#bool) | | When true, the schema dump will be concise. For Oracle, there will be tables and indexes only for Sync Schema. |
+| concise | [bool](#bool) | | When true, the schema dump will be concise. For Oracle, there will be tables and indexes only for Sync Schema. For Postgres, we'll filter the backup schema. |
diff --git a/proto/gen/grpc-doc/v1/index.html b/proto/gen/grpc-doc/v1/index.html
index ac03c6dac1..1bd2ac0745 100644
--- a/proto/gen/grpc-doc/v1/index.html
+++ b/proto/gen/grpc-doc/v1/index.html
@@ -7354,7 +7354,9 @@ Format: instances/{instance}/databases/{database}/changeHistories/{changeHistory
<td>concise</td>
<td><a href="#bool">bool</a></td>
<td></td>
- <td><p>When true, the schema dump will be concise. </p></td>
+ <td><p>When true, the schema dump will be concise.
+For Oracle, there will be tables and indexes only for Sync Schema.
+For Postgres, we&#39;ll filter the backup schema. </p></td>
</tr>
</tbody>
@@ -7460,7 +7462,8 @@ Format: instances/{instance}/databases/{database}/schema </p></td>
<td><a href="#bool">bool</a></td>
<td></td>
<td><p>When true, the schema dump will be concise.
-For Oracle, there will be tables and indexes only for Sync Schema. </p></td>
+For Oracle, there will be tables and indexes only for Sync Schema.
+For Postgres, we&#39;ll filter the backup schema. </p></td>
</tr>
</tbody>
diff --git a/proto/generated-go/v1/database_service.pb.go b/proto/generated-go/v1/database_service.pb.go
index d179995e47..7d6238e6b5 100644
--- a/proto/generated-go/v1/database_service.pb.go
+++ b/proto/generated-go/v1/database_service.pb.go
@@ -1258,6 +1258,7 @@ type GetDatabaseSchemaRequest struct {
SdlFormat bool `protobuf:"varint,2,opt,name=sdl_format,json=sdlFormat,proto3" json:"sdl_format,omitempty"`
// When true, the schema dump will be concise.
// For Oracle, there will be tables and indexes only for Sync Schema.
+ // For Postgres, we'll filter the backup schema.
Concise bool `protobuf:"varint,3,opt,name=concise,proto3" json:"concise,omitempty"`
}
@@ -5679,6 +5680,8 @@ type GetChangeHistoryRequest struct {
// Format the schema dump into SDL format.
SdlFormat bool `protobuf:"varint,3,opt,name=sdl_format,json=sdlFormat,proto3" json:"sdl_format,omitempty"`
// When true, the schema dump will be concise.
+ // For Oracle, there will be tables and indexes only for Sync Schema.
+ // For Postgres, we'll filter the backup schema.
Concise bool `protobuf:"varint,4,opt,name=concise,proto3" json:"concise,omitempty"`
}
diff --git a/proto/v1/database_service.proto b/proto/v1/database_service.proto
index 7dee773003..2588b7ffb5 100644
--- a/proto/v1/database_service.proto
+++ b/proto/v1/database_service.proto
@@ -346,6 +346,7 @@ message GetDatabaseSchemaRequest {
// When true, the schema dump will be concise.
// For Oracle, there will be tables and indexes only for Sync Schema.
+ // For Postgres, we'll filter the backup schema.
bool concise = 3;
}
@@ -1417,6 +1418,8 @@ message GetChangeHistoryRequest {
bool sdl_format = 3;
// When true, the schema dump will be concise.
+ // For Oracle, there will be tables and indexes only for Sync Schema.
+ // For Postgres, we'll filter the backup schema.
bool concise = 4;
}