Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
feat: proto & schema def for plan (#6175)
p0ny48ed7fbe47e1
diff --git a/backend/migrator/migration/dev/LATEST.sql b/backend/migrator/migration/dev/LATEST.sqlindex a3fc6df7fd..1c9a449dbf 100644--- a/backend/migrator/migration/dev/LATEST.sql+++ b/backend/migrator/migration/dev/LATEST.sql@@ -677,6 +677,34 @@ EXECUTE FUNCTION trigger_update_updated_ts();-- Pipeline related END-----------------------+-- Plan related BEGIN+CREATE TABLE plan (+ id BIGSERIAL PRIMARY KEY,+ row_status row_status NOT NULL DEFAULT 'NORMAL',+ creator_id INTEGER NOT NULL REFERENCES principal (id),+ created_ts BIGINT NOT NULL DEFAULT extract(epoch from now()),+ updater_id INTEGER NOT NULL REFERENCES principal (id),+ updated_ts BIGINT NOT NULL DEFAULT extract(epoch from now()),+ project_id INTEGER NOT NULL REFERENCES project (id),+ pipeline_id INTEGER REFERENCES pipeline (id),+ name TEXT NOT NULL,+ description TEXT NOT NULL,+ config JSONB NOT NULL DEFAULT '{}'+);++CREATE INDEX idx_plan_project_id ON plan(project_id);++CREATE INDEX idx_plan_pipeline_id ON plan(pipeline_id);++ALTER SEQUENCE plan_id_seq RESTART WITH 101;++CREATE TRIGGER update_plan_updated_ts+BEFORE+UPDATE+ ON plan FOR EACH ROW+EXECUTE FUNCTION trigger_update_updated_ts();+-- Plan related END+------------------------- issueCREATE TABLE issue (id SERIAL PRIMARY KEY,@@ -686,6 +714,7 @@ CREATE TABLE issue (updater_id INTEGER NOT NULL REFERENCES principal (id),updated_ts BIGINT NOT NULL DEFAULT extract(epoch from now()),project_id INTEGER NOT NULL REFERENCES project (id),+ plan_id BIGINT REFERENCES plan (id),pipeline_id INTEGER REFERENCES pipeline (id),name TEXT NOT NULL,status TEXT NOT NULL CHECK (status IN ('OPEN', 'DONE', 'CANCELED')),@@ -699,6 +728,8 @@ CREATE TABLE issue (CREATE INDEX idx_issue_project_id ON issue(project_id);+CREATE INDEX idx_issue_plan_id ON issue(plan_id);+CREATE INDEX idx_issue_pipeline_id ON issue(pipeline_id);CREATE INDEX idx_issue_creator_id ON issue(creator_id);diff --git a/backend/migrator/migration/prod/2.2/0000##plan.sql b/backend/migrator/migration/prod/2.2/0000##plan.sqlnew file mode 100644index 0000000000..29d633a6a0--- /dev/null+++ b/backend/migrator/migration/prod/2.2/0000##plan.sql@@ -0,0 +1,29 @@+CREATE TABLE plan (+ id BIGSERIAL PRIMARY KEY,+ row_status row_status NOT NULL DEFAULT 'NORMAL',+ creator_id INTEGER NOT NULL REFERENCES principal (id),+ created_ts BIGINT NOT NULL DEFAULT extract(epoch from now()),+ updater_id INTEGER NOT NULL REFERENCES principal (id),+ updated_ts BIGINT NOT NULL DEFAULT extract(epoch from now()),+ project_id INTEGER NOT NULL REFERENCES project (id),+ pipeline_id INTEGER REFERENCES pipeline (id),+ name TEXT NOT NULL,+ description TEXT NOT NULL,+ config JSONB NOT NULL DEFAULT '{}'+);++CREATE INDEX idx_plan_project_id ON plan(project_id);++CREATE INDEX idx_plan_pipeline_id ON plan(pipeline_id);++ALTER SEQUENCE plan_id_seq RESTART WITH 101;++CREATE TRIGGER update_plan_updated_ts+BEFORE+UPDATE+ ON plan FOR EACH ROW+EXECUTE FUNCTION trigger_update_updated_ts();++ALTER TABLE issue ADD COLUMN plan_id BIGINT REFERENCES plan (id);++CREATE INDEX idx_issue_plan_id ON issue (plan_id);\ No newline at end of filediff --git a/backend/migrator/migration/prod/LATEST.sql b/backend/migrator/migration/prod/LATEST.sqlindex ae1fd56b1d..257a7cf2d9 100644--- a/backend/migrator/migration/prod/LATEST.sql+++ b/backend/migrator/migration/prod/LATEST.sql@@ -676,6 +676,34 @@ EXECUTE FUNCTION trigger_update_updated_ts();-- Pipeline related END-----------------------+-- Plan related BEGIN+CREATE TABLE plan (+ id BIGSERIAL PRIMARY KEY,+ row_status row_status NOT NULL DEFAULT 'NORMAL',+ creator_id INTEGER NOT NULL REFERENCES principal (id),+ created_ts BIGINT NOT NULL DEFAULT extract(epoch from now()),+ updater_id INTEGER NOT NULL REFERENCES principal (id),+ updated_ts BIGINT NOT NULL DEFAULT extract(epoch from now()),+ project_id INTEGER NOT NULL REFERENCES project (id),+ pipeline_id INTEGER REFERENCES pipeline (id),+ name TEXT NOT NULL,+ description TEXT NOT NULL,+ config JSONB NOT NULL DEFAULT '{}'+);++CREATE INDEX idx_plan_project_id ON plan(project_id);++CREATE INDEX idx_plan_pipeline_id ON plan(pipeline_id);++ALTER SEQUENCE plan_id_seq RESTART WITH 101;++CREATE TRIGGER update_plan_updated_ts+BEFORE+UPDATE+ ON plan FOR EACH ROW+EXECUTE FUNCTION trigger_update_updated_ts();+-- Plan related END+------------------------- issueCREATE TABLE issue (id SERIAL PRIMARY KEY,@@ -685,6 +713,7 @@ CREATE TABLE issue (updater_id INTEGER NOT NULL REFERENCES principal (id),updated_ts BIGINT NOT NULL DEFAULT extract(epoch from now()),project_id INTEGER NOT NULL REFERENCES project (id),+ plan_id BIGINT REFERENCES plan (id),pipeline_id INTEGER REFERENCES pipeline (id),name TEXT NOT NULL,status TEXT NOT NULL CHECK (status IN ('OPEN', 'DONE', 'CANCELED')),@@ -698,6 +727,8 @@ CREATE TABLE issue (CREATE INDEX idx_issue_project_id ON issue(project_id);+CREATE INDEX idx_issue_plan_id ON issue(plan_id);+CREATE INDEX idx_issue_pipeline_id ON issue(pipeline_id);CREATE INDEX idx_issue_creator_id ON issue(creator_id);diff --git a/backend/migrator/migrator_test.go b/backend/migrator/migrator_test.goindex 3ef6d01273..711d115233 100644--- a/backend/migrator/migrator_test.go+++ b/backend/migrator/migrator_test.go@@ -241,5 +241,5 @@ func TestMigrationCompatibility(t *testing.T) {func TestGetCutoffVersion(t *testing.T) {releaseVersion, err := getProdCutoffVersion()require.NoError(t, err)- require.Equal(t, semver.MustParse("2.1.1"), releaseVersion)+ require.Equal(t, semver.MustParse("2.2.0"), releaseVersion)}diff --git a/frontend/src/types/proto/google/type/interval.ts b/frontend/src/types/proto/google/type/interval.tsdeleted file mode 100644index 21a0f56d98..0000000000--- a/frontend/src/types/proto/google/type/interval.ts+++ /dev/null@@ -1,134 +0,0 @@-/* eslint-disable */-import * as _m0 from "protobufjs/minimal";-import { Timestamp } from "../protobuf/timestamp";--export const protobufPackage = "google.type";--/**- * Represents a time interval, encoded as a Timestamp start (inclusive) and a- * Timestamp end (exclusive).- *- * The start must be less than or equal to the end.- * When the start equals the end, the interval is empty (matches no time).- * When both start and end are unspecified, the interval matches any time.- */-export interface Interval {- /**- * Optional. Inclusive start of the interval.- *- * If specified, a Timestamp matching this interval will have to be the same- * or after the start.- */- startTime?: Date;- /**- * Optional. Exclusive end of the interval.- *- * If specified, a Timestamp matching this interval will have to be before the- * end.- */- endTime?: Date;-}--function createBaseInterval(): Interval {- return { startTime: undefined, endTime: undefined };-}--export const Interval = {- encode(message: Interval, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {- if (message.startTime !== undefined) {- Timestamp.encode(toTimestamp(message.startTime), writer.uint32(10).fork()).ldelim();- }- if (message.endTime !== undefined) {- Timestamp.encode(toTimestamp(message.endTime), writer.uint32(18).fork()).ldelim();- }- return writer;- },-- decode(input: _m0.Reader | Uint8Array, length?: number): Interval {- const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);- let end = length === undefined ? reader.len : reader.pos + length;- const message = createBaseInterval();- while (reader.pos < end) {- const tag = reader.uint32();- switch (tag >>> 3) {- case 1:- if (tag != 10) {- break;- }-- message.startTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));- continue;- case 2:- if (tag != 18) {- break;- }-- message.endTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));- continue;- }- if ((tag & 7) == 4 || tag == 0) {- break;- }- reader.skipType(tag & 7);- }- return message;- },-- fromJSON(object: any): Interval {- return {- startTime: isSet(object.startTime) ? fromJsonTimestamp(object.startTime) : undefined,- endTime: isSet(object.endTime) ? fromJsonTimestamp(object.endTime) : undefined,- };- },-- toJSON(message: Interval): unknown {- const obj: any = {};- message.startTime !== undefined && (obj.startTime = message.startTime.toISOString());- message.endTime !== undefined && (obj.endTime = message.endTime.toISOString());- return obj;- },-- create(base?: DeepPartial<Interval>): Interval {- return Interval.fromPartial(base ?? {});- },-- fromPartial(object: DeepPartial<Interval>): Interval {- const message = createBaseInterval();- message.startTime = object.startTime ?? undefined;- message.endTime = object.endTime ?? undefined;- return message;- },-};--type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;--export type DeepPartial<T> = T extends Builtin ? T- : T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>- : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }- : Partial<T>;--function toTimestamp(date: Date): Timestamp {- const seconds = date.getTime() / 1_000;- const nanos = (date.getTime() % 1_000) * 1_000_000;- return { seconds, nanos };-}--function fromTimestamp(t: Timestamp): Date {- let millis = t.seconds * 1_000;- millis += t.nanos / 1_000_000;- return new Date(millis);-}--function fromJsonTimestamp(o: any): Date {- if (o instanceof Date) {- return o;- } else if (typeof o === "string") {- return new Date(o);- } else {- return fromTimestamp(Timestamp.fromJSON(o));- }-}--function isSet(value: any): boolean {- return value !== null && value !== undefined;-}diff --git a/frontend/src/types/proto/store/plan.ts b/frontend/src/types/proto/store/plan.tsnew file mode 100644index 0000000000..208e0b325b--- /dev/null+++ b/frontend/src/types/proto/store/plan.ts@@ -0,0 +1,927 @@+/* eslint-disable */+import * as _m0 from "protobufjs/minimal";+import { Timestamp } from "../google/protobuf/timestamp";++export const protobufPackage = "bytebase.store";++export interface PlanConfig {+ steps: PlanConfig_Step[];+}++export interface PlanConfig_Step {+ specs: PlanConfig_Spec[];+}++export interface PlanConfig_Spec {+ /** earliest_allowed_time the earliest execution time of the change. */+ earliestAllowedTime?: Date;+ createDatabaseConfig?: PlanConfig_CreateDatabaseConfig | undefined;+ changeDatabaseConfig?: PlanConfig_ChangeDatabaseConfig | undefined;+ restoreDatabaseConfig?: PlanConfig_RestoreDatabaseConfig | undefined;+}++export interface PlanConfig_CreateDatabaseConfig {+ /**+ * The resource name of the instance on which the database is created.+ * Format: instances/{instance}+ */+ target: string;+ /** The name of the database to create. */+ database: string;+ /**+ * table is the name of the table, if it is not empty, Bytebase should create a table after creating the database.+ * For example, in MongoDB, it only creates the database when we first store data in that database.+ */+ table: string;+ /** character_set is the character set of the database. */+ characterSet: string;+ /** collation is the collation of the database. */+ collation: string;+ /** cluster is the cluster of the database. This is only applicable to ClickHouse for "ON CLUSTER <<cluster>>". */+ cluster: string;+ /** owner is the owner of the database. This is only applicable to Postgres for "WITH OWNER <<owner>>". */+ owner: string;+ /**+ * backup is the resource name of the backup.+ * FIXME: backup v1 API is not ready yet, write the format here when it's ready.+ */+ backup: string;+ /** labels of the database. */+ labels: { [key: string]: string };+}++export interface PlanConfig_CreateDatabaseConfig_LabelsEntry {+ key: string;+ value: string;+}++export interface PlanConfig_ChangeDatabaseConfig {+ /**+ * The resource name of the target.+ * Format: projects/{project}/logicalDatabases/{ldb1}.+ * Format: projects/{project}/logicalDatabases/{ldb1}/logicalTables/{ltb1}.+ * Format: instances/{xxx}/databases/{db1}.+ */+ target: string;+ /**+ * The resource name of the sheet.+ * Format: sheets/{sheet}+ */+ sheet: string;+ type: PlanConfig_ChangeDatabaseConfig_Type;+ /**+ * schema_version is parsed from VCS file name.+ * It is automatically generated in the UI workflow.+ */+ schemaVersion: string;+ /** If RollbackEnabled, build the RollbackSheetID of the task. */+ rollbackEnabled: boolean;+}++/** Type is the database change type. */+export enum PlanConfig_ChangeDatabaseConfig_Type {+ TYPE_UNSPECIFIED = 0,+ /**+ * BASELINE - Used for establishing schema baseline, this is used when+ * 1. Onboard the database into Bytebase since Bytebase needs to know the current database schema.+ * 2. Had schema drift and need to re-establish the baseline.+ */+ BASELINE = 1,+ /** MIGRATE - Used for DDL changes including CREATE DATABASE. */+ MIGRATE = 2,+ /** MIGRATE_SDL - Used for schema changes via state-based schema migration including CREATE DATABASE. */+ MIGRATE_SDL = 3,+ /** MIGRATE_GHOST - Used for DDL changes using gh-ost. */+ MIGRATE_GHOST = 4,+ /** BRANCH - Used when restoring from a backup (the restored database branched from the original backup). */+ BRANCH = 5,+ /** DATA - Used for DML change. */+ DATA = 6,+ UNRECOGNIZED = -1,+}++export function planConfig_ChangeDatabaseConfig_TypeFromJSON(object: any): PlanConfig_ChangeDatabaseConfig_Type {+ switch (object) {+ case 0:+ case "TYPE_UNSPECIFIED":+ return PlanConfig_ChangeDatabaseConfig_Type.TYPE_UNSPECIFIED;+ case 1:+ case "BASELINE":+ return PlanConfig_ChangeDatabaseConfig_Type.BASELINE;+ case 2:+ case "MIGRATE":+ return PlanConfig_ChangeDatabaseConfig_Type.MIGRATE;+ case 3:+ case "MIGRATE_SDL":+ return PlanConfig_ChangeDatabaseConfig_Type.MIGRATE_SDL;+ case 4:+ case "MIGRATE_GHOST":+ return PlanConfig_ChangeDatabaseConfig_Type.MIGRATE_GHOST;+ case 5:+ case "BRANCH":+ return PlanConfig_ChangeDatabaseConfig_Type.BRANCH;+ case 6:+ case "DATA":+ return PlanConfig_ChangeDatabaseConfig_Type.DATA;+ case -1:+ case "UNRECOGNIZED":+ default:+ return PlanConfig_ChangeDatabaseConfig_Type.UNRECOGNIZED;+ }+}++export function planConfig_ChangeDatabaseConfig_TypeToJSON(object: PlanConfig_ChangeDatabaseConfig_Type): string {+ switch (object) {+ case PlanConfig_ChangeDatabaseConfig_Type.TYPE_UNSPECIFIED:+ return "TYPE_UNSPECIFIED";+ case PlanConfig_ChangeDatabaseConfig_Type.BASELINE:+ return "BASELINE";+ case PlanConfig_ChangeDatabaseConfig_Type.MIGRATE:+ return "MIGRATE";+ case PlanConfig_ChangeDatabaseConfig_Type.MIGRATE_SDL:+ return "MIGRATE_SDL";+ case PlanConfig_ChangeDatabaseConfig_Type.MIGRATE_GHOST:+ return "MIGRATE_GHOST";+ case PlanConfig_ChangeDatabaseConfig_Type.BRANCH:+ return "BRANCH";+ case PlanConfig_ChangeDatabaseConfig_Type.DATA:+ return "DATA";+ case PlanConfig_ChangeDatabaseConfig_Type.UNRECOGNIZED:+ default:+ return "UNRECOGNIZED";+ }+}++export interface PlanConfig_RestoreDatabaseConfig {+ /**+ * The resource name of the target to restore.+ * Format: instances/{instance}/databases/{database}+ */+ target: string;+ /** create_database_config is present if the user wants to restore to a new database. */+ createDatabaseConfig?:+ | PlanConfig_CreateDatabaseConfig+ | undefined;+ /**+ * FIXME: format TBD+ * Restore from a backup.+ */+ backup?:+ | string+ | undefined;+ /** After the PITR operations, the database will be recovered to the state at this time. */+ pointInTime?: Date | undefined;+}++function createBasePlanConfig(): PlanConfig {+ return { steps: [] };+}++export const PlanConfig = {+ encode(message: PlanConfig, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {+ for (const v of message.steps) {+ PlanConfig_Step.encode(v!, writer.uint32(10).fork()).ldelim();+ }+ return writer;+ },++ decode(input: _m0.Reader | Uint8Array, length?: number): PlanConfig {+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);+ let end = length === undefined ? reader.len : reader.pos + length;+ const message = createBasePlanConfig();+ while (reader.pos < end) {+ const tag = reader.uint32();+ switch (tag >>> 3) {+ case 1:+ if (tag !== 10) {+ break;+ }++ message.steps.push(PlanConfig_Step.decode(reader, reader.uint32()));+ continue;+ }+ if ((tag & 7) === 4 || tag === 0) {+ break;+ }+ reader.skipType(tag & 7);+ }+ return message;+ },++ fromJSON(object: any): PlanConfig {+ return { steps: Array.isArray(object?.steps) ? object.steps.map((e: any) => PlanConfig_Step.fromJSON(e)) : [] };+ },++ toJSON(message: PlanConfig): unknown {+ const obj: any = {};+ if (message.steps) {+ obj.steps = message.steps.map((e) => e ? PlanConfig_Step.toJSON(e) : undefined);+ } else {+ obj.steps = [];+ }+ return obj;+ },++ create(base?: DeepPartial<PlanConfig>): PlanConfig {+ return PlanConfig.fromPartial(base ?? {});+ },++ fromPartial(object: DeepPartial<PlanConfig>): PlanConfig {+ const message = createBasePlanConfig();+ message.steps = object.steps?.map((e) => PlanConfig_Step.fromPartial(e)) || [];+ return message;+ },+};++function createBasePlanConfig_Step(): PlanConfig_Step {+ return { specs: [] };+}++export const PlanConfig_Step = {+ encode(message: PlanConfig_Step, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {+ for (const v of message.specs) {+ PlanConfig_Spec.encode(v!, writer.uint32(10).fork()).ldelim();+ }+ return writer;+ },++ decode(input: _m0.Reader | Uint8Array, length?: number): PlanConfig_Step {+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);+ let end = length === undefined ? reader.len : reader.pos + length;+ const message = createBasePlanConfig_Step();+ while (reader.pos < end) {+ const tag = reader.uint32();+ switch (tag >>> 3) {+ case 1:+ if (tag !== 10) {+ break;+ }++ message.specs.push(PlanConfig_Spec.decode(reader, reader.uint32()));+ continue;+ }+ if ((tag & 7) === 4 || tag === 0) {+ break;+ }+ reader.skipType(tag & 7);+ }+ return message;+ },++ fromJSON(object: any): PlanConfig_Step {+ return { specs: Array.isArray(object?.specs) ? object.specs.map((e: any) => PlanConfig_Spec.fromJSON(e)) : [] };+ },++ toJSON(message: PlanConfig_Step): unknown {+ const obj: any = {};+ if (message.specs) {+ obj.specs = message.specs.map((e) => e ? PlanConfig_Spec.toJSON(e) : undefined);+ } else {+ obj.specs = [];+ }+ return obj;+ },++ create(base?: DeepPartial<PlanConfig_Step>): PlanConfig_Step {+ return PlanConfig_Step.fromPartial(base ?? {});+ },++ fromPartial(object: DeepPartial<PlanConfig_Step>): PlanConfig_Step {+ const message = createBasePlanConfig_Step();+ message.specs = object.specs?.map((e) => PlanConfig_Spec.fromPartial(e)) || [];+ return message;+ },+};++function createBasePlanConfig_Spec(): PlanConfig_Spec {+ return {+ earliestAllowedTime: undefined,+ createDatabaseConfig: undefined,+ changeDatabaseConfig: undefined,+ restoreDatabaseConfig: undefined,+ };+}++export const PlanConfig_Spec = {+ encode(message: PlanConfig_Spec, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {+ if (message.earliestAllowedTime !== undefined) {+ Timestamp.encode(toTimestamp(message.earliestAllowedTime), writer.uint32(34).fork()).ldelim();+ }+ if (message.createDatabaseConfig !== undefined) {+ PlanConfig_CreateDatabaseConfig.encode(message.createDatabaseConfig, writer.uint32(10).fork()).ldelim();+ }+ if (message.changeDatabaseConfig !== undefined) {+ PlanConfig_ChangeDatabaseConfig.encode(message.changeDatabaseConfig, writer.uint32(18).fork()).ldelim();+ }+ if (message.restoreDatabaseConfig !== undefined) {+ PlanConfig_RestoreDatabaseConfig.encode(message.restoreDatabaseConfig, writer.uint32(26).fork()).ldelim();+ }+ return writer;+ },++ decode(input: _m0.Reader | Uint8Array, length?: number): PlanConfig_Spec {+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);+ let end = length === undefined ? reader.len : reader.pos + length;+ const message = createBasePlanConfig_Spec();+ while (reader.pos < end) {+ const tag = reader.uint32();+ switch (tag >>> 3) {+ case 4:+ if (tag !== 34) {+ break;+ }++ message.earliestAllowedTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));+ continue;+ case 1:+ if (tag !== 10) {+ break;+ }++ message.createDatabaseConfig = PlanConfig_CreateDatabaseConfig.decode(reader, reader.uint32());+ continue;+ case 2:+ if (tag !== 18) {+ break;+ }++ message.changeDatabaseConfig = PlanConfig_ChangeDatabaseConfig.decode(reader, reader.uint32());+ continue;+ case 3:+ if (tag !== 26) {+ break;+ }++ message.restoreDatabaseConfig = PlanConfig_RestoreDatabaseConfig.decode(reader, reader.uint32());+ continue;+ }+ if ((tag & 7) === 4 || tag === 0) {+ break;+ }+ reader.skipType(tag & 7);+ }+ return message;+ },++ fromJSON(object: any): PlanConfig_Spec {+ return {+ earliestAllowedTime: isSet(object.earliestAllowedTime)+ ? fromJsonTimestamp(object.earliestAllowedTime)+ : undefined,+ createDatabaseConfig: isSet(object.createDatabaseConfig)+ ? PlanConfig_CreateDatabaseConfig.fromJSON(object.createDatabaseConfig)+ : undefined,+ changeDatabaseConfig: isSet(object.changeDatabaseConfig)+ ? PlanConfig_ChangeDatabaseConfig.fromJSON(object.changeDatabaseConfig)+ : undefined,+ restoreDatabaseConfig: isSet(object.restoreDatabaseConfig)+ ? PlanConfig_RestoreDatabaseConfig.fromJSON(object.restoreDatabaseConfig)+ : undefined,+ };+ },++ toJSON(message: PlanConfig_Spec): unknown {+ const obj: any = {};+ message.earliestAllowedTime !== undefined && (obj.earliestAllowedTime = message.earliestAllowedTime.toISOString());+ message.createDatabaseConfig !== undefined && (obj.createDatabaseConfig = message.createDatabaseConfig+ ? PlanConfig_CreateDatabaseConfig.toJSON(message.createDatabaseConfig)+ : undefined);+ message.changeDatabaseConfig !== undefined && (obj.changeDatabaseConfig = message.changeDatabaseConfig+ ? PlanConfig_ChangeDatabaseConfig.toJSON(message.changeDatabaseConfig)+ : undefined);+ message.restoreDatabaseConfig !== undefined && (obj.restoreDatabaseConfig = message.restoreDatabaseConfig+ ? PlanConfig_RestoreDatabaseConfig.toJSON(message.restoreDatabaseConfig)+ : undefined);+ return obj;+ },++ create(base?: DeepPartial<PlanConfig_Spec>): PlanConfig_Spec {+ return PlanConfig_Spec.fromPartial(base ?? {});+ },++ fromPartial(object: DeepPartial<PlanConfig_Spec>): PlanConfig_Spec {+ const message = createBasePlanConfig_Spec();+ message.earliestAllowedTime = object.earliestAllowedTime ?? undefined;+ message.createDatabaseConfig = (object.createDatabaseConfig !== undefined && object.createDatabaseConfig !== null)+ ? PlanConfig_CreateDatabaseConfig.fromPartial(object.createDatabaseConfig)+ : undefined;+ message.changeDatabaseConfig = (object.changeDatabaseConfig !== undefined && object.changeDatabaseConfig !== null)+ ? PlanConfig_ChangeDatabaseConfig.fromPartial(object.changeDatabaseConfig)+ : undefined;+ message.restoreDatabaseConfig =+ (object.restoreDatabaseConfig !== undefined && object.restoreDatabaseConfig !== null)+ ? PlanConfig_RestoreDatabaseConfig.fromPartial(object.restoreDatabaseConfig)+ : undefined;+ return message;+ },+};++function createBasePlanConfig_CreateDatabaseConfig(): PlanConfig_CreateDatabaseConfig {+ return {+ target: "",+ database: "",+ table: "",+ characterSet: "",+ collation: "",+ cluster: "",+ owner: "",+ backup: "",+ labels: {},+ };+}++export const PlanConfig_CreateDatabaseConfig = {+ encode(message: PlanConfig_CreateDatabaseConfig, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {+ if (message.target !== "") {+ writer.uint32(10).string(message.target);+ }+ if (message.database !== "") {+ writer.uint32(18).string(message.database);+ }+ if (message.table !== "") {+ writer.uint32(26).string(message.table);+ }+ if (message.characterSet !== "") {+ writer.uint32(34).string(message.characterSet);+ }+ if (message.collation !== "") {+ writer.uint32(42).string(message.collation);+ }+ if (message.cluster !== "") {+ writer.uint32(50).string(message.cluster);+ }+ if (message.owner !== "") {+ writer.uint32(58).string(message.owner);+ }+ if (message.backup !== "") {+ writer.uint32(66).string(message.backup);+ }+ Object.entries(message.labels).forEach(([key, value]) => {+ PlanConfig_CreateDatabaseConfig_LabelsEntry.encode({ key: key as any, value }, writer.uint32(74).fork()).ldelim();+ });+ return writer;+ },++ decode(input: _m0.Reader | Uint8Array, length?: number): PlanConfig_CreateDatabaseConfig {+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);+ let end = length === undefined ? reader.len : reader.pos + length;+ const message = createBasePlanConfig_CreateDatabaseConfig();+ while (reader.pos < end) {+ const tag = reader.uint32();+ switch (tag >>> 3) {+ case 1:+ if (tag !== 10) {+ break;+ }++ message.target = reader.string();+ continue;+ case 2:+ if (tag !== 18) {+ break;+ }++ message.database = reader.string();+ continue;+ case 3:+ if (tag !== 26) {+ break;+ }++ message.table = reader.string();+ continue;+ case 4:+ if (tag !== 34) {+ break;+ }++ message.characterSet = reader.string();+ continue;+ case 5:+ if (tag !== 42) {+ break;+ }++ message.collation = reader.string();+ continue;+ case 6:+ if (tag !== 50) {+ break;+ }++ message.cluster = reader.string();+ continue;+ case 7:+ if (tag !== 58) {+ break;+ }++ message.owner = reader.string();+ continue;+ case 8:+ if (tag !== 66) {+ break;+ }++ message.backup = reader.string();+ continue;+ case 9:+ if (tag !== 74) {+ break;+ }++ const entry9 = PlanConfig_CreateDatabaseConfig_LabelsEntry.decode(reader, reader.uint32());+ if (entry9.value !== undefined) {+ message.labels[entry9.key] = entry9.value;+ }+ continue;+ }+ if ((tag & 7) === 4 || tag === 0) {+ break;+ }+ reader.skipType(tag & 7);+ }+ return message;+ },++ fromJSON(object: any): PlanConfig_CreateDatabaseConfig {+ return {+ target: isSet(object.target) ? String(object.target) : "",+ database: isSet(object.database) ? String(object.database) : "",+ table: isSet(object.table) ? String(object.table) : "",+ characterSet: isSet(object.characterSet) ? String(object.characterSet) : "",+ collation: isSet(object.collation) ? String(object.collation) : "",+ cluster: isSet(object.cluster) ? String(object.cluster) : "",+ owner: isSet(object.owner) ? String(object.owner) : "",+ backup: isSet(object.backup) ? String(object.backup) : "",+ labels: isObject(object.labels)+ ? Object.entries(object.labels).reduce<{ [key: string]: string }>((acc, [key, value]) => {+ acc[key] = String(value);+ return acc;+ }, {})+ : {},+ };+ },++ toJSON(message: PlanConfig_CreateDatabaseConfig): unknown {+ const obj: any = {};+ message.target !== undefined && (obj.target = message.target);+ message.database !== undefined && (obj.database = message.database);+ message.table !== undefined && (obj.table = message.table);+ message.characterSet !== undefined && (obj.characterSet = message.characterSet);+ message.collation !== undefined && (obj.collation = message.collation);+ message.cluster !== undefined && (obj.cluster = message.cluster);+ message.owner !== undefined && (obj.owner = message.owner);+ message.backup !== undefined && (obj.backup = message.backup);+ obj.labels = {};+ if (message.labels) {+ Object.entries(message.labels).forEach(([k, v]) => {+ obj.labels[k] = v;+ });+ }+ return obj;+ },++ create(base?: DeepPartial<PlanConfig_CreateDatabaseConfig>): PlanConfig_CreateDatabaseConfig {+ return PlanConfig_CreateDatabaseConfig.fromPartial(base ?? {});+ },++ fromPartial(object: DeepPartial<PlanConfig_CreateDatabaseConfig>): PlanConfig_CreateDatabaseConfig {+ const message = createBasePlanConfig_CreateDatabaseConfig();+ message.target = object.target ?? "";+ message.database = object.database ?? "";+ message.table = object.table ?? "";+ message.characterSet = object.characterSet ?? "";+ message.collation = object.collation ?? "";+ message.cluster = object.cluster ?? "";+ message.owner = object.owner ?? "";+ message.backup = object.backup ?? "";+ message.labels = Object.entries(object.labels ?? {}).reduce<{ [key: string]: string }>((acc, [key, value]) => {+ if (value !== undefined) {+ acc[key] = String(value);+ }+ return acc;+ }, {});+ return message;+ },+};++function createBasePlanConfig_CreateDatabaseConfig_LabelsEntry(): PlanConfig_CreateDatabaseConfig_LabelsEntry {+ return { key: "", value: "" };+}++export const PlanConfig_CreateDatabaseConfig_LabelsEntry = {+ encode(message: PlanConfig_CreateDatabaseConfig_LabelsEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {+ if (message.key !== "") {+ writer.uint32(10).string(message.key);+ }+ if (message.value !== "") {+ writer.uint32(18).string(message.value);+ }+ return writer;+ },++ decode(input: _m0.Reader | Uint8Array, length?: number): PlanConfig_CreateDatabaseConfig_LabelsEntry {+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);+ let end = length === undefined ? reader.len : reader.pos + length;+ const message = createBasePlanConfig_CreateDatabaseConfig_LabelsEntry();+ while (reader.pos < end) {+ const tag = reader.uint32();+ switch (tag >>> 3) {+ case 1:+ if (tag !== 10) {+ break;+ }++ message.key = reader.string();+ continue;+ case 2:+ if (tag !== 18) {+ break;+ }++ message.value = reader.string();+ continue;+ }+ if ((tag & 7) === 4 || tag === 0) {+ break;+ }+ reader.skipType(tag & 7);+ }+ return message;+ },++ fromJSON(object: any): PlanConfig_CreateDatabaseConfig_LabelsEntry {+ return { key: isSet(object.key) ? String(object.key) : "", value: isSet(object.value) ? String(object.value) : "" };+ },++ toJSON(message: PlanConfig_CreateDatabaseConfig_LabelsEntry): unknown {+ const obj: any = {};+ message.key !== undefined && (obj.key = message.key);+ message.value !== undefined && (obj.value = message.value);+ return obj;+ },++ create(base?: DeepPartial<PlanConfig_CreateDatabaseConfig_LabelsEntry>): PlanConfig_CreateDatabaseConfig_LabelsEntry {+ return PlanConfig_CreateDatabaseConfig_LabelsEntry.fromPartial(base ?? {});+ },++ fromPartial(+ object: DeepPartial<PlanConfig_CreateDatabaseConfig_LabelsEntry>,+ ): PlanConfig_CreateDatabaseConfig_LabelsEntry {+ const message = createBasePlanConfig_CreateDatabaseConfig_LabelsEntry();+ message.key = object.key ?? "";+ message.value = object.value ?? "";+ return message;+ },+};++function createBasePlanConfig_ChangeDatabaseConfig(): PlanConfig_ChangeDatabaseConfig {+ return { target: "", sheet: "", type: 0, schemaVersion: "", rollbackEnabled: false };+}++export const PlanConfig_ChangeDatabaseConfig = {+ encode(message: PlanConfig_ChangeDatabaseConfig, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {+ if (message.target !== "") {+ writer.uint32(10).string(message.target);+ }+ if (message.sheet !== "") {+ writer.uint32(18).string(message.sheet);+ }+ if (message.type !== 0) {+ writer.uint32(24).int32(message.type);+ }+ if (message.schemaVersion !== "") {+ writer.uint32(34).string(message.schemaVersion);+ }+ if (message.rollbackEnabled === true) {+ writer.uint32(40).bool(message.rollbackEnabled);+ }+ return writer;+ },++ decode(input: _m0.Reader | Uint8Array, length?: number): PlanConfig_ChangeDatabaseConfig {+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);+ let end = length === undefined ? reader.len : reader.pos + length;+ const message = createBasePlanConfig_ChangeDatabaseConfig();+ while (reader.pos < end) {+ const tag = reader.uint32();+ switch (tag >>> 3) {+ case 1:+ if (tag !== 10) {+ break;+ }++ message.target = reader.string();+ continue;+ case 2:+ if (tag !== 18) {+ break;+ }++ message.sheet = reader.string();+ continue;+ case 3:+ if (tag !== 24) {+ break;+ }++ message.type = reader.int32() as any;+ continue;+ case 4:+ if (tag !== 34) {+ break;+ }++ message.schemaVersion = reader.string();+ continue;+ case 5:+ if (tag !== 40) {+ break;+ }++ message.rollbackEnabled = reader.bool();+ continue;+ }+ if ((tag & 7) === 4 || tag === 0) {+ break;+ }+ reader.skipType(tag & 7);+ }+ return message;+ },++ fromJSON(object: any): PlanConfig_ChangeDatabaseConfig {+ return {+ target: isSet(object.target) ? String(object.target) : "",+ sheet: isSet(object.sheet) ? String(object.sheet) : "",+ type: isSet(object.type) ? planConfig_ChangeDatabaseConfig_TypeFromJSON(object.type) : 0,+ schemaVersion: isSet(object.schemaVersion) ? String(object.schemaVersion) : "",+ rollbackEnabled: isSet(object.rollbackEnabled) ? Boolean(object.rollbackEnabled) : false,+ };+ },++ toJSON(message: PlanConfig_ChangeDatabaseConfig): unknown {+ const obj: any = {};+ message.target !== undefined && (obj.target = message.target);+ message.sheet !== undefined && (obj.sheet = message.sheet);+ message.type !== undefined && (obj.type = planConfig_ChangeDatabaseConfig_TypeToJSON(message.type));+ message.schemaVersion !== undefined && (obj.schemaVersion = message.schemaVersion);+ message.rollbackEnabled !== undefined && (obj.rollbackEnabled = message.rollbackEnabled);+ return obj;+ },++ create(base?: DeepPartial<PlanConfig_ChangeDatabaseConfig>): PlanConfig_ChangeDatabaseConfig {+ return PlanConfig_ChangeDatabaseConfig.fromPartial(base ?? {});+ },++ fromPartial(object: DeepPartial<PlanConfig_ChangeDatabaseConfig>): PlanConfig_ChangeDatabaseConfig {+ const message = createBasePlanConfig_ChangeDatabaseConfig();+ message.target = object.target ?? "";+ message.sheet = object.sheet ?? "";+ message.type = object.type ?? 0;+ message.schemaVersion = object.schemaVersion ?? "";+ message.rollbackEnabled = object.rollbackEnabled ?? false;+ return message;+ },+};++function createBasePlanConfig_RestoreDatabaseConfig(): PlanConfig_RestoreDatabaseConfig {+ return { target: "", createDatabaseConfig: undefined, backup: undefined, pointInTime: undefined };+}++export const PlanConfig_RestoreDatabaseConfig = {+ encode(message: PlanConfig_RestoreDatabaseConfig, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {+ if (message.target !== "") {+ writer.uint32(10).string(message.target);+ }+ if (message.createDatabaseConfig !== undefined) {+ PlanConfig_CreateDatabaseConfig.encode(message.createDatabaseConfig, writer.uint32(18).fork()).ldelim();+ }+ if (message.backup !== undefined) {+ writer.uint32(26).string(message.backup);+ }+ if (message.pointInTime !== undefined) {+ Timestamp.encode(toTimestamp(message.pointInTime), writer.uint32(34).fork()).ldelim();+ }+ return writer;+ },++ decode(input: _m0.Reader | Uint8Array, length?: number): PlanConfig_RestoreDatabaseConfig {+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);+ let end = length === undefined ? reader.len : reader.pos + length;+ const message = createBasePlanConfig_RestoreDatabaseConfig();+ while (reader.pos < end) {+ const tag = reader.uint32();+ switch (tag >>> 3) {+ case 1:+ if (tag !== 10) {+ break;+ }++ message.target = reader.string();+ continue;+ case 2:+ if (tag !== 18) {+ break;+ }++ message.createDatabaseConfig = PlanConfig_CreateDatabaseConfig.decode(reader, reader.uint32());+ continue;+ case 3:+ if (tag !== 26) {+ break;+ }++ message.backup = reader.string();+ continue;+ case 4:+ if (tag !== 34) {+ break;+ }++ message.pointInTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));+ continue;+ }+ if ((tag & 7) === 4 || tag === 0) {+ break;+ }+ reader.skipType(tag & 7);+ }+ return message;+ },++ fromJSON(object: any): PlanConfig_RestoreDatabaseConfig {+ return {+ target: isSet(object.target) ? String(object.target) : "",+ createDatabaseConfig: isSet(object.createDatabaseConfig)+ ? PlanConfig_CreateDatabaseConfig.fromJSON(object.createDatabaseConfig)+ : undefined,+ backup: isSet(object.backup) ? String(object.backup) : undefined,+ pointInTime: isSet(object.pointInTime) ? fromJsonTimestamp(object.pointInTime) : undefined,+ };+ },++ toJSON(message: PlanConfig_RestoreDatabaseConfig): unknown {+ const obj: any = {};+ message.target !== undefined && (obj.target = message.target);+ message.createDatabaseConfig !== undefined && (obj.createDatabaseConfig = message.createDatabaseConfig+ ? PlanConfig_CreateDatabaseConfig.toJSON(message.createDatabaseConfig)+ : undefined);+ message.backup !== undefined && (obj.backup = message.backup);+ message.pointInTime !== undefined && (obj.pointInTime = message.pointInTime.toISOString());+ return obj;+ },++ create(base?: DeepPartial<PlanConfig_RestoreDatabaseConfig>): PlanConfig_RestoreDatabaseConfig {+ return PlanConfig_RestoreDatabaseConfig.fromPartial(base ?? {});+ },++ fromPartial(object: DeepPartial<PlanConfig_RestoreDatabaseConfig>): PlanConfig_RestoreDatabaseConfig {+ const message = createBasePlanConfig_RestoreDatabaseConfig();+ message.target = object.target ?? "";+ message.createDatabaseConfig = (object.createDatabaseConfig !== undefined && object.createDatabaseConfig !== null)+ ? PlanConfig_CreateDatabaseConfig.fromPartial(object.createDatabaseConfig)+ : undefined;+ message.backup = object.backup ?? undefined;+ message.pointInTime = object.pointInTime ?? undefined;+ return message;+ },+};++type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;++export type DeepPartial<T> = T extends Builtin ? T+ : T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>+ : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }+ : Partial<T>;++function toTimestamp(date: Date): Timestamp {+ const seconds = date.getTime() / 1_000;+ const nanos = (date.getTime() % 1_000) * 1_000_000;+ return { seconds, nanos };+}++function fromTimestamp(t: Timestamp): Date {+ let millis = (t.seconds || 0) * 1_000;+ millis += (t.nanos || 0) / 1_000_000;+ return new Date(millis);+}++function fromJsonTimestamp(o: any): Date {+ if (o instanceof Date) {+ return o;+ } else if (typeof o === "string") {+ return new Date(o);+ } else {+ return fromTimestamp(Timestamp.fromJSON(o));+ }+}++function isObject(value: any): boolean {+ return typeof value === "object" && value !== null;+}++function isSet(value: any): boolean {+ return value !== null && value !== undefined;+}diff --git a/proto/gen/grpc-doc/store/README.md b/proto/gen/grpc-doc/store/README.mdindex be36f63a17..b12a4d0389 100644--- a/proto/gen/grpc-doc/store/README.md+++ b/proto/gen/grpc-doc/store/README.md@@ -58,6 +58,17 @@- [GrantRequest](#bytebase-store-GrantRequest)- [IssuePayload](#bytebase-store-IssuePayload)+- [store/plan.proto](#store_plan-proto)+ - [PlanConfig](#bytebase-store-PlanConfig)+ - [PlanConfig.ChangeDatabaseConfig](#bytebase-store-PlanConfig-ChangeDatabaseConfig)+ - [PlanConfig.CreateDatabaseConfig](#bytebase-store-PlanConfig-CreateDatabaseConfig)+ - [PlanConfig.CreateDatabaseConfig.LabelsEntry](#bytebase-store-PlanConfig-CreateDatabaseConfig-LabelsEntry)+ - [PlanConfig.RestoreDatabaseConfig](#bytebase-store-PlanConfig-RestoreDatabaseConfig)+ - [PlanConfig.Spec](#bytebase-store-PlanConfig-Spec)+ - [PlanConfig.Step](#bytebase-store-PlanConfig-Step)++ - [PlanConfig.ChangeDatabaseConfig.Type](#bytebase-store-PlanConfig-ChangeDatabaseConfig-Type)+- [store/setting.proto](#store_setting-proto)- [AgentPluginSetting](#bytebase-store-AgentPluginSetting)- [SMTPMailDeliverySetting](#bytebase-store-SMTPMailDeliverySetting)@@ -883,6 +894,163 @@ OIDCIdentityProviderConfig is the structure for OIDC identity provider config.+<a name="store_plan-proto"></a>+<p align="right"><a href="#top">Top</a></p>++## store/plan.proto++++<a name="bytebase-store-PlanConfig"></a>++### PlanConfig++++| Field | Type | Label | Description |+| ----- | ---- | ----- | ----------- |+| steps | [PlanConfig.Step](#bytebase-store-PlanConfig-Step) | repeated | |+++++++<a name="bytebase-store-PlanConfig-ChangeDatabaseConfig"></a>++### PlanConfig.ChangeDatabaseConfig++++| Field | Type | Label | Description |+| ----- | ---- | ----- | ----------- |+| target | [string](#string) | | The resource name of the target. Format: projects/{project}/logicalDatabases/{ldb1}. Format: projects/{project}/logicalDatabases/{ldb1}/logicalTables/{ltb1}. Format: instances/{xxx}/databases/{db1}. |+| sheet | [string](#string) | | The resource name of the sheet. Format: sheets/{sheet} |+| type | [PlanConfig.ChangeDatabaseConfig.Type](#bytebase-store-PlanConfig-ChangeDatabaseConfig-Type) | | |+| schema_version | [string](#string) | | schema_version is parsed from VCS file name. It is automatically generated in the UI workflow. |+| rollback_enabled | [bool](#bool) | | If RollbackEnabled, build the RollbackSheetID of the task. |+++++++<a name="bytebase-store-PlanConfig-CreateDatabaseConfig"></a>++### PlanConfig.CreateDatabaseConfig++++| Field | Type | Label | Description |+| ----- | ---- | ----- | ----------- |+| target | [string](#string) | | The resource name of the instance on which the database is created. Format: instances/{instance} |+| database | [string](#string) | | The name of the database to create. |+| table | [string](#string) | | table is the name of the table, if it is not empty, Bytebase should create a table after creating the database. For example, in MongoDB, it only creates the database when we first store data in that database. |+| character_set | [string](#string) | | character_set is the character set of the database. |+| collation | [string](#string) | | collation is the collation of the database. |+| cluster | [string](#string) | | cluster is the cluster of the database. This is only applicable to ClickHouse for "ON CLUSTER <<cluster>>". |+| owner | [string](#string) | | owner is the owner of the database. This is only applicable to Postgres for "WITH OWNER <<owner>>". |+| backup | [string](#string) | | backup is the resource name of the backup. FIXME: backup v1 API is not ready yet, write the format here when it's ready. |+| labels | [PlanConfig.CreateDatabaseConfig.LabelsEntry](#bytebase-store-PlanConfig-CreateDatabaseConfig-LabelsEntry) | repeated | labels of the database. |+++++++<a name="bytebase-store-PlanConfig-CreateDatabaseConfig-LabelsEntry"></a>++### PlanConfig.CreateDatabaseConfig.LabelsEntry++++| Field | Type | Label | Description |+| ----- | ---- | ----- | ----------- |+| key | [string](#string) | | |+| value | [string](#string) | | |+++++++<a name="bytebase-store-PlanConfig-RestoreDatabaseConfig"></a>++### PlanConfig.RestoreDatabaseConfig++++| Field | Type | Label | Description |+| ----- | ---- | ----- | ----------- |+| target | [string](#string) | | The resource name of the target to restore. Format: instances/{instance}/databases/{database} |+| create_database_config | [PlanConfig.CreateDatabaseConfig](#bytebase-store-PlanConfig-CreateDatabaseConfig) | optional | create_database_config is present if the user wants to restore to a new database. |+| backup | [string](#string) | | FIXME: format TBD Restore from a backup. |+| point_in_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | After the PITR operations, the database will be recovered to the state at this time. |+++++++<a name="bytebase-store-PlanConfig-Spec"></a>++### PlanConfig.Spec++++| Field | Type | Label | Description |+| ----- | ---- | ----- | ----------- |+| earliest_allowed_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | earliest_allowed_time the earliest execution time of the change. |+| create_database_config | [PlanConfig.CreateDatabaseConfig](#bytebase-store-PlanConfig-CreateDatabaseConfig) | | |+| change_database_config | [PlanConfig.ChangeDatabaseConfig](#bytebase-store-PlanConfig-ChangeDatabaseConfig) | | |+| restore_database_config | [PlanConfig.RestoreDatabaseConfig](#bytebase-store-PlanConfig-RestoreDatabaseConfig) | | |+++++++<a name="bytebase-store-PlanConfig-Step"></a>++### PlanConfig.Step++++| Field | Type | Label | Description |+| ----- | ---- | ----- | ----------- |+| specs | [PlanConfig.Spec](#bytebase-store-PlanConfig-Spec) | repeated | |+++++++++<a name="bytebase-store-PlanConfig-ChangeDatabaseConfig-Type"></a>++### PlanConfig.ChangeDatabaseConfig.Type+Type is the database change type.++| Name | Number | Description |+| ---- | ------ | ----------- |+| TYPE_UNSPECIFIED | 0 | |+| BASELINE | 1 | Used for establishing schema baseline, this is used when 1. Onboard the database into Bytebase since Bytebase needs to know the current database schema. 2. Had schema drift and need to re-establish the baseline. |+| MIGRATE | 2 | Used for DDL changes including CREATE DATABASE. |+| MIGRATE_SDL | 3 | Used for schema changes via state-based schema migration including CREATE DATABASE. |+| MIGRATE_GHOST | 4 | Used for DDL changes using gh-ost. |+| BRANCH | 5 | Used when restoring from a backup (the restored database branched from the original backup). |+| DATA | 6 | Used for DML change. |++++++++++<a name="store_setting-proto"></a><p align="right"><a href="#top">Top</a></p>diff --git a/proto/generated-go/store/plan.pb.go b/proto/generated-go/store/plan.pb.gonew file mode 100644index 0000000000..cdf609a4db--- /dev/null+++ b/proto/generated-go/store/plan.pb.go@@ -0,0 +1,869 @@+// Code generated by protoc-gen-go. DO NOT EDIT.+// versions:+// protoc-gen-go v1.30.0+// protoc (unknown)+// source: store/plan.proto++package store++import (+ protoreflect "google.golang.org/protobuf/reflect/protoreflect"+ protoimpl "google.golang.org/protobuf/runtime/protoimpl"+ timestamppb "google.golang.org/protobuf/types/known/timestamppb"+ reflect "reflect"+ sync "sync"+)++const (+ // Verify that this generated code is sufficiently up-to-date.+ _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)+ // Verify that runtime/protoimpl is sufficiently up-to-date.+ _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)+)++// Type is the database change type.+type PlanConfig_ChangeDatabaseConfig_Type int32++const (+ PlanConfig_ChangeDatabaseConfig_TYPE_UNSPECIFIED PlanConfig_ChangeDatabaseConfig_Type = 0+ // Used for establishing schema baseline, this is used when+ // 1. Onboard the database into Bytebase since Bytebase needs to know the current database schema.+ // 2. Had schema drift and need to re-establish the baseline.+ PlanConfig_ChangeDatabaseConfig_BASELINE PlanConfig_ChangeDatabaseConfig_Type = 1+ // Used for DDL changes including CREATE DATABASE.+ PlanConfig_ChangeDatabaseConfig_MIGRATE PlanConfig_ChangeDatabaseConfig_Type = 2+ // Used for schema changes via state-based schema migration including CREATE DATABASE.+ PlanConfig_ChangeDatabaseConfig_MIGRATE_SDL PlanConfig_ChangeDatabaseConfig_Type = 3+ // Used for DDL changes using gh-ost.+ PlanConfig_ChangeDatabaseConfig_MIGRATE_GHOST PlanConfig_ChangeDatabaseConfig_Type = 4+ // Used when restoring from a backup (the restored database branched from the original backup).+ PlanConfig_ChangeDatabaseConfig_BRANCH PlanConfig_ChangeDatabaseConfig_Type = 5+ // Used for DML change.+ PlanConfig_ChangeDatabaseConfig_DATA PlanConfig_ChangeDatabaseConfig_Type = 6+)++// Enum value maps for PlanConfig_ChangeDatabaseConfig_Type.+var (+ PlanConfig_ChangeDatabaseConfig_Type_name = map[int32]string{+ 0: "TYPE_UNSPECIFIED",+ 1: "BASELINE",+ 2: "MIGRATE",+ 3: "MIGRATE_SDL",+ 4: "MIGRATE_GHOST",+ 5: "BRANCH",+ 6: "DATA",+ }+ PlanConfig_ChangeDatabaseConfig_Type_value = map[string]int32{+ "TYPE_UNSPECIFIED": 0,+ "BASELINE": 1,+ "MIGRATE": 2,+ "MIGRATE_SDL": 3,+ "MIGRATE_GHOST": 4,+ "BRANCH": 5,+ "DATA": 6,+ }+)++func (x PlanConfig_ChangeDatabaseConfig_Type) Enum() *PlanConfig_ChangeDatabaseConfig_Type {+ p := new(PlanConfig_ChangeDatabaseConfig_Type)+ *p = x+ return p+}++func (x PlanConfig_ChangeDatabaseConfig_Type) String() string {+ return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))+}++func (PlanConfig_ChangeDatabaseConfig_Type) Descriptor() protoreflect.EnumDescriptor {+ return file_store_plan_proto_enumTypes[0].Descriptor()+}++func (PlanConfig_ChangeDatabaseConfig_Type) Type() protoreflect.EnumType {+ return &file_store_plan_proto_enumTypes[0]+}++func (x PlanConfig_ChangeDatabaseConfig_Type) Number() protoreflect.EnumNumber {+ return protoreflect.EnumNumber(x)+}++// Deprecated: Use PlanConfig_ChangeDatabaseConfig_Type.Descriptor instead.+func (PlanConfig_ChangeDatabaseConfig_Type) EnumDescriptor() ([]byte, []int) {+ return file_store_plan_proto_rawDescGZIP(), []int{0, 3, 0}+}++type PlanConfig struct {+ state protoimpl.MessageState+ sizeCache protoimpl.SizeCache+ unknownFields protoimpl.UnknownFields++ Steps []*PlanConfig_Step `protobuf:"bytes,1,rep,name=steps,proto3" json:"steps,omitempty"`+}++func (x *PlanConfig) Reset() {+ *x = PlanConfig{}+ if protoimpl.UnsafeEnabled {+ mi := &file_store_plan_proto_msgTypes[0]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+ }+}++func (x *PlanConfig) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*PlanConfig) ProtoMessage() {}++func (x *PlanConfig) ProtoReflect() protoreflect.Message {+ mi := &file_store_plan_proto_msgTypes[0]+ if protoimpl.UnsafeEnabled && x != nil {+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ if ms.LoadMessageInfo() == nil {+ ms.StoreMessageInfo(mi)+ }+ return ms+ }+ return mi.MessageOf(x)+}++// Deprecated: Use PlanConfig.ProtoReflect.Descriptor instead.+func (*PlanConfig) Descriptor() ([]byte, []int) {+ return file_store_plan_proto_rawDescGZIP(), []int{0}+}++func (x *PlanConfig) GetSteps() []*PlanConfig_Step {+ if x != nil {+ return x.Steps+ }+ return nil+}++type PlanConfig_Step struct {+ state protoimpl.MessageState+ sizeCache protoimpl.SizeCache+ unknownFields protoimpl.UnknownFields++ Specs []*PlanConfig_Spec `protobuf:"bytes,1,rep,name=specs,proto3" json:"specs,omitempty"`+}++func (x *PlanConfig_Step) Reset() {+ *x = PlanConfig_Step{}+ if protoimpl.UnsafeEnabled {+ mi := &file_store_plan_proto_msgTypes[1]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+ }+}++func (x *PlanConfig_Step) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*PlanConfig_Step) ProtoMessage() {}++func (x *PlanConfig_Step) ProtoReflect() protoreflect.Message {+ mi := &file_store_plan_proto_msgTypes[1]+ if protoimpl.UnsafeEnabled && x != nil {+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ if ms.LoadMessageInfo() == nil {+ ms.StoreMessageInfo(mi)+ }+ return ms+ }+ return mi.MessageOf(x)+}++// Deprecated: Use PlanConfig_Step.ProtoReflect.Descriptor instead.+func (*PlanConfig_Step) Descriptor() ([]byte, []int) {+ return file_store_plan_proto_rawDescGZIP(), []int{0, 0}+}++func (x *PlanConfig_Step) GetSpecs() []*PlanConfig_Spec {+ if x != nil {+ return x.Specs+ }+ return nil+}++type PlanConfig_Spec struct {+ state protoimpl.MessageState+ sizeCache protoimpl.SizeCache+ unknownFields protoimpl.UnknownFields++ // earliest_allowed_time the earliest execution time of the change.+ EarliestAllowedTime *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=earliest_allowed_time,json=earliestAllowedTime,proto3" json:"earliest_allowed_time,omitempty"`+ // Types that are assignable to Config:+ //+ // *PlanConfig_Spec_CreateDatabaseConfig+ // *PlanConfig_Spec_ChangeDatabaseConfig+ // *PlanConfig_Spec_RestoreDatabaseConfig+ Config isPlanConfig_Spec_Config `protobuf_oneof:"config"`+}++func (x *PlanConfig_Spec) Reset() {+ *x = PlanConfig_Spec{}+ if protoimpl.UnsafeEnabled {+ mi := &file_store_plan_proto_msgTypes[2]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+ }+}++func (x *PlanConfig_Spec) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*PlanConfig_Spec) ProtoMessage() {}++func (x *PlanConfig_Spec) ProtoReflect() protoreflect.Message {+ mi := &file_store_plan_proto_msgTypes[2]+ if protoimpl.UnsafeEnabled && x != nil {+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ if ms.LoadMessageInfo() == nil {+ ms.StoreMessageInfo(mi)+ }+ return ms+ }+ return mi.MessageOf(x)+}++// Deprecated: Use PlanConfig_Spec.ProtoReflect.Descriptor instead.+func (*PlanConfig_Spec) Descriptor() ([]byte, []int) {+ return file_store_plan_proto_rawDescGZIP(), []int{0, 1}+}++func (x *PlanConfig_Spec) GetEarliestAllowedTime() *timestamppb.Timestamp {+ if x != nil {+ return x.EarliestAllowedTime+ }+ return nil+}++func (m *PlanConfig_Spec) GetConfig() isPlanConfig_Spec_Config {+ if m != nil {+ return m.Config+ }+ return nil+}++func (x *PlanConfig_Spec) GetCreateDatabaseConfig() *PlanConfig_CreateDatabaseConfig {+ if x, ok := x.GetConfig().(*PlanConfig_Spec_CreateDatabaseConfig); ok {+ return x.CreateDatabaseConfig+ }+ return nil+}++func (x *PlanConfig_Spec) GetChangeDatabaseConfig() *PlanConfig_ChangeDatabaseConfig {+ if x, ok := x.GetConfig().(*PlanConfig_Spec_ChangeDatabaseConfig); ok {+ return x.ChangeDatabaseConfig+ }+ return nil+}++func (x *PlanConfig_Spec) GetRestoreDatabaseConfig() *PlanConfig_RestoreDatabaseConfig {+ if x, ok := x.GetConfig().(*PlanConfig_Spec_RestoreDatabaseConfig); ok {+ return x.RestoreDatabaseConfig+ }+ return nil+}++type isPlanConfig_Spec_Config interface {+ isPlanConfig_Spec_Config()+}++type PlanConfig_Spec_CreateDatabaseConfig struct {+ CreateDatabaseConfig *PlanConfig_CreateDatabaseConfig `protobuf:"bytes,1,opt,name=create_database_config,json=createDatabaseConfig,proto3,oneof"`+}++type PlanConfig_Spec_ChangeDatabaseConfig struct {+ ChangeDatabaseConfig *PlanConfig_ChangeDatabaseConfig `protobuf:"bytes,2,opt,name=change_database_config,json=changeDatabaseConfig,proto3,oneof"`+}++type PlanConfig_Spec_RestoreDatabaseConfig struct {+ RestoreDatabaseConfig *PlanConfig_RestoreDatabaseConfig `protobuf:"bytes,3,opt,name=restore_database_config,json=restoreDatabaseConfig,proto3,oneof"`+}++func (*PlanConfig_Spec_CreateDatabaseConfig) isPlanConfig_Spec_Config() {}++func (*PlanConfig_Spec_ChangeDatabaseConfig) isPlanConfig_Spec_Config() {}++func (*PlanConfig_Spec_RestoreDatabaseConfig) isPlanConfig_Spec_Config() {}++type PlanConfig_CreateDatabaseConfig struct {+ state protoimpl.MessageState+ sizeCache protoimpl.SizeCache+ unknownFields protoimpl.UnknownFields++ // The resource name of the instance on which the database is created.+ // Format: instances/{instance}+ Target string `protobuf:"bytes,1,opt,name=target,proto3" json:"target,omitempty"`+ // The name of the database to create.+ Database string `protobuf:"bytes,2,opt,name=database,proto3" json:"database,omitempty"`+ // table is the name of the table, if it is not empty, Bytebase should create a table after creating the database.+ // For example, in MongoDB, it only creates the database when we first store data in that database.+ Table string `protobuf:"bytes,3,opt,name=table,proto3" json:"table,omitempty"`+ // character_set is the character set of the database.+ CharacterSet string `protobuf:"bytes,4,opt,name=character_set,json=characterSet,proto3" json:"character_set,omitempty"`+ // collation is the collation of the database.+ Collation string `protobuf:"bytes,5,opt,name=collation,proto3" json:"collation,omitempty"`+ // cluster is the cluster of the database. This is only applicable to ClickHouse for "ON CLUSTER <<cluster>>".+ Cluster string `protobuf:"bytes,6,opt,name=cluster,proto3" json:"cluster,omitempty"`+ // owner is the owner of the database. This is only applicable to Postgres for "WITH OWNER <<owner>>".+ Owner string `protobuf:"bytes,7,opt,name=owner,proto3" json:"owner,omitempty"`+ // backup is the resource name of the backup.+ // FIXME: backup v1 API is not ready yet, write the format here when it's ready.+ Backup string `protobuf:"bytes,8,opt,name=backup,proto3" json:"backup,omitempty"`+ // labels of the database.+ Labels map[string]string `protobuf:"bytes,9,rep,name=labels,proto3" json:"labels,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`+}++func (x *PlanConfig_CreateDatabaseConfig) Reset() {+ *x = PlanConfig_CreateDatabaseConfig{}+ if protoimpl.UnsafeEnabled {+ mi := &file_store_plan_proto_msgTypes[3]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+ }+}++func (x *PlanConfig_CreateDatabaseConfig) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*PlanConfig_CreateDatabaseConfig) ProtoMessage() {}++func (x *PlanConfig_CreateDatabaseConfig) ProtoReflect() protoreflect.Message {+ mi := &file_store_plan_proto_msgTypes[3]+ if protoimpl.UnsafeEnabled && x != nil {+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ if ms.LoadMessageInfo() == nil {+ ms.StoreMessageInfo(mi)+ }+ return ms+ }+ return mi.MessageOf(x)+}++// Deprecated: Use PlanConfig_CreateDatabaseConfig.ProtoReflect.Descriptor instead.+func (*PlanConfig_CreateDatabaseConfig) Descriptor() ([]byte, []int) {+ return file_store_plan_proto_rawDescGZIP(), []int{0, 2}+}++func (x *PlanConfig_CreateDatabaseConfig) GetTarget() string {+ if x != nil {+ return x.Target+ }+ return ""+}++func (x *PlanConfig_CreateDatabaseConfig) GetDatabase() string {+ if x != nil {+ return x.Database+ }+ return ""+}++func (x *PlanConfig_CreateDatabaseConfig) GetTable() string {+ if x != nil {+ return x.Table+ }+ return ""+}++func (x *PlanConfig_CreateDatabaseConfig) GetCharacterSet() string {+ if x != nil {+ return x.CharacterSet+ }+ return ""+}++func (x *PlanConfig_CreateDatabaseConfig) GetCollation() string {+ if x != nil {+ return x.Collation+ }+ return ""+}++func (x *PlanConfig_CreateDatabaseConfig) GetCluster() string {+ if x != nil {+ return x.Cluster+ }+ return ""+}++func (x *PlanConfig_CreateDatabaseConfig) GetOwner() string {+ if x != nil {+ return x.Owner+ }+ return ""+}++func (x *PlanConfig_CreateDatabaseConfig) GetBackup() string {+ if x != nil {+ return x.Backup+ }+ return ""+}++func (x *PlanConfig_CreateDatabaseConfig) GetLabels() map[string]string {+ if x != nil {+ return x.Labels+ }+ return nil+}++type PlanConfig_ChangeDatabaseConfig struct {+ state protoimpl.MessageState+ sizeCache protoimpl.SizeCache+ unknownFields protoimpl.UnknownFields++ // The resource name of the target.+ // Format: projects/{project}/logicalDatabases/{ldb1}.+ // Format: projects/{project}/logicalDatabases/{ldb1}/logicalTables/{ltb1}.+ // Format: instances/{xxx}/databases/{db1}.+ Target string `protobuf:"bytes,1,opt,name=target,proto3" json:"target,omitempty"`+ // The resource name of the sheet.+ // Format: sheets/{sheet}+ Sheet string `protobuf:"bytes,2,opt,name=sheet,proto3" json:"sheet,omitempty"`+ Type PlanConfig_ChangeDatabaseConfig_Type `protobuf:"varint,3,opt,name=type,proto3,enum=bytebase.store.PlanConfig_ChangeDatabaseConfig_Type" json:"type,omitempty"`+ // schema_version is parsed from VCS file name.+ // It is automatically generated in the UI workflow.+ SchemaVersion string `protobuf:"bytes,4,opt,name=schema_version,json=schemaVersion,proto3" json:"schema_version,omitempty"`+ // If RollbackEnabled, build the RollbackSheetID of the task.+ RollbackEnabled bool `protobuf:"varint,5,opt,name=rollback_enabled,json=rollbackEnabled,proto3" json:"rollback_enabled,omitempty"`+}++func (x *PlanConfig_ChangeDatabaseConfig) Reset() {+ *x = PlanConfig_ChangeDatabaseConfig{}+ if protoimpl.UnsafeEnabled {+ mi := &file_store_plan_proto_msgTypes[4]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+ }+}++func (x *PlanConfig_ChangeDatabaseConfig) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*PlanConfig_ChangeDatabaseConfig) ProtoMessage() {}++func (x *PlanConfig_ChangeDatabaseConfig) ProtoReflect() protoreflect.Message {+ mi := &file_store_plan_proto_msgTypes[4]+ if protoimpl.UnsafeEnabled && x != nil {+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ if ms.LoadMessageInfo() == nil {+ ms.StoreMessageInfo(mi)+ }+ return ms+ }+ return mi.MessageOf(x)+}++// Deprecated: Use PlanConfig_ChangeDatabaseConfig.ProtoReflect.Descriptor instead.+func (*PlanConfig_ChangeDatabaseConfig) Descriptor() ([]byte, []int) {+ return file_store_plan_proto_rawDescGZIP(), []int{0, 3}+}++func (x *PlanConfig_ChangeDatabaseConfig) GetTarget() string {+ if x != nil {+ return x.Target+ }+ return ""+}++func (x *PlanConfig_ChangeDatabaseConfig) GetSheet() string {+ if x != nil {+ return x.Sheet+ }+ return ""+}++func (x *PlanConfig_ChangeDatabaseConfig) GetType() PlanConfig_ChangeDatabaseConfig_Type {+ if x != nil {+ return x.Type+ }+ return PlanConfig_ChangeDatabaseConfig_TYPE_UNSPECIFIED+}++func (x *PlanConfig_ChangeDatabaseConfig) GetSchemaVersion() string {+ if x != nil {+ return x.SchemaVersion+ }+ return ""+}++func (x *PlanConfig_ChangeDatabaseConfig) GetRollbackEnabled() bool {+ if x != nil {+ return x.RollbackEnabled+ }+ return false+}++type PlanConfig_RestoreDatabaseConfig struct {+ state protoimpl.MessageState+ sizeCache protoimpl.SizeCache+ unknownFields protoimpl.UnknownFields++ // The resource name of the target to restore.+ // Format: instances/{instance}/databases/{database}+ Target string `protobuf:"bytes,1,opt,name=target,proto3" json:"target,omitempty"`+ // create_database_config is present if the user wants to restore to a new database.+ CreateDatabaseConfig *PlanConfig_CreateDatabaseConfig `protobuf:"bytes,2,opt,name=create_database_config,json=createDatabaseConfig,proto3,oneof" json:"create_database_config,omitempty"`+ // source determines how to restore the database.+ // 1. from a backup+ // 2. from a point in time+ //+ // Types that are assignable to Source:+ //+ // *PlanConfig_RestoreDatabaseConfig_Backup+ // *PlanConfig_RestoreDatabaseConfig_PointInTime+ Source isPlanConfig_RestoreDatabaseConfig_Source `protobuf_oneof:"source"`+}++func (x *PlanConfig_RestoreDatabaseConfig) Reset() {+ *x = PlanConfig_RestoreDatabaseConfig{}+ if protoimpl.UnsafeEnabled {+ mi := &file_store_plan_proto_msgTypes[5]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+ }+}++func (x *PlanConfig_RestoreDatabaseConfig) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*PlanConfig_RestoreDatabaseConfig) ProtoMessage() {}++func (x *PlanConfig_RestoreDatabaseConfig) ProtoReflect() protoreflect.Message {+ mi := &file_store_plan_proto_msgTypes[5]+ if protoimpl.UnsafeEnabled && x != nil {+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ if ms.LoadMessageInfo() == nil {+ ms.StoreMessageInfo(mi)+ }+ return ms+ }+ return mi.MessageOf(x)+}++// Deprecated: Use PlanConfig_RestoreDatabaseConfig.ProtoReflect.Descriptor instead.+func (*PlanConfig_RestoreDatabaseConfig) Descriptor() ([]byte, []int) {+ return file_store_plan_proto_rawDescGZIP(), []int{0, 4}+}++func (x *PlanConfig_RestoreDatabaseConfig) GetTarget() string {+ if x != nil {+ return x.Target+ }+ return ""+}++func (x *PlanConfig_RestoreDatabaseConfig) GetCreateDatabaseConfig() *PlanConfig_CreateDatabaseConfig {+ if x != nil {+ return x.CreateDatabaseConfig+ }+ return nil+}++func (m *PlanConfig_RestoreDatabaseConfig) GetSource() isPlanConfig_RestoreDatabaseConfig_Source {+ if m != nil {+ return m.Source+ }+ return nil+}++func (x *PlanConfig_RestoreDatabaseConfig) GetBackup() string {+ if x, ok := x.GetSource().(*PlanConfig_RestoreDatabaseConfig_Backup); ok {+ return x.Backup+ }+ return ""+}++func (x *PlanConfig_RestoreDatabaseConfig) GetPointInTime() *timestamppb.Timestamp {+ if x, ok := x.GetSource().(*PlanConfig_RestoreDatabaseConfig_PointInTime); ok {+ return x.PointInTime+ }+ return nil+}++type isPlanConfig_RestoreDatabaseConfig_Source interface {+ isPlanConfig_RestoreDatabaseConfig_Source()+}++type PlanConfig_RestoreDatabaseConfig_Backup struct {+ // FIXME: format TBD+ // Restore from a backup.+ Backup string `protobuf:"bytes,3,opt,name=backup,proto3,oneof"`+}++type PlanConfig_RestoreDatabaseConfig_PointInTime struct {+ // After the PITR operations, the database will be recovered to the state at this time.+ PointInTime *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=point_in_time,json=pointInTime,proto3,oneof"`+}++func (*PlanConfig_RestoreDatabaseConfig_Backup) isPlanConfig_RestoreDatabaseConfig_Source() {}++func (*PlanConfig_RestoreDatabaseConfig_PointInTime) isPlanConfig_RestoreDatabaseConfig_Source() {}++var File_store_plan_proto protoreflect.FileDescriptor++var file_store_plan_proto_rawDesc = []byte{+ 0x0a, 0x10, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2f, 0x70, 0x6c, 0x61, 0x6e, 0x2e, 0x70, 0x72, 0x6f,+ 0x74, 0x6f, 0x12, 0x0e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x73, 0x74, 0x6f,+ 0x72, 0x65, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f,+ 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72,+ 0x6f, 0x74, 0x6f, 0x22, 0x96, 0x0c, 0x0a, 0x0a, 0x50, 0x6c, 0x61, 0x6e, 0x43, 0x6f, 0x6e, 0x66,+ 0x69, 0x67, 0x12, 0x35, 0x0a, 0x05, 0x73, 0x74, 0x65, 0x70, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28,+ 0x0b, 0x32, 0x1f, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x73, 0x74, 0x6f,+ 0x72, 0x65, 0x2e, 0x50, 0x6c, 0x61, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x53, 0x74,+ 0x65, 0x70, 0x52, 0x05, 0x73, 0x74, 0x65, 0x70, 0x73, 0x1a, 0x3d, 0x0a, 0x04, 0x53, 0x74, 0x65,+ 0x70, 0x12, 0x35, 0x0a, 0x05, 0x73, 0x70, 0x65, 0x63, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b,+ 0x32, 0x1f, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x73, 0x74, 0x6f, 0x72,+ 0x65, 0x2e, 0x50, 0x6c, 0x61, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x53, 0x70, 0x65,+ 0x63, 0x52, 0x05, 0x73, 0x70, 0x65, 0x63, 0x73, 0x1a, 0x9e, 0x03, 0x0a, 0x04, 0x53, 0x70, 0x65,+ 0x63, 0x12, 0x4e, 0x0a, 0x15, 0x65, 0x61, 0x72, 0x6c, 0x69, 0x65, 0x73, 0x74, 0x5f, 0x61, 0x6c,+ 0x6c, 0x6f, 0x77, 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b,+ 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62,+ 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x13, 0x65, 0x61,+ 0x72, 0x6c, 0x69, 0x65, 0x73, 0x74, 0x41, 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, 0x54, 0x69, 0x6d,+ 0x65, 0x12, 0x67, 0x0a, 0x16, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x5f, 0x64, 0x61, 0x74, 0x61,+ 0x62, 0x61, 0x73, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28,+ 0x0b, 0x32, 0x2f, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x73, 0x74, 0x6f,+ 0x72, 0x65, 0x2e, 0x50, 0x6c, 0x61, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x43, 0x72,+ 0x65, 0x61, 0x74, 0x65, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x43, 0x6f, 0x6e, 0x66,+ 0x69, 0x67, 0x48, 0x00, 0x52, 0x14, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x44, 0x61, 0x74, 0x61,+ 0x62, 0x61, 0x73, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x67, 0x0a, 0x16, 0x63, 0x68,+ 0x61, 0x6e, 0x67, 0x65, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x5f, 0x63, 0x6f,+ 0x6e, 0x66, 0x69, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x62, 0x79, 0x74,+ 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x50, 0x6c, 0x61, 0x6e,+ 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x44, 0x61, 0x74,+ 0x61, 0x62, 0x61, 0x73, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x48, 0x00, 0x52, 0x14, 0x63,+ 0x68, 0x61, 0x6e, 0x67, 0x65, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x43, 0x6f, 0x6e,+ 0x66, 0x69, 0x67, 0x12, 0x6a, 0x0a, 0x17, 0x72, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x5f, 0x64,+ 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x03,+ 0x20, 0x01, 0x28, 0x0b, 0x32, 0x30, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e,+ 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x50, 0x6c, 0x61, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67,+ 0x2e, 0x52, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65,+ 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x48, 0x00, 0x52, 0x15, 0x72, 0x65, 0x73, 0x74, 0x6f, 0x72,+ 0x65, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x42,+ 0x08, 0x0a, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x1a, 0xfb, 0x02, 0x0a, 0x14, 0x43, 0x72,+ 0x65, 0x61, 0x74, 0x65, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x43, 0x6f, 0x6e, 0x66,+ 0x69, 0x67, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01,+ 0x28, 0x09, 0x52, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x61,+ 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x64, 0x61,+ 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x18,+ 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x23, 0x0a, 0x0d,+ 0x63, 0x68, 0x61, 0x72, 0x61, 0x63, 0x74, 0x65, 0x72, 0x5f, 0x73, 0x65, 0x74, 0x18, 0x04, 0x20,+ 0x01, 0x28, 0x09, 0x52, 0x0c, 0x63, 0x68, 0x61, 0x72, 0x61, 0x63, 0x74, 0x65, 0x72, 0x53, 0x65,+ 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x6f, 0x6c, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x05,+ 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x6f, 0x6c, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12,+ 0x18, 0x0a, 0x07, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09,+ 0x52, 0x07, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x6f, 0x77, 0x6e,+ 0x65, 0x72, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x12,+ 0x16, 0x0a, 0x06, 0x62, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52,+ 0x06, 0x62, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x12, 0x53, 0x0a, 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c,+ 0x73, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x3b, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61,+ 0x73, 0x65, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x50, 0x6c, 0x61, 0x6e, 0x43, 0x6f, 0x6e,+ 0x66, 0x69, 0x67, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61,+ 0x73, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x45,+ 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x1a, 0x39, 0x0a, 0x0b,+ 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b,+ 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a,+ 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61,+ 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0xd3, 0x02, 0x0a, 0x14, 0x43, 0x68, 0x61, 0x6e,+ 0x67, 0x65, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67,+ 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,+ 0x52, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x68, 0x65, 0x65,+ 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, 0x68, 0x65, 0x65, 0x74, 0x12, 0x48,+ 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x34, 0x2e, 0x62,+ 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x50, 0x6c,+ 0x61, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x44,+ 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x54, 0x79,+ 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x25, 0x0a, 0x0e, 0x73, 0x63, 0x68, 0x65,+ 0x6d, 0x61, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09,+ 0x52, 0x0d, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12,+ 0x29, 0x0a, 0x10, 0x72, 0x6f, 0x6c, 0x6c, 0x62, 0x61, 0x63, 0x6b, 0x5f, 0x65, 0x6e, 0x61, 0x62,+ 0x6c, 0x65, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f, 0x72, 0x6f, 0x6c, 0x6c, 0x62,+ 0x61, 0x63, 0x6b, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x22, 0x71, 0x0a, 0x04, 0x54, 0x79,+ 0x70, 0x65, 0x12, 0x14, 0x0a, 0x10, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45,+ 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x42, 0x41, 0x53, 0x45,+ 0x4c, 0x49, 0x4e, 0x45, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x4d, 0x49, 0x47, 0x52, 0x41, 0x54,+ 0x45, 0x10, 0x02, 0x12, 0x0f, 0x0a, 0x0b, 0x4d, 0x49, 0x47, 0x52, 0x41, 0x54, 0x45, 0x5f, 0x53,+ 0x44, 0x4c, 0x10, 0x03, 0x12, 0x11, 0x0a, 0x0d, 0x4d, 0x49, 0x47, 0x52, 0x41, 0x54, 0x45, 0x5f,+ 0x47, 0x48, 0x4f, 0x53, 0x54, 0x10, 0x04, 0x12, 0x0a, 0x0a, 0x06, 0x42, 0x52, 0x41, 0x4e, 0x43,+ 0x48, 0x10, 0x05, 0x12, 0x08, 0x0a, 0x04, 0x44, 0x41, 0x54, 0x41, 0x10, 0x06, 0x1a, 0x9c, 0x02,+ 0x0a, 0x15, 0x52, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73,+ 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65,+ 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12,+ 0x6a, 0x0a, 0x16, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61,+ 0x73, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32,+ 0x2f, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65,+ 0x2e, 0x50, 0x6c, 0x61, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x43, 0x72, 0x65, 0x61,+ 0x74, 0x65, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67,+ 0x48, 0x01, 0x52, 0x14, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61,+ 0x73, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x88, 0x01, 0x01, 0x12, 0x18, 0x0a, 0x06, 0x62,+ 0x61, 0x63, 0x6b, 0x75, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x06, 0x62,+ 0x61, 0x63, 0x6b, 0x75, 0x70, 0x12, 0x40, 0x0a, 0x0d, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x5f, 0x69,+ 0x6e, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67,+ 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54,+ 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x48, 0x00, 0x52, 0x0b, 0x70, 0x6f, 0x69, 0x6e,+ 0x74, 0x49, 0x6e, 0x54, 0x69, 0x6d, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63,+ 0x65, 0x42, 0x19, 0x0a, 0x17, 0x5f, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x5f, 0x64, 0x61, 0x74,+ 0x61, 0x62, 0x61, 0x73, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x42, 0x14, 0x5a, 0x12,+ 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2d, 0x67, 0x6f, 0x2f, 0x73, 0x74, 0x6f,+ 0x72, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,+}++var (+ file_store_plan_proto_rawDescOnce sync.Once+ file_store_plan_proto_rawDescData = file_store_plan_proto_rawDesc+)++func file_store_plan_proto_rawDescGZIP() []byte {+ file_store_plan_proto_rawDescOnce.Do(func() {+ file_store_plan_proto_rawDescData = protoimpl.X.CompressGZIP(file_store_plan_proto_rawDescData)+ })+ return file_store_plan_proto_rawDescData+}++var file_store_plan_proto_enumTypes = make([]protoimpl.EnumInfo, 1)+var file_store_plan_proto_msgTypes = make([]protoimpl.MessageInfo, 7)+var file_store_plan_proto_goTypes = []interface{}{+ (PlanConfig_ChangeDatabaseConfig_Type)(0), // 0: bytebase.store.PlanConfig.ChangeDatabaseConfig.Type+ (*PlanConfig)(nil), // 1: bytebase.store.PlanConfig+ (*PlanConfig_Step)(nil), // 2: bytebase.store.PlanConfig.Step+ (*PlanConfig_Spec)(nil), // 3: bytebase.store.PlanConfig.Spec+ (*PlanConfig_CreateDatabaseConfig)(nil), // 4: bytebase.store.PlanConfig.CreateDatabaseConfig+ (*PlanConfig_ChangeDatabaseConfig)(nil), // 5: bytebase.store.PlanConfig.ChangeDatabaseConfig+ (*PlanConfig_RestoreDatabaseConfig)(nil), // 6: bytebase.store.PlanConfig.RestoreDatabaseConfig+ nil, // 7: bytebase.store.PlanConfig.CreateDatabaseConfig.LabelsEntry+ (*timestamppb.Timestamp)(nil), // 8: google.protobuf.Timestamp+}+var file_store_plan_proto_depIdxs = []int32{+ 2, // 0: bytebase.store.PlanConfig.steps:type_name -> bytebase.store.PlanConfig.Step+ 3, // 1: bytebase.store.PlanConfig.Step.specs:type_name -> bytebase.store.PlanConfig.Spec+ 8, // 2: bytebase.store.PlanConfig.Spec.earliest_allowed_time:type_name -> google.protobuf.Timestamp+ 4, // 3: bytebase.store.PlanConfig.Spec.create_database_config:type_name -> bytebase.store.PlanConfig.CreateDatabaseConfig+ 5, // 4: bytebase.store.PlanConfig.Spec.change_database_config:type_name -> bytebase.store.PlanConfig.ChangeDatabaseConfig+ 6, // 5: bytebase.store.PlanConfig.Spec.restore_database_config:type_name -> bytebase.store.PlanConfig.RestoreDatabaseConfig+ 7, // 6: bytebase.store.PlanConfig.CreateDatabaseConfig.labels:type_name -> bytebase.store.PlanConfig.CreateDatabaseConfig.LabelsEntry+ 0, // 7: bytebase.store.PlanConfig.ChangeDatabaseConfig.type:type_name -> bytebase.store.PlanConfig.ChangeDatabaseConfig.Type+ 4, // 8: bytebase.store.PlanConfig.RestoreDatabaseConfig.create_database_config:type_name -> bytebase.store.PlanConfig.CreateDatabaseConfig+ 8, // 9: bytebase.store.PlanConfig.RestoreDatabaseConfig.point_in_time:type_name -> google.protobuf.Timestamp+ 10, // [10:10] is the sub-list for method output_type+ 10, // [10:10] is the sub-list for method input_type+ 10, // [10:10] is the sub-list for extension type_name+ 10, // [10:10] is the sub-list for extension extendee+ 0, // [0:10] is the sub-list for field type_name+}++func init() { file_store_plan_proto_init() }+func file_store_plan_proto_init() {+ if File_store_plan_proto != nil {+ return+ }+ if !protoimpl.UnsafeEnabled {+ file_store_plan_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {+ switch v := v.(*PlanConfig); i {+ case 0:+ return &v.state+ case 1:+ return &v.sizeCache+ case 2:+ return &v.unknownFields+ default:+ return nil+ }+ }+ file_store_plan_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {+ switch v := v.(*PlanConfig_Step); i {+ case 0:+ return &v.state+ case 1:+ return &v.sizeCache+ case 2:+ return &v.unknownFields+ default:+ return nil+ }+ }+ file_store_plan_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {+ switch v := v.(*PlanConfig_Spec); i {+ case 0:+ return &v.state+ case 1:+ return &v.sizeCache+ case 2:+ return &v.unknownFields+ default:+ return nil+ }+ }+ file_store_plan_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {+ switch v := v.(*PlanConfig_CreateDatabaseConfig); i {+ case 0:+ return &v.state+ case 1:+ return &v.sizeCache+ case 2:+ return &v.unknownFields+ default:+ return nil+ }+ }+ file_store_plan_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {+ switch v := v.(*PlanConfig_ChangeDatabaseConfig); i {+ case 0:+ return &v.state+ case 1:+ return &v.sizeCache+ case 2:+ return &v.unknownFields+ default:+ return nil+ }+ }+ file_store_plan_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {+ switch v := v.(*PlanConfig_RestoreDatabaseConfig); i {+ case 0:+ return &v.state+ case 1:+ return &v.sizeCache+ case 2:+ return &v.unknownFields+ default:+ return nil+ }+ }+ }+ file_store_plan_proto_msgTypes[2].OneofWrappers = []interface{}{+ (*PlanConfig_Spec_CreateDatabaseConfig)(nil),+ (*PlanConfig_Spec_ChangeDatabaseConfig)(nil),+ (*PlanConfig_Spec_RestoreDatabaseConfig)(nil),+ }+ file_store_plan_proto_msgTypes[5].OneofWrappers = []interface{}{+ (*PlanConfig_RestoreDatabaseConfig_Backup)(nil),+ (*PlanConfig_RestoreDatabaseConfig_PointInTime)(nil),+ }+ type x struct{}+ out := protoimpl.TypeBuilder{+ File: protoimpl.DescBuilder{+ GoPackagePath: reflect.TypeOf(x{}).PkgPath(),+ RawDescriptor: file_store_plan_proto_rawDesc,+ NumEnums: 1,+ NumMessages: 7,+ NumExtensions: 0,+ NumServices: 0,+ },+ GoTypes: file_store_plan_proto_goTypes,+ DependencyIndexes: file_store_plan_proto_depIdxs,+ EnumInfos: file_store_plan_proto_enumTypes,+ MessageInfos: file_store_plan_proto_msgTypes,+ }.Build()+ File_store_plan_proto = out.File+ file_store_plan_proto_rawDesc = nil+ file_store_plan_proto_goTypes = nil+ file_store_plan_proto_depIdxs = nil+}diff --git a/proto/store/plan.proto b/proto/store/plan.protonew file mode 100644index 0000000000..3454838cf3--- /dev/null+++ b/proto/store/plan.proto@@ -0,0 +1,103 @@+syntax = "proto3";++package bytebase.store;++import "google/protobuf/timestamp.proto";++option go_package = "generated-go/store";++message PlanConfig {+ repeated Step steps = 1;++ message Step {+ repeated Spec specs = 1;+ }+ message Spec {+ // earliest_allowed_time the earliest execution time of the change.+ google.protobuf.Timestamp earliest_allowed_time = 4;++ oneof config {+ CreateDatabaseConfig create_database_config = 1;+ ChangeDatabaseConfig change_database_config = 2;+ RestoreDatabaseConfig restore_database_config = 3;+ }+ }++ message CreateDatabaseConfig {+ // The resource name of the instance on which the database is created.+ // Format: instances/{instance}+ string target = 1;+ // The name of the database to create.+ string database = 2;+ // table is the name of the table, if it is not empty, Bytebase should create a table after creating the database.+ // For example, in MongoDB, it only creates the database when we first store data in that database.+ string table = 3;+ // character_set is the character set of the database.+ string character_set = 4;+ // collation is the collation of the database.+ string collation = 5;+ // cluster is the cluster of the database. This is only applicable to ClickHouse for "ON CLUSTER <<cluster>>".+ string cluster = 6;+ // owner is the owner of the database. This is only applicable to Postgres for "WITH OWNER <<owner>>".+ string owner = 7;+ // backup is the resource name of the backup.+ // FIXME: backup v1 API is not ready yet, write the format here when it's ready.+ string backup = 8;+ // labels of the database.+ map<string, string> labels = 9;+ }++ message ChangeDatabaseConfig {+ // The resource name of the target.+ // Format: projects/{project}/logicalDatabases/{ldb1}.+ // Format: projects/{project}/logicalDatabases/{ldb1}/logicalTables/{ltb1}.+ // Format: instances/{xxx}/databases/{db1}.+ string target = 1;+ // The resource name of the sheet.+ // Format: sheets/{sheet}+ string sheet = 2;+ // Type is the database change type.+ enum Type {+ TYPE_UNSPECIFIED = 0;+ // Used for establishing schema baseline, this is used when+ // 1. Onboard the database into Bytebase since Bytebase needs to know the current database schema.+ // 2. Had schema drift and need to re-establish the baseline.+ BASELINE = 1;+ // Used for DDL changes including CREATE DATABASE.+ MIGRATE = 2;+ // Used for schema changes via state-based schema migration including CREATE DATABASE.+ MIGRATE_SDL = 3;+ // Used for DDL changes using gh-ost.+ MIGRATE_GHOST = 4;+ // Used when restoring from a backup (the restored database branched from the original backup).+ BRANCH = 5;+ // Used for DML change.+ DATA = 6;+ }+ Type type = 3;+ // schema_version is parsed from VCS file name.+ // It is automatically generated in the UI workflow.+ string schema_version = 4;++ // If RollbackEnabled, build the RollbackSheetID of the task.+ bool rollback_enabled = 5;+ }++ message RestoreDatabaseConfig {+ // The resource name of the target to restore.+ // Format: instances/{instance}/databases/{database}+ string target = 1;+ // create_database_config is present if the user wants to restore to a new database.+ optional CreateDatabaseConfig create_database_config = 2;+ // source determines how to restore the database.+ // 1. from a backup+ // 2. from a point in time+ oneof source {+ // FIXME: format TBD+ // Restore from a backup.+ string backup = 3;+ // After the PITR operations, the database will be recovered to the state at this time.+ google.protobuf.Timestamp point_in_time = 4;+ }+ }+}