Skip to content

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

refactor: consolidate task and database change types (#17641)

Danny Xub8f3f537ccef
diff --git a/CLAUDE.md b/CLAUDE.md
index d2633b219c..b6b7882bad 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -1,98 +1,175 @@
-# CLAUDE.md
-
-This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
+This file provides guidance to AI coding assistants when working with code in this repository.
## Project Architecture
-- The database schema is defined in `./backend/migrator/migration/LATEST.sql`
-- The database migration files are in `./backend/migrator/<<version>>/`. `TestLatestVersion` in `./backend/migrator/migrator_test.go` needs update after new migration files are added. `./backend/migrator/migration/LATEST.sql` should be updated for DDL migrations.
-- Files in `./backend/store` are mappings to the database tables.
+
+- Database schema is defined in `./backend/migrator/migration/LATEST.sql`
+- Database migration files are in `./backend/migrator/<<version>>/`
+ - `TestLatestVersion` in `./backend/migrator/migrator_test.go` needs update after new migration files are added
+ - `./backend/migrator/migration/LATEST.sql` should be updated for DDL migrations
+- Files in `./backend/store` are mappings to the database tables
## Development Workflow
+
**ALWAYS follow these steps after making code changes:**
-### After Go Code Changes
-1. **Format**: Run `gofmt -w` on modified files
-2. **Lint**: Run `golangci-lint run --allow-parallel-runners` to catch issues
- - **Important**: Run golangci-lint repeatedly until there are no issues. The linter has a max-issues limit and may not show all issues in a single run.
-3. **Auto-fix**: Use `golangci-lint run --fix --allow-parallel-runners` to fix issues automatically
-4. **Test**: Run relevant tests before committing
-5. **Build**: `go build -ldflags "-w -s" -p=16 -o ./bytebase-build/bytebase ./backend/bin/server/main.go`
+### Go Code Changes
+
+1. **Format** — Run `gofmt -w` on modified files
+2. **Lint** — Run `golangci-lint run --allow-parallel-runners` to catch issues
+ - **Important**: Run golangci-lint repeatedly until there are no issues (the linter has a max-issues limit and may not show all issues in a single run)
+3. **Auto-fix** — Use `golangci-lint run --fix --allow-parallel-runners` to fix issues automatically
+4. **Test** — Run relevant tests before committing
+5. **Build** — `go build -ldflags "-w -s" -p=16 -o ./bytebase-build/bytebase ./backend/bin/server/main.go`
+
+### Frontend Code Changes
+
+1. **Lint** — Run `pnpm --dir frontend lint --fix`
+2. **Type check** — Run `pnpm --dir frontend type-check`
+3. **Test** — Run `pnpm --dir frontend test`
-### After Frontend Code Changes
-1. **Lint**: Run `pnpm --dir frontend lint --fix`
-2. **Type check**: Run `pnpm --dir frontend type-check`
-3. **Test**: Run `pnpm --dir frontend test`
+### Proto Changes
-### After Proto Changes
-1. **Format**: Run `buf format -w proto`
-2. **Lint**: Run `buf lint proto`
-3. **Generate**: Run `cd proto && buf generate`
+1. **Format** — Run `buf format -w proto`
+2. **Lint** — Run `buf lint proto`
+3. **Generate** — Run `cd proto && buf generate`
## Build/Test Commands
-- Backend: `go build -ldflags "-w -s" -p=16 -o ./bytebase-build/bytebase ./backend/bin/server/main.go`
-- Start backend: `PG_URL=postgresql://bbdev@localhost/bbdev go run ./backend/bin/server/main.go --port 8080 --data . --debug`
-- Run a single Go test: `go test -v -count=1 github.com/bytebase/bytebase/backend/path/to/tests -run ^TestFunctionName$`
-- Run two Go tests: `go test -v -count=1 github.com/bytebase/bytebase/backend/path/to/tests -run ^(TestFunctionName|TestFunctionNameTwo)$`
-- Frontend install: `pnpm --dir frontend i`
-- Frontend dev: `pnpm --dir frontend dev`
-- Frontend lint: `pnpm --dir frontend lint`
-- Frontend type check: `pnpm --dir frontend type-check`
-- Frontend test: `pnpm --dir frontend test`
-- Proto format: `buf format -w proto`
-- Proto lint: `buf lint proto`
-- Proto generate: `cd proto && buf generate`
-- Go lint: `golangci-lint run --allow-parallel-runners`
-- Connect to Postgres: `psql -U bbdev bbdev`
+
+### Backend
+
+```bash
+# Build
+go build -ldflags "-w -s" -p=16 -o ./bytebase-build/bytebase ./backend/bin/server/main.go
+
+# Start backend
+PG_URL=postgresql://bbdev@localhost/bbdev go run ./backend/bin/server/main.go --port 8080 --data . --debug
+
+# Run single test
+go test -v -count=1 github.com/bytebase/bytebase/backend/path/to/tests -run ^TestFunctionName$
+
+# Run multiple tests
+go test -v -count=1 github.com/bytebase/bytebase/backend/path/to/tests -run ^(TestFunctionName|TestFunctionNameTwo)$
+
+# Lint
+golangci-lint run --allow-parallel-runners
+```
+
+### Frontend
+
+```bash
+# Install dependencies
+pnpm --dir frontend i
+
+# Dev server
+pnpm --dir frontend dev
+
+# Lint
+pnpm --dir frontend lint
+
+# Type check
+pnpm --dir frontend type-check
+
+# Test
+pnpm --dir frontend test
+```
+
+### Proto
+
+```bash
+# Format
+buf format -w proto
+
+# Lint
+buf lint proto
+
+# Generate
+cd proto && buf generate
+```
+
+### Database
+
+```bash
+# Connect to Postgres
+psql -U bbdev bbdev
+```
## Code Style
-- **General**: Follow Google style guides for all languages
- - **Go**: https://google.github.io/styleguide/go/
- - **TypeScript**: https://google.github.io/styleguide/tsguide.html and https://google.github.io/styleguide/jsguide.html
-- **Conciseness**: Write clean, minimal code; fewer lines is better. Prioritize simplicity for effective and maintainable software.
-- **Comments**: Only include comments that are essential to understanding functionality or convey non-obvious information
-- **Go**: Use standard Go error handling with detailed error messages
-- **API and Proto**: Follow AIPs at https://google.aip.dev/general. When AIP and the proto guide conflict, AIP takes precedence. For example, use HELLO for enum names, not TYPE_HELLO.
-- **Frontend**: Follow TypeScript style with strict type checking
- - **i18n**: All user-facing display text in the UI must be defined and maintained in `./frontend/src/locales/en-US.json` using the i18n internationalization system. Do not hardcode any display strings directly in the source code.
-- **Naming**: Use American English, avoid plurals like "xxxList" for simplicity and to prevent singular/plural ambiguity stemming from poor design
-- **Git**: Follow conventional commit format
-- **Imports**: Use organized imports (sorted by the import path)
-- **Formatting**: Use linting/formatting tools before committing
-- **Error Handling**: Be explicit but concise about error cases
-- **Go Resources**: Always use `defer` for resource cleanup like `rows.Close()` (sqlclosecheck)
-- **Go Defer**: Avoid using `defer` inside loops (revive) - use IIFE or scope properly
+
+### General
+
+- Follow Google style guides for all languages
+ - [Go](https://google.github.io/styleguide/go/)
+ - [TypeScript](https://google.github.io/styleguide/tsguide.html) and [JavaScript](https://google.github.io/styleguide/jsguide.html)
+- Write clean, minimal code; fewer lines is better
+- Prioritize simplicity for effective and maintainable software
+- Only include comments that are essential to understanding functionality or convey non-obvious information
+
+### Go
+
+- Use standard Go error handling with detailed error messages
+- Always use `defer` for resource cleanup like `rows.Close()` (sqlclosecheck)
+- Avoid using `defer` inside loops (revive) — use IIFE or scope properly
+
+### API and Proto
+
+- Follow [AIPs](https://google.aip.dev/general)
+- When AIP and the proto guide conflict, AIP takes precedence
+- Use `HELLO` for enum names, not `TYPE_HELLO`
+
+### Frontend
+
+- Follow TypeScript style with strict type checking
+- **i18n**: All user-facing display text in the UI must be defined and maintained in `./frontend/src/locales/en-US.json` using the i18n internationalization system. Do not hardcode any display strings directly in the source code
+
+### Naming
+
+- Use American English
+- Avoid plurals like "xxxList" for simplicity and to prevent singular/plural ambiguity stemming from poor design
+
+### Git
+
+- Follow conventional commit format
+
+### Imports
+
+- Use organized imports (sorted by the import path)
+
+### Formatting
+
+- Use linting/formatting tools before committing
+
+### Error Handling
+
+- Be explicit but concise about error cases
## Pull Request Guidelines
-When creating pull requests:
-- **Code Review**: Follow [Google's Code Review Guideline](https://google.github.io/eng-practices/)
-- **Author Responsibility**: Authors are responsible for driving discussions, resolving comments, and promptly merging pull requests
-- **Breaking Changes**: Add the `breaking` label to PRs that contain breaking changes, including:
+
+- **Code Review** — Follow [Google's Code Review Guideline](https://google.github.io/eng-practices/)
+- **Author Responsibility** — Authors are responsible for driving discussions, resolving comments, and promptly merging pull requests
+- **Breaking Changes** — Add the `breaking` label to PRs that contain breaking changes, including:
- API breaking changes (removed/renamed endpoints, changed request/response formats)
- Database schema breaking changes that are not backward-compatible
- Proto message breaking changes (removed/renamed fields, changed field types)
- Configuration breaking changes (removed flags, changed behavior)
-- **Description**: Clearly describe what the PR changes and why
-- **Testing**: Include information about how the changes were tested
+- **Description** — Clearly describe what the PR changes and why
+- **Testing** — Include information about how the changes were tested
## Common Go Lint Rules
-Always follow these guidelines to avoid common linting errors:
-- **Unused Parameters**: Prefix unused parameters with underscore (e.g., `func foo(_ *Bar)`)
-- **Modern Go Conventions**: Use `any` instead of `interface{}` (since Go 1.18)
-- **Confusing Naming**: Avoid similar names that differ only by capitalization
-- **Identical Branches**: Don't use if-else branches that contain identical code
-- **Unused Functions**: Mark unused functions with `// nolint:unused` comment if needed for future use
-- **Function Receivers**: Don't create unnecessary function receivers; use regular functions if receiver is unused
-- **Proper Import Ordering**: Maintain correct grouping and ordering of imports
-- **Consistency**: Keep function signatures, naming, and patterns consistent with existing code
-- **Export Rules**: Only export (capitalize) functions and types that need to be used outside the package
-- **Linting Command**: Always run `golangci-lint run --allow-parallel-runners` without appending filenames to avoid "function not defined" errors (functions are defined in other files within the package)
-
-## Misc
+Always follow these guidelines to avoid common linting errors:
-- The database JSONB columns store JSON marshalled by protojson.Marshal in Go code. protojson.Marshal produces camelCased keys rather than the snake_case keys defined in the proto files. e.g. task_run becomes taskRun.
-- When modifying multiple files, run file modification tasks in parallel whenever possible, instead of processing them sequentially.
+- **Unused Parameters** — Prefix unused parameters with underscore (e.g., `func foo(_ *Bar)`)
+- **Modern Go Conventions** — Use `any` instead of `interface{}` (since Go 1.18)
+- **Confusing Naming** — Avoid similar names that differ only by capitalization
+- **Identical Branches** — Don't use if-else branches that contain identical code
+- **Unused Functions** — Mark unused functions with `// nolint:unused` comment if needed for future use
+- **Function Receivers** — Don't create unnecessary function receivers; use regular functions if receiver is unused
+- **Proper Import Ordering** — Maintain correct grouping and ordering of imports
+- **Consistency** — Keep function signatures, naming, and patterns consistent with existing code
+- **Export Rules** — Only export (capitalize) functions and types that need to be used outside the package
+- **Linting Command** — Always run `golangci-lint run --allow-parallel-runners` without appending filenames to avoid "function not defined" errors (functions are defined in other files within the package)
-## Individual Preferences
+## Miscellaneous
-- @~/.claude/bytebase-instructions.md
+- The database JSONB columns store JSON marshalled by `protojson.Marshal` in Go code. `protojson.Marshal` produces camelCased keys rather than the snake_case keys defined in the proto files. e.g. `task_run` becomes `taskRun`
+- When modifying multiple files, run file modification tasks in parallel whenever possible, instead of processing them sequentially
diff --git a/GEMINI.md b/GEMINI.md
index 9361f02674..b6b7882bad 100644
--- a/GEMINI.md
+++ b/GEMINI.md
@@ -1,84 +1,175 @@
-# GEMINI.md
-
-This file provides guidance to GEMINI when working with code in this repository.
+This file provides guidance to AI coding assistants when working with code in this repository.
## Project Architecture
-- The database schema is defined in `./backend/migrator/migration/LATEST.sql`
-- The database migration files are in `./backend/migrator/<<version>>/`. `TestLatestVersion` in `./backend/migrator/migrator_test.go` needs update after new migration files are added. `./backend/migrator/migration/LATEST.sql` should updated for DDL migrations.
-- Files in `./backend/store` are mappings to the database tables.
+
+- Database schema is defined in `./backend/migrator/migration/LATEST.sql`
+- Database migration files are in `./backend/migrator/<<version>>/`
+ - `TestLatestVersion` in `./backend/migrator/migrator_test.go` needs update after new migration files are added
+ - `./backend/migrator/migration/LATEST.sql` should be updated for DDL migrations
+- Files in `./backend/store` are mappings to the database tables
## Development Workflow
+
**ALWAYS follow these steps after making code changes:**
-### After Go Code Changes
-1. **Format**: Run `gofmt -w` on modified files
-2. **Lint**: Run `golangci-lint run --allow-parallel-runners` to catch issues
- - **Important**: Run golangci-lint repeatedly until there are no issues. The linter has a max-issues limit and may not show all issues in a single run.
-3. **Auto-fix**: Use `golangci-lint run --fix --allow-parallel-runners` to fix issues automatically
-4. **Test**: Run relevant tests before committing
-5. **Build**: `go build -ldflags "-w -s" -p=16 -o ./bytebase-build/bytebase ./backend/bin/server/main.go`
+### Go Code Changes
+
+1. **Format** — Run `gofmt -w` on modified files
+2. **Lint** — Run `golangci-lint run --allow-parallel-runners` to catch issues
+ - **Important**: Run golangci-lint repeatedly until there are no issues (the linter has a max-issues limit and may not show all issues in a single run)
+3. **Auto-fix** — Use `golangci-lint run --fix --allow-parallel-runners` to fix issues automatically
+4. **Test** — Run relevant tests before committing
+5. **Build** — `go build -ldflags "-w -s" -p=16 -o ./bytebase-build/bytebase ./backend/bin/server/main.go`
+
+### Frontend Code Changes
+
+1. **Lint** — Run `pnpm --dir frontend lint --fix`
+2. **Type check** — Run `pnpm --dir frontend type-check`
+3. **Test** — Run `pnpm --dir frontend test`
-### After Frontend Code Changes
-1. **Lint**: Run `pnpm --dir frontend lint --fix`
-2. **Type check**: Run `pnpm --dir frontend type-check`
-3. **Test**: Run `pnpm --dir frontend test`
+### Proto Changes
-### After Proto Changes
-1. **Format**: Run `buf format -w proto`
-2. **Lint**: Run `buf lint proto`
-3. **Generate**: Run `cd proto && buf generate`
+1. **Format** — Run `buf format -w proto`
+2. **Lint** — Run `buf lint proto`
+3. **Generate** — Run `cd proto && buf generate`
## Build/Test Commands
-- Backend: `go build -ldflags "-w -s" -p=16 -o ./bytebase-build/bytebase ./backend/bin/server/main.go`
-- Start backend: `PG_URL=postgresql://bbdev@localhost/bbdev go run ./backend/bin/server/main.go --port 8080 --data . --debug`
-- Run a single Go test: `go test -v -count=1 github.com/bytebase/bytebase/backend/path/to/tests -run ^TestFunctionName$`
-- Run two Go tests: `go test -v -count=1 github.com/bytebase/bytebase/backend/path/to/tests -run ^(TestFunctionName|TestFunctionNameTwo)$`
-- Frontend install: `pnpm --dir frontend i`
-- Frontend dev: `pnpm --dir frontend dev`
-- Frontend lint: `pnpm --dir frontend lint`
-- Frontend type check: `pnpm --dir frontend type-check`
-- Frontend test: `pnpm --dir frontend test`
-- Proto format: `buf format -w proto`
-- Proto lint: `buf lint proto`
-- Proto generate: `cd proto && buf generate`
-- Go lint: `golangci-lint run --allow-parallel-runners`
-- Connect to Postgres: `psql -U bbdev bbdev`
+
+### Backend
+
+```bash
+# Build
+go build -ldflags "-w -s" -p=16 -o ./bytebase-build/bytebase ./backend/bin/server/main.go
+
+# Start backend
+PG_URL=postgresql://bbdev@localhost/bbdev go run ./backend/bin/server/main.go --port 8080 --data . --debug
+
+# Run single test
+go test -v -count=1 github.com/bytebase/bytebase/backend/path/to/tests -run ^TestFunctionName$
+
+# Run multiple tests
+go test -v -count=1 github.com/bytebase/bytebase/backend/path/to/tests -run ^(TestFunctionName|TestFunctionNameTwo)$
+
+# Lint
+golangci-lint run --allow-parallel-runners
+```
+
+### Frontend
+
+```bash
+# Install dependencies
+pnpm --dir frontend i
+
+# Dev server
+pnpm --dir frontend dev
+
+# Lint
+pnpm --dir frontend lint
+
+# Type check
+pnpm --dir frontend type-check
+
+# Test
+pnpm --dir frontend test
+```
+
+### Proto
+
+```bash
+# Format
+buf format -w proto
+
+# Lint
+buf lint proto
+
+# Generate
+cd proto && buf generate
+```
+
+### Database
+
+```bash
+# Connect to Postgres
+psql -U bbdev bbdev
+```
## Code Style
-- **General**: Follow Google style guides for all languages
-- **Conciseness**: Write clean, minimal code; fewer lines is better
-- **Comments**: Only include comments that are essential to understanding functionality or convey non-obvious information
-- **Go**: Use standard Go error handling with detailed error messages
-- **API and Proto**: Follow AIPs in https://google.aip.dev/general
-- **Frontend**: Follow TypeScript style with strict type checking
- - **i18n**: All user-facing display text in the UI must be defined and maintained in `./frontend/src/locales/en-US.json` using the i18n internationalization system. Do not hardcode any display strings directly in the source code.
-- **Naming**: Use American English, avoid plurals like "xxxList"
-- **Git**: Follow conventional commit format
-- **Imports**: Use organized imports (sorted by the import path)
-- **Formatting**: Use linting/formatting tools before committing
-- **Error Handling**: Be explicit but concise about error cases
-- **Go Resources**: Always use `defer` for resource cleanup like `rows.Close()` (sqlclosecheck)
-- **Go Defer**: Avoid using `defer` inside loops (revive) - use IIFE or scope properly
-## Common Go Lint Rules
-Always follow these guidelines to avoid common linting errors:
+### General
+
+- Follow Google style guides for all languages
+ - [Go](https://google.github.io/styleguide/go/)
+ - [TypeScript](https://google.github.io/styleguide/tsguide.html) and [JavaScript](https://google.github.io/styleguide/jsguide.html)
+- Write clean, minimal code; fewer lines is better
+- Prioritize simplicity for effective and maintainable software
+- Only include comments that are essential to understanding functionality or convey non-obvious information
+
+### Go
+
+- Use standard Go error handling with detailed error messages
+- Always use `defer` for resource cleanup like `rows.Close()` (sqlclosecheck)
+- Avoid using `defer` inside loops (revive) — use IIFE or scope properly
+
+### API and Proto
+
+- Follow [AIPs](https://google.aip.dev/general)
+- When AIP and the proto guide conflict, AIP takes precedence
+- Use `HELLO` for enum names, not `TYPE_HELLO`
+
+### Frontend
+
+- Follow TypeScript style with strict type checking
+- **i18n**: All user-facing display text in the UI must be defined and maintained in `./frontend/src/locales/en-US.json` using the i18n internationalization system. Do not hardcode any display strings directly in the source code
+
+### Naming
+
+- Use American English
+- Avoid plurals like "xxxList" for simplicity and to prevent singular/plural ambiguity stemming from poor design
+
+### Git
-- **Unused Parameters**: Prefix unused parameters with underscore (e.g., `func foo(_ *Bar)`)
-- **Modern Go Conventions**: Use `any` instead of `interface{}` (since Go 1.18)
-- **Confusing Naming**: Avoid similar names that differ only by capitalization
-- **Identical Branches**: Don't use if-else branches that contain identical code
-- **Unused Functions**: Mark unused functions with `// nolint:unused` comment if needed for future use
-- **Function Receivers**: Don't create unnecessary function receivers; use regular functions if receiver is unused
-- **Proper Import Ordering**: Maintain correct grouping and ordering of imports
-- **Consistency**: Keep function signatures, naming, and patterns consistent with existing code
-- **Export Rules**: Only export (capitalize) functions and types that need to be used outside the package
-- **Linting Command**: Always run `golangci-lint run --allow-parallel-runners` without appending filenames to avoid "function not defined" errors (functions are defined in other files within the package)
+- Follow conventional commit format
-## Misc
+### Imports
+
+- Use organized imports (sorted by the import path)
+
+### Formatting
+
+- Use linting/formatting tools before committing
+
+### Error Handling
+
+- Be explicit but concise about error cases
+
+## Pull Request Guidelines
+
+- **Code Review** — Follow [Google's Code Review Guideline](https://google.github.io/eng-practices/)
+- **Author Responsibility** — Authors are responsible for driving discussions, resolving comments, and promptly merging pull requests
+- **Breaking Changes** — Add the `breaking` label to PRs that contain breaking changes, including:
+ - API breaking changes (removed/renamed endpoints, changed request/response formats)
+ - Database schema breaking changes that are not backward-compatible
+ - Proto message breaking changes (removed/renamed fields, changed field types)
+ - Configuration breaking changes (removed flags, changed behavior)
+- **Description** — Clearly describe what the PR changes and why
+- **Testing** — Include information about how the changes were tested
+
+## Common Go Lint Rules
+
+Always follow these guidelines to avoid common linting errors:
-- The database JSONB columns store JSON marshalled by protojson.Marshal in go code. protojson.Marshal produces camelCased key rather than the snake_case key defined in the proto files. e.g. task_run becomes taskRun.
-- When modifying multiple files, run file modification tasks in parallel whenever possible, instead of processing them sequentially.
+- **Unused Parameters** — Prefix unused parameters with underscore (e.g., `func foo(_ *Bar)`)
+- **Modern Go Conventions** — Use `any` instead of `interface{}` (since Go 1.18)
+- **Confusing Naming** — Avoid similar names that differ only by capitalization
+- **Identical Branches** — Don't use if-else branches that contain identical code
+- **Unused Functions** — Mark unused functions with `// nolint:unused` comment if needed for future use
+- **Function Receivers** — Don't create unnecessary function receivers; use regular functions if receiver is unused
+- **Proper Import Ordering** — Maintain correct grouping and ordering of imports
+- **Consistency** — Keep function signatures, naming, and patterns consistent with existing code
+- **Export Rules** — Only export (capitalize) functions and types that need to be used outside the package
+- **Linting Command** — Always run `golangci-lint run --allow-parallel-runners` without appending filenames to avoid "function not defined" errors (functions are defined in other files within the package)
-## Individual Preferences
+## Miscellaneous
-- @~/.gemini/bytebase-instructions.md
+- The database JSONB columns store JSON marshalled by `protojson.Marshal` in Go code. `protojson.Marshal` produces camelCased keys rather than the snake_case keys defined in the proto files. e.g. `task_run` becomes `taskRun`
+- When modifying multiple files, run file modification tasks in parallel whenever possible, instead of processing them sequentially
diff --git a/backend/api/v1/issue_service.go b/backend/api/v1/issue_service.go
index b06990bf82..6312dcf253 100644
--- a/backend/api/v1/issue_service.go
+++ b/backend/api/v1/issue_service.go
@@ -163,16 +163,17 @@ func (s *IssueService) getIssueFind(ctx context.Context, filter string, query st
switch taskType {
case "DDL":
issueFind.TaskTypes = &[]storepb.Task_Type{
- storepb.Task_DATABASE_SCHEMA_UPDATE,
- storepb.Task_DATABASE_SCHEMA_UPDATE_GHOST,
+ storepb.Task_DATABASE_MIGRATE,
+ }
+ issueFind.MigrateTypes = &[]storepb.Task_MigrateType{
+ storepb.Task_DDL,
}
case "DML":
issueFind.TaskTypes = &[]storepb.Task_Type{
- storepb.Task_DATABASE_DATA_UPDATE,
+ storepb.Task_DATABASE_MIGRATE,
}
- case "DATA_EXPORT":
- issueFind.TaskTypes = &[]storepb.Task_Type{
- storepb.Task_DATABASE_EXPORT,
+ issueFind.MigrateTypes = &[]storepb.Task_MigrateType{
+ storepb.Task_DML,
}
default:
return "", connect.NewError(connect.CodeInvalidArgument, errors.Errorf(`unknown value %q`, value))
diff --git a/backend/api/v1/plan_service.go b/backend/api/v1/plan_service.go
index 9eb78e64f4..62ae242aa1 100644
--- a/backend/api/v1/plan_service.go
+++ b/backend/api/v1/plan_service.go
@@ -518,26 +518,45 @@ func (s *PlanService) UpdatePlan(ctx context.Context, request *connect.Request[v
if err != nil {
return nil, connect.NewError(connect.CodeInternal, errors.Errorf("failed to get task type from spec, err: %v", err))
}
- if newTaskType != task.Type {
- taskTypes := []storepb.Task_Type{
- storepb.Task_DATABASE_SCHEMA_UPDATE,
- storepb.Task_DATABASE_SCHEMA_UPDATE_GHOST,
- storepb.Task_DATABASE_DATA_UPDATE,
+
+ // Check if migrate_type changed for DATABASE_MIGRATE tasks
+ if newTaskType == storepb.Task_DATABASE_MIGRATE && task.Type == storepb.Task_DATABASE_MIGRATE {
+ // Get MigrationType from spec
+ if config, ok := spec.Config.(*v1pb.Plan_Spec_ChangeDatabaseConfig); ok {
+ newMigrateType := getMigrateTypeFromMigrationType(config.ChangeDatabaseConfig.MigrationType)
+ if newMigrateType != task.Payload.GetMigrateType() {
+ taskPatch.MigrateType = &newMigrateType
+ doUpdate = true
+ }
}
- if !slices.Contains(taskTypes, newTaskType) || !slices.Contains(taskTypes, task.Type) {
- return nil, connect.NewError(connect.CodeInvalidArgument, errors.Errorf("task types in %v are allowed to updated, and they are allowed to be changed to %v", taskTypes, taskTypes))
+ } else if newTaskType != task.Type {
+ // Task type changed - only allow within DATABASE_MIGRATE types or to/from DATABASE_SDL
+ if (newTaskType == storepb.Task_DATABASE_MIGRATE && task.Type == storepb.Task_DATABASE_SDL) ||
+ (newTaskType == storepb.Task_DATABASE_SDL && task.Type == storepb.Task_DATABASE_MIGRATE) {
+ // Allow DATABASE_MIGRATE <-> DATABASE_SDL conversion
+ if newTaskType == storepb.Task_DATABASE_MIGRATE {
+ if config, ok := spec.Config.(*v1pb.Plan_Spec_ChangeDatabaseConfig); ok {
+ newMigrateType := getMigrateTypeFromMigrationType(config.ChangeDatabaseConfig.MigrationType)
+ taskPatch.MigrateType = &newMigrateType
+ doUpdate = true
+ }
+ }
+ } else {
+ return nil, connect.NewError(connect.CodeInvalidArgument, errors.Errorf("cannot change task type from %v to %v", task.Type, newTaskType))
}
- taskPatch.Type = &newTaskType
- doUpdate = true
}
// Flags for gh-ost.
if err := func() error {
- if newTaskType != storepb.Task_DATABASE_SCHEMA_UPDATE_GHOST {
+ config, ok := spec.Config.(*v1pb.Plan_Spec_ChangeDatabaseConfig)
+ if !ok {
+ return nil
+ }
+ if config.ChangeDatabaseConfig.Type != v1pb.DatabaseChangeType_MIGRATE || config.ChangeDatabaseConfig.MigrationType != v1pb.MigrationType_GHOST {
return nil
}
- newFlags := spec.GetChangeDatabaseConfig().GetGhostFlags()
+ newFlags := config.ChangeDatabaseConfig.GetGhostFlags()
if _, err := ghost.GetUserFlags(newFlags); err != nil {
return connect.NewError(connect.CodeInvalidArgument, errors.Errorf("invalid ghost flags %q, error %v", newFlags, err))
}
@@ -554,13 +573,13 @@ func (s *PlanService) UpdatePlan(ctx context.Context, request *connect.Request[v
// Prior Backup
func() {
- if newTaskType != storepb.Task_DATABASE_DATA_UPDATE {
- return
- }
config, ok := spec.Config.(*v1pb.Plan_Spec_ChangeDatabaseConfig)
if !ok {
return
}
+ if config.ChangeDatabaseConfig.Type != v1pb.DatabaseChangeType_MIGRATE || config.ChangeDatabaseConfig.MigrationType != v1pb.MigrationType_DML {
+ return
+ }
// Check if backup setting has changed.
planEnableBackup := config.ChangeDatabaseConfig.GetEnablePriorBackup()
@@ -574,7 +593,7 @@ func (s *PlanService) UpdatePlan(ctx context.Context, request *connect.Request[v
// Sheet
if err := func() error {
switch newTaskType {
- case storepb.Task_DATABASE_SCHEMA_UPDATE, storepb.Task_DATABASE_SCHEMA_UPDATE_GHOST, storepb.Task_DATABASE_DATA_UPDATE, storepb.Task_DATABASE_EXPORT:
+ case storepb.Task_DATABASE_MIGRATE, storepb.Task_DATABASE_SDL, storepb.Task_DATABASE_EXPORT:
var oldSheetName string
if newTaskType == storepb.Task_DATABASE_EXPORT {
config, ok := spec.Config.(*v1pb.Plan_Spec_ExportDataConfig)
@@ -1423,14 +1442,10 @@ func getTaskTypeFromSpec(spec *v1pb.Plan_Spec) (storepb.Task_Type, error) {
return storepb.Task_DATABASE_CREATE, nil
case *v1pb.Plan_Spec_ChangeDatabaseConfig:
switch s.ChangeDatabaseConfig.Type {
- case v1pb.DatabaseChangeType_DATA:
- return storepb.Task_DATABASE_DATA_UPDATE, nil
case v1pb.DatabaseChangeType_MIGRATE:
- return storepb.Task_DATABASE_SCHEMA_UPDATE, nil
- case v1pb.DatabaseChangeType_MIGRATE_GHOST:
- return storepb.Task_DATABASE_SCHEMA_UPDATE_GHOST, nil
- case v1pb.DatabaseChangeType_MIGRATE_SDL:
- return storepb.Task_DATABASE_SCHEMA_UPDATE_SDL, nil
+ return storepb.Task_DATABASE_MIGRATE, nil
+ case v1pb.DatabaseChangeType_SDL:
+ return storepb.Task_DATABASE_SDL, nil
case v1pb.DatabaseChangeType_DATABASE_CHANGE_TYPE_UNSPECIFIED:
return storepb.Task_TASK_TYPE_UNSPECIFIED, errors.Errorf("unexpected unspecified change database config type")
default:
diff --git a/backend/api/v1/plan_service_plan_check.go b/backend/api/v1/plan_service_plan_check.go
index 4e25beaffb..d9a60be5e8 100644
--- a/backend/api/v1/plan_service_plan_check.go
+++ b/backend/api/v1/plan_service_plan_check.go
@@ -88,7 +88,13 @@ func getPlanCheckRunsFromSpec(ctx context.Context, s *store.Store, plan *store.P
func getPlanCheckRunsFromChangeDatabaseConfigDatabaseGroupTarget(ctx context.Context, s *store.Store, plan *store.PlanMessage, config *storepb.PlanConfig_ChangeDatabaseConfig) ([]*store.PlanCheckRunMessage, error) {
switch config.Type {
case storepb.PlanConfig_ChangeDatabaseConfig_MIGRATE:
- case storepb.PlanConfig_ChangeDatabaseConfig_DATA:
+ // Only DDL and DML migrate types are supported for database group targets
+ switch config.MigrateType {
+ case storepb.PlanConfig_ChangeDatabaseConfig_DDL:
+ case storepb.PlanConfig_ChangeDatabaseConfig_DML:
+ default:
+ return nil, errors.Errorf("unsupported migrate type %q for database group target", config.MigrateType)
+ }
default:
return nil, errors.Errorf("unsupported change database config type %q for database group target", config.Type)
}
@@ -185,7 +191,7 @@ func getPlanCheckRunsFromChangeDatabaseConfigForDatabase(ctx context.Context, s
Type: store.PlanCheckDatabaseConnect,
Config: &storepb.PlanCheckRunConfig{
SheetUid: int32(sheetUID),
- ChangeDatabaseType: convertToChangeDatabaseType(config.Type),
+ ChangeDatabaseType: convertToChangeDatabaseType(config.Type, config.MigrateType),
InstanceId: instance.ResourceID,
DatabaseName: database.DatabaseName,
},
@@ -197,7 +203,7 @@ func getPlanCheckRunsFromChangeDatabaseConfigForDatabase(ctx context.Context, s
Type: store.PlanCheckDatabaseStatementAdvise,
Config: &storepb.PlanCheckRunConfig{
SheetUid: int32(sheetUID),
- ChangeDatabaseType: convertToChangeDatabaseType(config.Type),
+ ChangeDatabaseType: convertToChangeDatabaseType(config.Type, config.MigrateType),
InstanceId: instance.ResourceID,
DatabaseName: database.DatabaseName,
EnablePriorBackup: config.EnablePriorBackup,
@@ -209,19 +215,19 @@ func getPlanCheckRunsFromChangeDatabaseConfigForDatabase(ctx context.Context, s
Type: store.PlanCheckDatabaseStatementSummaryReport,
Config: &storepb.PlanCheckRunConfig{
SheetUid: int32(sheetUID),
- ChangeDatabaseType: convertToChangeDatabaseType(config.Type),
+ ChangeDatabaseType: convertToChangeDatabaseType(config.Type, config.MigrateType),
InstanceId: instance.ResourceID,
DatabaseName: database.DatabaseName,
},
})
- if config.Type == storepb.PlanConfig_ChangeDatabaseConfig_MIGRATE_GHOST {
+ if config.Type == storepb.PlanConfig_ChangeDatabaseConfig_MIGRATE && config.MigrateType == storepb.PlanConfig_ChangeDatabaseConfig_GHOST {
planCheckRuns = append(planCheckRuns, &store.PlanCheckRunMessage{
PlanUID: plan.UID,
Status: store.PlanCheckRunStatusRunning,
Type: store.PlanCheckDatabaseGhostSync,
Config: &storepb.PlanCheckRunConfig{
SheetUid: int32(sheetUID),
- ChangeDatabaseType: convertToChangeDatabaseType(config.Type),
+ ChangeDatabaseType: convertToChangeDatabaseType(config.Type, config.MigrateType),
InstanceId: instance.ResourceID,
DatabaseName: database.DatabaseName,
GhostFlags: config.GhostFlags,
@@ -232,19 +238,24 @@ func getPlanCheckRunsFromChangeDatabaseConfigForDatabase(ctx context.Context, s
return planCheckRuns, nil
}
-func convertToChangeDatabaseType(t storepb.PlanConfig_ChangeDatabaseConfig_Type) storepb.PlanCheckRunConfig_ChangeDatabaseType {
+func convertToChangeDatabaseType(t storepb.PlanConfig_ChangeDatabaseConfig_Type, migrateType storepb.PlanConfig_ChangeDatabaseConfig_MigrateType) storepb.PlanCheckRunConfig_ChangeDatabaseType {
switch t {
case storepb.PlanConfig_ChangeDatabaseConfig_MIGRATE:
- return storepb.PlanCheckRunConfig_DDL
- case storepb.PlanConfig_ChangeDatabaseConfig_MIGRATE_GHOST:
- return storepb.PlanCheckRunConfig_DDL_GHOST
- case storepb.PlanConfig_ChangeDatabaseConfig_MIGRATE_SDL:
+ switch migrateType {
+ case storepb.PlanConfig_ChangeDatabaseConfig_DDL:
+ return storepb.PlanCheckRunConfig_DDL
+ case storepb.PlanConfig_ChangeDatabaseConfig_GHOST:
+ return storepb.PlanCheckRunConfig_DDL_GHOST
+ case storepb.PlanConfig_ChangeDatabaseConfig_DML:
+ return storepb.PlanCheckRunConfig_DML
+ default:
+ return storepb.PlanCheckRunConfig_CHANGE_DATABASE_TYPE_UNSPECIFIED
+ }
+ case storepb.PlanConfig_ChangeDatabaseConfig_SDL:
return storepb.PlanCheckRunConfig_SDL
- case storepb.PlanConfig_ChangeDatabaseConfig_DATA:
- return storepb.PlanCheckRunConfig_DML
default:
+ return storepb.PlanCheckRunConfig_CHANGE_DATABASE_TYPE_UNSPECIFIED
}
- return storepb.PlanCheckRunConfig_CHANGE_DATABASE_TYPE_UNSPECIFIED
}
func getSheetUIDsFromChangeDatabaseConfig(config *storepb.PlanConfig_ChangeDatabaseConfig) ([]int, error) {
diff --git a/backend/api/v1/rollout_service_converter.go b/backend/api/v1/rollout_service_converter.go
index 24449de73d..06a59af2a2 100644
--- a/backend/api/v1/rollout_service_converter.go
+++ b/backend/api/v1/rollout_service_converter.go
@@ -141,6 +141,7 @@ func convertToPlanSpecChangeDatabaseConfig(config *storepb.PlanConfig_Spec_Chang
Sheet: c.Sheet,
Release: c.Release,
Type: convertToPlanSpecChangeDatabaseConfigType(c.Type),
+ MigrationType: convertToPlanSpecMigrationType(c.MigrateType),
GhostFlags: c.GhostFlags,
EnablePriorBackup: c.EnablePriorBackup,
},
@@ -153,17 +154,26 @@ func convertToPlanSpecChangeDatabaseConfigType(t storepb.PlanConfig_ChangeDataba
return v1pb.DatabaseChangeType_DATABASE_CHANGE_TYPE_UNSPECIFIED
case storepb.PlanConfig_ChangeDatabaseConfig_MIGRATE:
return v1pb.DatabaseChangeType_MIGRATE
- case storepb.PlanConfig_ChangeDatabaseConfig_MIGRATE_SDL:
- return v1pb.DatabaseChangeType_MIGRATE_SDL
- case storepb.PlanConfig_ChangeDatabaseConfig_MIGRATE_GHOST:
- return v1pb.DatabaseChangeType_MIGRATE_GHOST
- case storepb.PlanConfig_ChangeDatabaseConfig_DATA:
- return v1pb.DatabaseChangeType_DATA
+ case storepb.PlanConfig_ChangeDatabaseConfig_SDL:
+ return v1pb.DatabaseChangeType_SDL
default:
return v1pb.DatabaseChangeType_DATABASE_CHANGE_TYPE_UNSPECIFIED
}
}
+func convertToPlanSpecMigrationType(t storepb.PlanConfig_ChangeDatabaseConfig_MigrateType) v1pb.MigrationType {
+ switch t {
+ case storepb.PlanConfig_ChangeDatabaseConfig_DDL:
+ return v1pb.MigrationType_DDL
+ case storepb.PlanConfig_ChangeDatabaseConfig_GHOST:
+ return v1pb.MigrationType_GHOST
+ case storepb.PlanConfig_ChangeDatabaseConfig_DML:
+ return v1pb.MigrationType_DML
+ default:
+ return v1pb.MigrationType_MIGRATION_TYPE_UNSPECIFIED
+ }
+}
+
func convertToPlanSpecExportDataConfig(config *storepb.PlanConfig_Spec_ExportDataConfig) *v1pb.Plan_Spec_ExportDataConfig {
c := config.ExportDataConfig
return &v1pb.Plan_Spec_ExportDataConfig{
@@ -263,12 +273,38 @@ func convertPlanConfigCreateDatabaseConfig(c *v1pb.Plan_CreateDatabaseConfig) *s
func convertPlanSpecChangeDatabaseConfig(config *v1pb.Plan_Spec_ChangeDatabaseConfig) *storepb.PlanConfig_Spec_ChangeDatabaseConfig {
c := config.ChangeDatabaseConfig
+
+ // Convert v1 DatabaseChangeType to store Type
+ var storeType storepb.PlanConfig_ChangeDatabaseConfig_Type
+ switch c.Type {
+ case v1pb.DatabaseChangeType_MIGRATE:
+ storeType = storepb.PlanConfig_ChangeDatabaseConfig_MIGRATE
+ case v1pb.DatabaseChangeType_SDL:
+ storeType = storepb.PlanConfig_ChangeDatabaseConfig_SDL
+ default:
+ storeType = storepb.PlanConfig_ChangeDatabaseConfig_TYPE_UNSPECIFIED
+ }
+
+ // Convert v1 MigrationType to store MigrateType
+ var storeMigrateType storepb.PlanConfig_ChangeDatabaseConfig_MigrateType
+ switch c.MigrationType {
+ case v1pb.MigrationType_DDL:
+ storeMigrateType = storepb.PlanConfig_ChangeDatabaseConfig_DDL
+ case v1pb.MigrationType_DML:
+ storeMigrateType = storepb.PlanConfig_ChangeDatabaseConfig_DML
+ case v1pb.MigrationType_GHOST:
+ storeMigrateType = storepb.PlanConfig_ChangeDatabaseConfig_GHOST
+ default:
+ storeMigrateType = storepb.PlanConfig_ChangeDatabaseConfig_MIGRATE_TYPE_UNSPECIFIED
+ }
+
return &storepb.PlanConfig_Spec_ChangeDatabaseConfig{
ChangeDatabaseConfig: &storepb.PlanConfig_ChangeDatabaseConfig{
Targets: c.Targets,
Sheet: c.Sheet,
Release: c.Release,
- Type: storepb.PlanConfig_ChangeDatabaseConfig_Type(c.Type),
+ Type: storeType,
+ MigrateType: storeMigrateType,
GhostFlags: c.GhostFlags,
EnablePriorBackup: c.EnablePriorBackup,
},
@@ -692,10 +728,18 @@ func convertToTask(ctx context.Context, s *store.Store, project *store.ProjectMe
switch task.Type {
case storepb.Task_DATABASE_CREATE:
return convertToTaskFromDatabaseCreate(ctx, s, project, task)
- case storepb.Task_DATABASE_SCHEMA_UPDATE, storepb.Task_DATABASE_SCHEMA_UPDATE_GHOST, storepb.Task_DATABASE_SCHEMA_UPDATE_SDL:
+ case storepb.Task_DATABASE_MIGRATE:
+ // Handle DATABASE_MIGRATE based on migrate_type
+ switch task.Payload.GetMigrateType() {
+ case storepb.Task_DDL, storepb.Task_GHOST:
+ return convertToTaskFromSchemaUpdate(ctx, s, project, task)
+ case storepb.Task_DML:
+ return convertToTaskFromDataUpdate(ctx, s, project, task)
+ default:
+ return nil, errors.Errorf("unsupported migrate type %v", task.Payload.GetMigrateType())
+ }
+ case storepb.Task_DATABASE_SDL:
return convertToTaskFromSchemaUpdate(ctx, s, project, task)
- case storepb.Task_DATABASE_DATA_UPDATE:
- return convertToTaskFromDataUpdate(ctx, s, project, task)
case storepb.Task_DATABASE_EXPORT:
return convertToTaskFromDatabaseDataExport(ctx, s, project, task)
case storepb.Task_TASK_TYPE_UNSPECIFIED:
@@ -716,7 +760,7 @@ func convertToTaskFromDatabaseCreate(ctx context.Context, s *store.Store, projec
v1pbTask := &v1pb.Task{
Name: common.FormatTask(project.ResourceID, task.PipelineID, stageID, task.ID),
SpecId: task.Payload.GetSpecId(),
- Type: convertToTaskType(task.Type),
+ Type: convertToTaskType(task),
Status: convertToTaskStatus(task.LatestTaskRunStatus, task.Payload.GetSkipped()),
SkippedReason: task.Payload.GetSkippedReason(),
Target: common.FormatInstance(instance.ResourceID),
@@ -753,18 +797,40 @@ func convertToTaskFromSchemaUpdate(ctx context.Context, s *store.Store, project
return nil, errors.Errorf("database not found")
}
+ // Determine DatabaseChangeType and MigrationType based on task type
+ var databaseChangeType v1pb.DatabaseChangeType
+ var migrationType v1pb.MigrationType
+ switch task.Type {
+ case storepb.Task_DATABASE_MIGRATE:
+ databaseChangeType = v1pb.DatabaseChangeType_MIGRATE
+ switch task.Payload.GetMigrateType() {
+ case storepb.Task_DDL:
+ migrationType = v1pb.MigrationType_DDL
+ case storepb.Task_GHOST:
+ migrationType = v1pb.MigrationType_GHOST
+ default:
+ migrationType = v1pb.MigrationType_DDL
+ }
+ case storepb.Task_DATABASE_SDL:
+ databaseChangeType = v1pb.DatabaseChangeType_SDL
+ default:
+ databaseChangeType = v1pb.DatabaseChangeType_DATABASE_CHANGE_TYPE_UNSPECIFIED
+ }
+
stageID := formatStageIDFromEnvironment(task.Environment)
v1pbTask := &v1pb.Task{
Name: common.FormatTask(project.ResourceID, task.PipelineID, stageID, task.ID),
SpecId: task.Payload.GetSpecId(),
- Type: convertToTaskType(task.Type),
+ Type: convertToTaskType(task),
Status: convertToTaskStatus(task.LatestTaskRunStatus, task.Payload.GetSkipped()),
SkippedReason: task.Payload.GetSkippedReason(),
Target: fmt.Sprintf("%s%s/%s%s", common.InstanceNamePrefix, database.InstanceID, common.DatabaseIDPrefix, database.DatabaseName),
Payload: &v1pb.Task_DatabaseUpdate_{
DatabaseUpdate: &v1pb.Task_DatabaseUpdate{
- Sheet: common.FormatSheet(project.ResourceID, int(task.Payload.GetSheetId())),
- SchemaVersion: task.Payload.GetSchemaVersion(),
+ Sheet: common.FormatSheet(project.ResourceID, int(task.Payload.GetSheetId())),
+ SchemaVersion: task.Payload.GetSchemaVersion(),
+ DatabaseChangeType: databaseChangeType,
+ MigrationType: migrationType,
},
},
}
@@ -793,7 +859,7 @@ func convertToTaskFromDataUpdate(ctx context.Context, s *store.Store, project *s
v1pbTask := &v1pb.Task{
Name: common.FormatTask(project.ResourceID, task.PipelineID, stageID, task.ID),
SpecId: task.Payload.GetSpecId(),
- Type: convertToTaskType(task.Type),
+ Type: convertToTaskType(task),
Status: convertToTaskStatus(task.LatestTaskRunStatus, task.Payload.GetSkipped()),
SkippedReason: task.Payload.GetSkippedReason(),
Target: fmt.Sprintf("%s%s/%s%s", common.InstanceNamePrefix, database.InstanceID, common.DatabaseIDPrefix, database.DatabaseName),
@@ -801,8 +867,10 @@ func convertToTaskFromDataUpdate(ctx context.Context, s *store.Store, project *s
}
v1pbTaskPayload := &v1pb.Task_DatabaseUpdate_{
DatabaseUpdate: &v1pb.Task_DatabaseUpdate{
- Sheet: common.FormatSheet(project.ResourceID, int(task.Payload.GetSheetId())),
- SchemaVersion: task.Payload.GetSchemaVersion(),
+ Sheet: common.FormatSheet(project.ResourceID, int(task.Payload.GetSheetId())),
+ SchemaVersion: task.Payload.GetSchemaVersion(),
+ DatabaseChangeType: v1pb.DatabaseChangeType_MIGRATE,
+ MigrationType: v1pb.MigrationType_DML,
},
}
@@ -841,7 +909,7 @@ func convertToTaskFromDatabaseDataExport(ctx context.Context, s *store.Store, pr
v1pbTask := &v1pb.Task{
Name: common.FormatTask(project.ResourceID, task.PipelineID, stageID, task.ID),
SpecId: task.Payload.GetSpecId(),
- Type: convertToTaskType(task.Type),
+ Type: convertToTaskType(task),
Status: convertToTaskStatus(task.LatestTaskRunStatus, false),
Target: targetDatabaseName,
Payload: &v1pbTaskPayload,
@@ -877,19 +945,15 @@ func convertToTaskStatus(latestTaskRunStatus storepb.TaskRun_Status, skipped boo
}
}
-func convertToTaskType(taskType storepb.Task_Type) v1pb.Task_Type {
+func convertToTaskType(task *store.TaskMessage) v1pb.Task_Type {
//exhaustive:enforce
- switch taskType {
+ switch task.Type {
case storepb.Task_DATABASE_CREATE:
return v1pb.Task_DATABASE_CREATE
- case storepb.Task_DATABASE_SCHEMA_UPDATE:
- return v1pb.Task_DATABASE_SCHEMA_UPDATE
- case storepb.Task_DATABASE_SCHEMA_UPDATE_GHOST:
- return v1pb.Task_DATABASE_SCHEMA_UPDATE_GHOST
- case storepb.Task_DATABASE_SCHEMA_UPDATE_SDL:
- return v1pb.Task_DATABASE_SCHEMA_UPDATE_SDL
- case storepb.Task_DATABASE_DATA_UPDATE:
- return v1pb.Task_DATABASE_DATA_UPDATE
+ case storepb.Task_DATABASE_MIGRATE:
+ return v1pb.Task_DATABASE_MIGRATE
+ case storepb.Task_DATABASE_SDL:
+ return v1pb.Task_DATABASE_SDL
case storepb.Task_DATABASE_EXPORT:
return v1pb.Task_DATABASE_EXPORT
case storepb.Task_TASK_TYPE_UNSPECIFIED:
@@ -904,14 +968,10 @@ func convertToStoreTaskType(taskType v1pb.Task_Type) storepb.Task_Type {
switch taskType {
case v1pb.Task_DATABASE_CREATE:
return storepb.Task_DATABASE_CREATE
- case v1pb.Task_DATABASE_SCHEMA_UPDATE:
- return storepb.Task_DATABASE_SCHEMA_UPDATE
- case v1pb.Task_DATABASE_SCHEMA_UPDATE_GHOST:
- return storepb.Task_DATABASE_SCHEMA_UPDATE_GHOST
- case v1pb.Task_DATABASE_SCHEMA_UPDATE_SDL:
- return storepb.Task_DATABASE_SCHEMA_UPDATE_SDL
- case v1pb.Task_DATABASE_DATA_UPDATE:
- return storepb.Task_DATABASE_DATA_UPDATE
+ case v1pb.Task_DATABASE_MIGRATE:
+ return storepb.Task_DATABASE_MIGRATE
+ case v1pb.Task_DATABASE_SDL:
+ return storepb.Task_DATABASE_SDL
case v1pb.Task_DATABASE_EXPORT:
return storepb.Task_DATABASE_EXPORT
case v1pb.Task_TYPE_UNSPECIFIED, v1pb.Task_GENERAL:
@@ -921,6 +981,20 @@ func convertToStoreTaskType(taskType v1pb.Task_Type) storepb.Task_Type {
}
}
+// getMigrateTypeFromMigrationType converts v1pb.MigrationType to storepb.Task_MigrateType
+func getMigrateTypeFromMigrationType(migrationType v1pb.MigrationType) storepb.Task_MigrateType {
+ switch migrationType {
+ case v1pb.MigrationType_DDL:
+ return storepb.Task_DDL
+ case v1pb.MigrationType_GHOST:
+ return storepb.Task_GHOST
+ case v1pb.MigrationType_DML:
+ return storepb.Task_DML
+ default:
+ return storepb.Task_MIGRATE_TYPE_UNSPECIFIED
+ }
+}
+
func convertToTaskRunLog(parent string, logs []*store.TaskRunLog) *v1pb.TaskRunLog {
return &v1pb.TaskRunLog{
Name: fmt.Sprintf("%s/log", parent),
diff --git a/backend/api/v1/rollout_service_task.go b/backend/api/v1/rollout_service_task.go
index 02667d007e..25c02ad7ae 100644
--- a/backend/api/v1/rollout_service_task.go
+++ b/backend/api/v1/rollout_service_task.go
@@ -300,26 +300,45 @@ func getTaskCreatesFromChangeDatabaseConfigDatabaseTarget(
if database.EffectiveEnvironmentID != nil {
env = *database.EffectiveEnvironmentID
}
+
+ // Determine task migrate type from plan config migrate type
+ var taskMigrateType storepb.Task_MigrateType
+ var flags map[string]string
+ switch c.MigrateType {
+ case storepb.PlanConfig_ChangeDatabaseConfig_DDL:
+ taskMigrateType = storepb.Task_DDL
+ case storepb.PlanConfig_ChangeDatabaseConfig_DML:
+ taskMigrateType = storepb.Task_DML
+ case storepb.PlanConfig_ChangeDatabaseConfig_GHOST:
+ taskMigrateType = storepb.Task_GHOST
+ if _, err := ghost.GetUserFlags(c.GhostFlags); err != nil {
+ return nil, errors.Wrapf(err, "invalid ghost flags %q", c.GhostFlags)
+ }
+ flags = c.GhostFlags
+ default:
+ taskMigrateType = storepb.Task_DDL
+ }
+
taskCreate := &store.TaskMessage{
InstanceID: database.InstanceID,
DatabaseName: &database.DatabaseName,
Environment: env,
- Type: storepb.Task_DATABASE_SCHEMA_UPDATE,
+ Type: storepb.Task_DATABASE_MIGRATE,
Payload: &storepb.Task{
- SpecId: spec.Id,
- SheetId: int32(sheetUID),
+ SpecId: spec.Id,
+ SheetId: int32(sheetUID),
+ Flags: flags,
+ EnablePriorBackup: c.EnablePriorBackup,
+ MigrateType: taskMigrateType,
},
}
return []*store.TaskMessage{taskCreate}, nil
- case storepb.PlanConfig_ChangeDatabaseConfig_MIGRATE_GHOST:
+ case storepb.PlanConfig_ChangeDatabaseConfig_SDL:
_, sheetUID, err := common.GetProjectResourceIDSheetUID(c.Sheet)
if err != nil {
return nil, errors.Wrapf(err, "failed to get sheet id from sheet %q", c.Sheet)
}
- if _, err := ghost.GetUserFlags(c.GhostFlags); err != nil {
- return nil, errors.Wrapf(err, "invalid ghost flags %q", c.GhostFlags)
- }
env := ""
if database.EffectiveEnvironmentID != nil {
env = *database.EffectiveEnvironmentID
@@ -328,36 +347,14 @@ func getTaskCreatesFromChangeDatabaseConfigDatabaseTarget(
InstanceID: database.InstanceID,
DatabaseName: &database.DatabaseName,
Environment: env,
- Type: storepb.Task_DATABASE_SCHEMA_UPDATE_GHOST,
+ Type: storepb.Task_DATABASE_SDL,
Payload: &storepb.Task{
SpecId: spec.Id,
SheetId: int32(sheetUID),
- Flags: c.GhostFlags,
},
}
return []*store.TaskMessage{taskCreate}, nil
- case storepb.PlanConfig_ChangeDatabaseConfig_DATA:
- _, sheetUID, err := common.GetProjectResourceIDSheetUID(c.Sheet)
- if err != nil {
- return nil, errors.Wrapf(err, "failed to get sheet id from sheet %q", c.Sheet)
- }
- env := ""
- if database.EffectiveEnvironmentID != nil {
- env = *database.EffectiveEnvironmentID
- }
- taskCreate := &store.TaskMessage{
- InstanceID: database.InstanceID,
- DatabaseName: &database.DatabaseName,
- Environment: env,
- Type: storepb.Task_DATABASE_DATA_UPDATE,
- Payload: &storepb.Task{
- SpecId: spec.Id,
- SheetId: int32(sheetUID),
- EnablePriorBackup: c.EnablePriorBackup,
- },
- }
- return []*store.TaskMessage{taskCreate}, nil
default:
return nil, errors.Errorf("unsupported change database config type %q", c.Type)
}
@@ -434,15 +431,15 @@ func getTaskCreatesFromChangeDatabaseConfigWithRelease(
return nil, errors.Wrapf(err, "failed to get sheet id from sheet %q in release file %q", file.Sheet, file.Id)
}
- // Determine task type based on file change type
- var taskType storepb.Task_Type
+ // Determine migrate type based on file change type
+ var migrateType storepb.Task_MigrateType
switch file.ChangeType {
case storepb.ReleasePayload_File_DDL, storepb.ReleasePayload_File_CHANGE_TYPE_UNSPECIFIED:
- taskType = storepb.Task_DATABASE_SCHEMA_UPDATE
+ migrateType = storepb.Task_DDL
case storepb.ReleasePayload_File_DDL_GHOST:
- taskType = storepb.Task_DATABASE_SCHEMA_UPDATE_GHOST
+ migrateType = storepb.Task_GHOST
case storepb.ReleasePayload_File_DML:
- taskType = storepb.Task_DATABASE_DATA_UPDATE
+ migrateType = storepb.Task_DML
default:
return nil, errors.Errorf("unsupported release file change type %q", file.ChangeType)
}
@@ -452,17 +449,18 @@ func getTaskCreatesFromChangeDatabaseConfigWithRelease(
SpecId: spec.Id,
SheetId: int32(sheetUID),
SchemaVersion: file.Version,
+ MigrateType: migrateType,
TaskReleaseSource: &storepb.TaskReleaseSource{
File: common.FormatReleaseFile(c.Release, file.Id),
},
}
// Add ghost flags if this is a ghost migration
- if taskType == storepb.Task_DATABASE_SCHEMA_UPDATE_GHOST && c.GhostFlags != nil {
+ if migrateType == storepb.Task_GHOST && c.GhostFlags != nil {
payload.Flags = c.GhostFlags
}
- if taskType == storepb.Task_DATABASE_DATA_UPDATE {
+ if migrateType == storepb.Task_DML {
payload.EnablePriorBackup = c.EnablePriorBackup
}
@@ -474,7 +472,7 @@ func getTaskCreatesFromChangeDatabaseConfigWithRelease(
InstanceID: database.InstanceID,
DatabaseName: &database.DatabaseName,
Environment: env,
- Type: taskType,
+ Type: storepb.Task_DATABASE_MIGRATE,
Payload: payload,
}
taskCreates = append(taskCreates, taskCreate)
@@ -509,7 +507,7 @@ func getTaskCreatesFromChangeDatabaseConfigWithRelease(
InstanceID: database.InstanceID,
DatabaseName: &database.DatabaseName,
Environment: env,
- Type: storepb.Task_DATABASE_SCHEMA_UPDATE_SDL,
+ Type: storepb.Task_DATABASE_SDL,
Payload: payload,
}
taskCreates = append(taskCreates, taskCreate)
diff --git a/backend/generated-go/store/plan.pb.go b/backend/generated-go/store/plan.pb.go
index 8695ed4b9c..810adf813c 100644
--- a/backend/generated-go/store/plan.pb.go
+++ b/backend/generated-go/store/plan.pb.go
@@ -27,14 +27,10 @@ type PlanConfig_ChangeDatabaseConfig_Type int32
const (
PlanConfig_ChangeDatabaseConfig_TYPE_UNSPECIFIED PlanConfig_ChangeDatabaseConfig_Type = 0
- // Used for DDL changes including CREATE DATABASE.
+ // Used for imperative schema migration 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 for DML change.
- PlanConfig_ChangeDatabaseConfig_DATA PlanConfig_ChangeDatabaseConfig_Type = 6
+ // Used for state-based declarative schema migration including CREATE DATABASE.
+ PlanConfig_ChangeDatabaseConfig_SDL PlanConfig_ChangeDatabaseConfig_Type = 3
)
// Enum value maps for PlanConfig_ChangeDatabaseConfig_Type.
@@ -42,16 +38,12 @@ var (
PlanConfig_ChangeDatabaseConfig_Type_name = map[int32]string{
0: "TYPE_UNSPECIFIED",
2: "MIGRATE",
- 3: "MIGRATE_SDL",
- 4: "MIGRATE_GHOST",
- 6: "DATA",
+ 3: "SDL",
}
PlanConfig_ChangeDatabaseConfig_Type_value = map[string]int32{
"TYPE_UNSPECIFIED": 0,
"MIGRATE": 2,
- "MIGRATE_SDL": 3,
- "MIGRATE_GHOST": 4,
- "DATA": 6,
+ "SDL": 3,
}
)
@@ -82,6 +74,63 @@ func (PlanConfig_ChangeDatabaseConfig_Type) EnumDescriptor() ([]byte, []int) {
return file_store_plan_proto_rawDescGZIP(), []int{0, 2, 0}
}
+// MigrateType is the migration type for imperative schema migration.
+// It is only set when type is MIGRATE.
+type PlanConfig_ChangeDatabaseConfig_MigrateType int32
+
+const (
+ PlanConfig_ChangeDatabaseConfig_MIGRATE_TYPE_UNSPECIFIED PlanConfig_ChangeDatabaseConfig_MigrateType = 0
+ // Used for DDL changes.
+ PlanConfig_ChangeDatabaseConfig_DDL PlanConfig_ChangeDatabaseConfig_MigrateType = 1
+ // Used for DML changes.
+ PlanConfig_ChangeDatabaseConfig_DML PlanConfig_ChangeDatabaseConfig_MigrateType = 2
+ // Used for DDL changes using gh-ost.
+ PlanConfig_ChangeDatabaseConfig_GHOST PlanConfig_ChangeDatabaseConfig_MigrateType = 3
+)
+
+// Enum value maps for PlanConfig_ChangeDatabaseConfig_MigrateType.
+var (
+ PlanConfig_ChangeDatabaseConfig_MigrateType_name = map[int32]string{
+ 0: "MIGRATE_TYPE_UNSPECIFIED",
+ 1: "DDL",
+ 2: "DML",
+ 3: "GHOST",
+ }
+ PlanConfig_ChangeDatabaseConfig_MigrateType_value = map[string]int32{
+ "MIGRATE_TYPE_UNSPECIFIED": 0,
+ "DDL": 1,
+ "DML": 2,
+ "GHOST": 3,
+ }
+)
+
+func (x PlanConfig_ChangeDatabaseConfig_MigrateType) Enum() *PlanConfig_ChangeDatabaseConfig_MigrateType {
+ p := new(PlanConfig_ChangeDatabaseConfig_MigrateType)
+ *p = x
+ return p
+}
+
+func (x PlanConfig_ChangeDatabaseConfig_MigrateType) String() string {
+ return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
+}
+
+func (PlanConfig_ChangeDatabaseConfig_MigrateType) Descriptor() protoreflect.EnumDescriptor {
+ return file_store_plan_proto_enumTypes[1].Descriptor()
+}
+
+func (PlanConfig_ChangeDatabaseConfig_MigrateType) Type() protoreflect.EnumType {
+ return &file_store_plan_proto_enumTypes[1]
+}
+
+func (x PlanConfig_ChangeDatabaseConfig_MigrateType) Number() protoreflect.EnumNumber {
+ return protoreflect.EnumNumber(x)
+}
+
+// Deprecated: Use PlanConfig_ChangeDatabaseConfig_MigrateType.Descriptor instead.
+func (PlanConfig_ChangeDatabaseConfig_MigrateType) EnumDescriptor() ([]byte, []int) {
+ return file_store_plan_proto_rawDescGZIP(), []int{0, 2, 1}
+}
+
type PlanConfig struct {
state protoimpl.MessageState `protogen:"open.v1"`
Specs []*PlanConfig_Spec `protobuf:"bytes,1,rep,name=specs,proto3" json:"specs,omitempty"`
@@ -363,9 +412,10 @@ type PlanConfig_ChangeDatabaseConfig struct {
Sheet string `protobuf:"bytes,2,opt,name=sheet,proto3" json:"sheet,omitempty"`
// The resource name of the release.
// Format: projects/{project}/releases/{release}
- Release string `protobuf:"bytes,9,opt,name=release,proto3" json:"release,omitempty"`
- Type PlanConfig_ChangeDatabaseConfig_Type `protobuf:"varint,3,opt,name=type,proto3,enum=bytebase.store.PlanConfig_ChangeDatabaseConfig_Type" json:"type,omitempty"`
- GhostFlags map[string]string `protobuf:"bytes,7,rep,name=ghost_flags,json=ghostFlags,proto3" json:"ghost_flags,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
+ Release string `protobuf:"bytes,9,opt,name=release,proto3" json:"release,omitempty"`
+ Type PlanConfig_ChangeDatabaseConfig_Type `protobuf:"varint,3,opt,name=type,proto3,enum=bytebase.store.PlanConfig_ChangeDatabaseConfig_Type" json:"type,omitempty"`
+ MigrateType PlanConfig_ChangeDatabaseConfig_MigrateType `protobuf:"varint,11,opt,name=migrate_type,json=migrateType,proto3,enum=bytebase.store.PlanConfig_ChangeDatabaseConfig_MigrateType" json:"migrate_type,omitempty"`
+ GhostFlags map[string]string `protobuf:"bytes,7,rep,name=ghost_flags,json=ghostFlags,proto3" json:"ghost_flags,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
// If set, a backup of the modified data will be created automatically before any changes are applied.
EnablePriorBackup bool `protobuf:"varint,8,opt,name=enable_prior_backup,json=enablePriorBackup,proto3" json:"enable_prior_backup,omitempty"`
unknownFields protoimpl.UnknownFields
@@ -430,6 +480,13 @@ func (x *PlanConfig_ChangeDatabaseConfig) GetType() PlanConfig_ChangeDatabaseCon
return PlanConfig_ChangeDatabaseConfig_TYPE_UNSPECIFIED
}
+func (x *PlanConfig_ChangeDatabaseConfig) GetMigrateType() PlanConfig_ChangeDatabaseConfig_MigrateType {
+ if x != nil {
+ return x.MigrateType
+ }
+ return PlanConfig_ChangeDatabaseConfig_MIGRATE_TYPE_UNSPECIFIED
+}
+
func (x *PlanConfig_ChangeDatabaseConfig) GetGhostFlags() map[string]string {
if x != nil {
return x.GhostFlags
@@ -632,7 +689,7 @@ var File_store_plan_proto protoreflect.FileDescriptor
const file_store_plan_proto_rawDesc = "" +
"\n" +
- "\x10store/plan.proto\x12\x0ebytebase.store\x1a\x1fgoogle/api/field_behavior.proto\x1a\x12store/common.proto\"\x80\r\n" +
+ "\x10store/plan.proto\x12\x0ebytebase.store\x1a\x1fgoogle/api/field_behavior.proto\x1a\x12store/common.proto\"\x85\x0e\n" +
"\n" +
"PlanConfig\x125\n" +
"\x05specs\x18\x01 \x03(\v2\x1f.bytebase.store.PlanConfig.SpecR\x05specs\x12E\n" +
@@ -653,25 +710,29 @@ const file_store_plan_proto_rawDesc = "" +
"\tcollation\x18\x05 \x01(\tB\x03\xe0A\x01R\tcollation\x12\x1d\n" +
"\acluster\x18\x06 \x01(\tB\x03\xe0A\x01R\acluster\x12\x19\n" +
"\x05owner\x18\a \x01(\tB\x03\xe0A\x01R\x05owner\x12%\n" +
- "\venvironment\x18\t \x01(\tB\x03\xe0A\x01R\venvironment\x1a\xd4\x03\n" +
+ "\venvironment\x18\t \x01(\tB\x03\xe0A\x01R\venvironment\x1a\xd9\x04\n" +
"\x14ChangeDatabaseConfig\x12\x18\n" +
"\atargets\x18\n" +
" \x03(\tR\atargets\x12\x14\n" +
"\x05sheet\x18\x02 \x01(\tR\x05sheet\x12\x18\n" +
"\arelease\x18\t \x01(\tR\arelease\x12H\n" +
- "\x04type\x18\x03 \x01(\x0e24.bytebase.store.PlanConfig.ChangeDatabaseConfig.TypeR\x04type\x12`\n" +
+ "\x04type\x18\x03 \x01(\x0e24.bytebase.store.PlanConfig.ChangeDatabaseConfig.TypeR\x04type\x12^\n" +
+ "\fmigrate_type\x18\v \x01(\x0e2;.bytebase.store.PlanConfig.ChangeDatabaseConfig.MigrateTypeR\vmigrateType\x12`\n" +
"\vghost_flags\x18\a \x03(\v2?.bytebase.store.PlanConfig.ChangeDatabaseConfig.GhostFlagsEntryR\n" +
"ghostFlags\x12.\n" +
"\x13enable_prior_backup\x18\b \x01(\bR\x11enablePriorBackup\x1a=\n" +
"\x0fGhostFlagsEntry\x12\x10\n" +
"\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" +
- "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"W\n" +
+ "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"2\n" +
"\x04Type\x12\x14\n" +
"\x10TYPE_UNSPECIFIED\x10\x00\x12\v\n" +
- "\aMIGRATE\x10\x02\x12\x0f\n" +
- "\vMIGRATE_SDL\x10\x03\x12\x11\n" +
- "\rMIGRATE_GHOST\x10\x04\x12\b\n" +
- "\x04DATA\x10\x06\x1a\xa6\x01\n" +
+ "\aMIGRATE\x10\x02\x12\a\n" +
+ "\x03SDL\x10\x03\"H\n" +
+ "\vMigrateType\x12\x1c\n" +
+ "\x18MIGRATE_TYPE_UNSPECIFIED\x10\x00\x12\a\n" +
+ "\x03DDL\x10\x01\x12\a\n" +
+ "\x03DML\x10\x02\x12\t\n" +
+ "\x05GHOST\x10\x03\x1a\xa6\x01\n" +
"\x10ExportDataConfig\x12\x18\n" +
"\atargets\x18\x05 \x03(\tR\atargets\x12\x14\n" +
"\x05sheet\x18\x02 \x01(\tR\x05sheet\x124\n" +
@@ -698,35 +759,37 @@ func file_store_plan_proto_rawDescGZIP() []byte {
return file_store_plan_proto_rawDescData
}
-var file_store_plan_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
+var file_store_plan_proto_enumTypes = make([]protoimpl.EnumInfo, 2)
var file_store_plan_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
var file_store_plan_proto_goTypes = []any{
(PlanConfig_ChangeDatabaseConfig_Type)(0), // 0: bytebase.store.PlanConfig.ChangeDatabaseConfig.Type
- (*PlanConfig)(nil), // 1: bytebase.store.PlanConfig
- (*PlanConfig_Spec)(nil), // 2: bytebase.store.PlanConfig.Spec
- (*PlanConfig_CreateDatabaseConfig)(nil), // 3: bytebase.store.PlanConfig.CreateDatabaseConfig
- (*PlanConfig_ChangeDatabaseConfig)(nil), // 4: bytebase.store.PlanConfig.ChangeDatabaseConfig
- (*PlanConfig_ExportDataConfig)(nil), // 5: bytebase.store.PlanConfig.ExportDataConfig
- (*PlanConfig_Deployment)(nil), // 6: bytebase.store.PlanConfig.Deployment
- nil, // 7: bytebase.store.PlanConfig.ChangeDatabaseConfig.GhostFlagsEntry
- (*PlanConfig_Deployment_DatabaseGroupMapping)(nil), // 8: bytebase.store.PlanConfig.Deployment.DatabaseGroupMapping
- (ExportFormat)(0), // 9: bytebase.store.ExportFormat
+ (PlanConfig_ChangeDatabaseConfig_MigrateType)(0), // 1: bytebase.store.PlanConfig.ChangeDatabaseConfig.MigrateType
+ (*PlanConfig)(nil), // 2: bytebase.store.PlanConfig
+ (*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_ExportDataConfig)(nil), // 6: bytebase.store.PlanConfig.ExportDataConfig
+ (*PlanConfig_Deployment)(nil), // 7: bytebase.store.PlanConfig.Deployment
+ nil, // 8: bytebase.store.PlanConfig.ChangeDatabaseConfig.GhostFlagsEntry
+ (*PlanConfig_Deployment_DatabaseGroupMapping)(nil), // 9: bytebase.store.PlanConfig.Deployment.DatabaseGroupMapping
+ (ExportFormat)(0), // 10: bytebase.store.ExportFormat
}
var file_store_plan_proto_depIdxs = []int32{
- 2, // 0: bytebase.store.PlanConfig.specs:type_name -> bytebase.store.PlanConfig.Spec
- 6, // 1: bytebase.store.PlanConfig.deployment:type_name -> bytebase.store.PlanConfig.Deployment
- 3, // 2: bytebase.store.PlanConfig.Spec.create_database_config:type_name -> bytebase.store.PlanConfig.CreateDatabaseConfig
- 4, // 3: bytebase.store.PlanConfig.Spec.change_database_config:type_name -> bytebase.store.PlanConfig.ChangeDatabaseConfig
- 5, // 4: bytebase.store.PlanConfig.Spec.export_data_config:type_name -> bytebase.store.PlanConfig.ExportDataConfig
- 0, // 5: bytebase.store.PlanConfig.ChangeDatabaseConfig.type:type_name -> bytebase.store.PlanConfig.ChangeDatabaseConfig.Type
- 7, // 6: bytebase.store.PlanConfig.ChangeDatabaseConfig.ghost_flags:type_name -> bytebase.store.PlanConfig.ChangeDatabaseConfig.GhostFlagsEntry
- 9, // 7: bytebase.store.PlanConfig.ExportDataConfig.format:type_name -> bytebase.store.ExportFormat
- 8, // 8: bytebase.store.PlanConfig.Deployment.database_group_mappings:type_name -> bytebase.store.PlanConfig.Deployment.DatabaseGroupMapping
- 9, // [9:9] is the sub-list for method output_type
- 9, // [9:9] is the sub-list for method input_type
- 9, // [9:9] is the sub-list for extension type_name
- 9, // [9:9] is the sub-list for extension extendee
- 0, // [0:9] is the sub-list for field type_name
+ 3, // 0: bytebase.store.PlanConfig.specs:type_name -> bytebase.store.PlanConfig.Spec
+ 7, // 1: bytebase.store.PlanConfig.deployment:type_name -> bytebase.store.PlanConfig.Deployment
+ 4, // 2: bytebase.store.PlanConfig.Spec.create_database_config:type_name -> bytebase.store.PlanConfig.CreateDatabaseConfig
+ 5, // 3: bytebase.store.PlanConfig.Spec.change_database_config:type_name -> bytebase.store.PlanConfig.ChangeDatabaseConfig
+ 6, // 4: bytebase.store.PlanConfig.Spec.export_data_config:type_name -> bytebase.store.PlanConfig.ExportDataConfig
+ 0, // 5: bytebase.store.PlanConfig.ChangeDatabaseConfig.type:type_name -> bytebase.store.PlanConfig.ChangeDatabaseConfig.Type
+ 1, // 6: bytebase.store.PlanConfig.ChangeDatabaseConfig.migrate_type:type_name -> bytebase.store.PlanConfig.ChangeDatabaseConfig.MigrateType
+ 8, // 7: bytebase.store.PlanConfig.ChangeDatabaseConfig.ghost_flags:type_name -> bytebase.store.PlanConfig.ChangeDatabaseConfig.GhostFlagsEntry
+ 10, // 8: bytebase.store.PlanConfig.ExportDataConfig.format:type_name -> bytebase.store.ExportFormat
+ 9, // 9: bytebase.store.PlanConfig.Deployment.database_group_mappings:type_name -> bytebase.store.PlanConfig.Deployment.DatabaseGroupMapping
+ 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() }
@@ -746,7 +809,7 @@ func file_store_plan_proto_init() {
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_store_plan_proto_rawDesc), len(file_store_plan_proto_rawDesc)),
- NumEnums: 1,
+ NumEnums: 2,
NumMessages: 8,
NumExtensions: 0,
NumServices: 0,
diff --git a/backend/generated-go/store/plan_equal.pb.go b/backend/generated-go/store/plan_equal.pb.go
index 22ac4f3f5b..48965b0f47 100644
--- a/backend/generated-go/store/plan_equal.pb.go
+++ b/backend/generated-go/store/plan_equal.pb.go
@@ -83,6 +83,9 @@ func (x *PlanConfig_ChangeDatabaseConfig) Equal(y *PlanConfig_ChangeDatabaseConf
if x.Type != y.Type {
return false
}
+ if x.MigrateType != y.MigrateType {
+ return false
+ }
if len(x.GhostFlags) != len(y.GhostFlags) {
return false
}
diff --git a/backend/generated-go/store/task.pb.go b/backend/generated-go/store/task.pb.go
index c5af7dd56c..346fce00ae 100644
--- a/backend/generated-go/store/task.pb.go
+++ b/backend/generated-go/store/task.pb.go
@@ -24,13 +24,11 @@ const (
type Task_Type int32
const (
- Task_TASK_TYPE_UNSPECIFIED Task_Type = 0
- Task_DATABASE_CREATE Task_Type = 1
- Task_DATABASE_SCHEMA_UPDATE Task_Type = 2
- Task_DATABASE_SCHEMA_UPDATE_GHOST Task_Type = 3
- Task_DATABASE_DATA_UPDATE Task_Type = 4
- Task_DATABASE_EXPORT Task_Type = 5
- Task_DATABASE_SCHEMA_UPDATE_SDL Task_Type = 6
+ Task_TASK_TYPE_UNSPECIFIED Task_Type = 0
+ Task_DATABASE_CREATE Task_Type = 1
+ Task_DATABASE_MIGRATE Task_Type = 2
+ Task_DATABASE_EXPORT Task_Type = 5
+ Task_DATABASE_SDL Task_Type = 6
)
// Enum value maps for Task_Type.
@@ -38,20 +36,16 @@ var (
Task_Type_name = map[int32]string{
0: "TASK_TYPE_UNSPECIFIED",
1: "DATABASE_CREATE",
- 2: "DATABASE_SCHEMA_UPDATE",
- 3: "DATABASE_SCHEMA_UPDATE_GHOST",
- 4: "DATABASE_DATA_UPDATE",
+ 2: "DATABASE_MIGRATE",
5: "DATABASE_EXPORT",
- 6: "DATABASE_SCHEMA_UPDATE_SDL",
+ 6: "DATABASE_SDL",
}
Task_Type_value = map[string]int32{
- "TASK_TYPE_UNSPECIFIED": 0,
- "DATABASE_CREATE": 1,
- "DATABASE_SCHEMA_UPDATE": 2,
- "DATABASE_SCHEMA_UPDATE_GHOST": 3,
- "DATABASE_DATA_UPDATE": 4,
- "DATABASE_EXPORT": 5,
- "DATABASE_SCHEMA_UPDATE_SDL": 6,
+ "TASK_TYPE_UNSPECIFIED": 0,
+ "DATABASE_CREATE": 1,
+ "DATABASE_MIGRATE": 2,
+ "DATABASE_EXPORT": 5,
+ "DATABASE_SDL": 6,
}
)
@@ -82,6 +76,59 @@ func (Task_Type) EnumDescriptor() ([]byte, []int) {
return file_store_task_proto_rawDescGZIP(), []int{0, 0}
}
+// MigrateType is the database migration type.
+type Task_MigrateType int32
+
+const (
+ Task_MIGRATE_TYPE_UNSPECIFIED Task_MigrateType = 0
+ Task_DDL Task_MigrateType = 1
+ Task_DML Task_MigrateType = 2
+ Task_GHOST Task_MigrateType = 3
+)
+
+// Enum value maps for Task_MigrateType.
+var (
+ Task_MigrateType_name = map[int32]string{
+ 0: "MIGRATE_TYPE_UNSPECIFIED",
+ 1: "DDL",
+ 2: "DML",
+ 3: "GHOST",
+ }
+ Task_MigrateType_value = map[string]int32{
+ "MIGRATE_TYPE_UNSPECIFIED": 0,
+ "DDL": 1,
+ "DML": 2,
+ "GHOST": 3,
+ }
+)
+
+func (x Task_MigrateType) Enum() *Task_MigrateType {
+ p := new(Task_MigrateType)
+ *p = x
+ return p
+}
+
+func (x Task_MigrateType) String() string {
+ return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
+}
+
+func (Task_MigrateType) Descriptor() protoreflect.EnumDescriptor {
+ return file_store_task_proto_enumTypes[1].Descriptor()
+}
+
+func (Task_MigrateType) Type() protoreflect.EnumType {
+ return &file_store_task_proto_enumTypes[1]
+}
+
+func (x Task_MigrateType) Number() protoreflect.EnumNumber {
+ return protoreflect.EnumNumber(x)
+}
+
+// Deprecated: Use Task_MigrateType.Descriptor instead.
+func (Task_MigrateType) EnumDescriptor() ([]byte, []int) {
+ return file_store_task_proto_rawDescGZIP(), []int{0, 1}
+}
+
type Task struct {
state protoimpl.MessageState `protogen:"open.v1"`
// common fields
@@ -101,6 +148,7 @@ type Task struct {
// ghost flags.
Flags map[string]string `protobuf:"bytes,12,rep,name=flags,proto3" json:"flags,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
TaskReleaseSource *TaskReleaseSource `protobuf:"bytes,13,opt,name=task_release_source,json=taskReleaseSource,proto3" json:"task_release_source,omitempty"`
+ MigrateType Task_MigrateType `protobuf:"varint,16,opt,name=migrate_type,json=migrateType,proto3,enum=bytebase.store.Task_MigrateType" json:"migrate_type,omitempty"`
// Export data fields.
Password string `protobuf:"bytes,14,opt,name=password,proto3" json:"password,omitempty"`
Format ExportFormat `protobuf:"varint,15,opt,name=format,proto3,enum=bytebase.store.ExportFormat" json:"format,omitempty"`
@@ -229,6 +277,13 @@ func (x *Task) GetTaskReleaseSource() *TaskReleaseSource {
return nil
}
+func (x *Task) GetMigrateType() Task_MigrateType {
+ if x != nil {
+ return x.MigrateType
+ }
+ return Task_MIGRATE_TYPE_UNSPECIFIED
+}
+
func (x *Task) GetPassword() string {
if x != nil {
return x.Password
@@ -292,7 +347,7 @@ var File_store_task_proto protoreflect.FileDescriptor
const file_store_task_proto_rawDesc = "" +
"\n" +
- "\x10store/task.proto\x12\x0ebytebase.store\x1a\x12store/common.proto\"\xdc\x06\n" +
+ "\x10store/task.proto\x12\x0ebytebase.store\x1a\x12store/common.proto\"\x9a\a\n" +
"\x04Task\x12\x18\n" +
"\askipped\x18\x01 \x01(\bR\askipped\x12%\n" +
"\x0eskipped_reason\x18\x02 \x01(\tR\rskippedReason\x12\x17\n" +
@@ -308,21 +363,25 @@ const file_store_task_proto_rawDesc = "" +
" \x01(\tR\rschemaVersion\x12.\n" +
"\x13enable_prior_backup\x18\v \x01(\bR\x11enablePriorBackup\x125\n" +
"\x05flags\x18\f \x03(\v2\x1f.bytebase.store.Task.FlagsEntryR\x05flags\x12Q\n" +
- "\x13task_release_source\x18\r \x01(\v2!.bytebase.store.TaskReleaseSourceR\x11taskReleaseSource\x12\x1a\n" +
+ "\x13task_release_source\x18\r \x01(\v2!.bytebase.store.TaskReleaseSourceR\x11taskReleaseSource\x12C\n" +
+ "\fmigrate_type\x18\x10 \x01(\x0e2 .bytebase.store.Task.MigrateTypeR\vmigrateType\x12\x1a\n" +
"\bpassword\x18\x0e \x01(\tR\bpassword\x124\n" +
"\x06format\x18\x0f \x01(\x0e2\x1c.bytebase.store.ExportFormatR\x06format\x1a8\n" +
"\n" +
"FlagsEntry\x12\x10\n" +
"\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" +
- "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"\xc3\x01\n" +
+ "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"s\n" +
"\x04Type\x12\x19\n" +
"\x15TASK_TYPE_UNSPECIFIED\x10\x00\x12\x13\n" +
- "\x0fDATABASE_CREATE\x10\x01\x12\x1a\n" +
- "\x16DATABASE_SCHEMA_UPDATE\x10\x02\x12 \n" +
- "\x1cDATABASE_SCHEMA_UPDATE_GHOST\x10\x03\x12\x18\n" +
- "\x14DATABASE_DATA_UPDATE\x10\x04\x12\x13\n" +
- "\x0fDATABASE_EXPORT\x10\x05\x12\x1e\n" +
- "\x1aDATABASE_SCHEMA_UPDATE_SDL\x10\x06\"'\n" +
+ "\x0fDATABASE_CREATE\x10\x01\x12\x14\n" +
+ "\x10DATABASE_MIGRATE\x10\x02\x12\x13\n" +
+ "\x0fDATABASE_EXPORT\x10\x05\x12\x10\n" +
+ "\fDATABASE_SDL\x10\x06\"H\n" +
+ "\vMigrateType\x12\x1c\n" +
+ "\x18MIGRATE_TYPE_UNSPECIFIED\x10\x00\x12\a\n" +
+ "\x03DDL\x10\x01\x12\a\n" +
+ "\x03DML\x10\x02\x12\t\n" +
+ "\x05GHOST\x10\x03\"'\n" +
"\x11TaskReleaseSource\x12\x12\n" +
"\x04file\x18\x01 \x01(\tR\x04fileB\x14Z\x12generated-go/storeb\x06proto3"
@@ -338,24 +397,26 @@ func file_store_task_proto_rawDescGZIP() []byte {
return file_store_task_proto_rawDescData
}
-var file_store_task_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
+var file_store_task_proto_enumTypes = make([]protoimpl.EnumInfo, 2)
var file_store_task_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
var file_store_task_proto_goTypes = []any{
(Task_Type)(0), // 0: bytebase.store.Task.Type
- (*Task)(nil), // 1: bytebase.store.Task
- (*TaskReleaseSource)(nil), // 2: bytebase.store.TaskReleaseSource
- nil, // 3: bytebase.store.Task.FlagsEntry
- (ExportFormat)(0), // 4: bytebase.store.ExportFormat
+ (Task_MigrateType)(0), // 1: bytebase.store.Task.MigrateType
+ (*Task)(nil), // 2: bytebase.store.Task
+ (*TaskReleaseSource)(nil), // 3: bytebase.store.TaskReleaseSource
+ nil, // 4: bytebase.store.Task.FlagsEntry
+ (ExportFormat)(0), // 5: bytebase.store.ExportFormat
}
var file_store_task_proto_depIdxs = []int32{
- 3, // 0: bytebase.store.Task.flags:type_name -> bytebase.store.Task.FlagsEntry
- 2, // 1: bytebase.store.Task.task_release_source:type_name -> bytebase.store.TaskReleaseSource
- 4, // 2: bytebase.store.Task.format:type_name -> bytebase.store.ExportFormat
- 3, // [3:3] is the sub-list for method output_type
- 3, // [3:3] is the sub-list for method input_type
- 3, // [3:3] is the sub-list for extension type_name
- 3, // [3:3] is the sub-list for extension extendee
- 0, // [0:3] is the sub-list for field type_name
+ 4, // 0: bytebase.store.Task.flags:type_name -> bytebase.store.Task.FlagsEntry
+ 3, // 1: bytebase.store.Task.task_release_source:type_name -> bytebase.store.TaskReleaseSource
+ 1, // 2: bytebase.store.Task.migrate_type:type_name -> bytebase.store.Task.MigrateType
+ 5, // 3: bytebase.store.Task.format:type_name -> bytebase.store.ExportFormat
+ 4, // [4:4] is the sub-list for method output_type
+ 4, // [4:4] is the sub-list for method input_type
+ 4, // [4:4] is the sub-list for extension type_name
+ 4, // [4:4] is the sub-list for extension extendee
+ 0, // [0:4] is the sub-list for field type_name
}
func init() { file_store_task_proto_init() }
@@ -369,7 +430,7 @@ func file_store_task_proto_init() {
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_store_task_proto_rawDesc), len(file_store_task_proto_rawDesc)),
- NumEnums: 1,
+ NumEnums: 2,
NumMessages: 3,
NumExtensions: 0,
NumServices: 0,
diff --git a/backend/generated-go/store/task_equal.pb.go b/backend/generated-go/store/task_equal.pb.go
index c5a5aa6a76..3b0a92f93e 100644
--- a/backend/generated-go/store/task_equal.pb.go
+++ b/backend/generated-go/store/task_equal.pb.go
@@ -58,6 +58,9 @@ func (x *Task) Equal(y *Task) bool {
if !x.TaskReleaseSource.Equal(y.TaskReleaseSource) {
return false
}
+ if x.MigrateType != y.MigrateType {
+ return false
+ }
if x.Password != y.Password {
return false
}
diff --git a/backend/generated-go/v1/common.pb.go b/backend/generated-go/v1/common.pb.go
index 193a3de7f4..1eb98be066 100644
--- a/backend/generated-go/v1/common.pb.go
+++ b/backend/generated-go/v1/common.pb.go
@@ -303,14 +303,10 @@ type DatabaseChangeType int32
const (
DatabaseChangeType_DATABASE_CHANGE_TYPE_UNSPECIFIED DatabaseChangeType = 0
- // Used for DDL changes including CREATE DATABASE.
+ // Used for imperative schema migration including CREATE DATABASE.
DatabaseChangeType_MIGRATE DatabaseChangeType = 2
- // Used for schema changes via state-based schema migration including CREATE DATABASE.
- DatabaseChangeType_MIGRATE_SDL DatabaseChangeType = 3
- // Used for DDL changes using gh-ost.
- DatabaseChangeType_MIGRATE_GHOST DatabaseChangeType = 4
- // Used for DML change.
- DatabaseChangeType_DATA DatabaseChangeType = 6
+ // Used for state-based declarative schema migration including CREATE DATABASE.
+ DatabaseChangeType_SDL DatabaseChangeType = 3
)
// Enum value maps for DatabaseChangeType.
@@ -318,16 +314,12 @@ var (
DatabaseChangeType_name = map[int32]string{
0: "DATABASE_CHANGE_TYPE_UNSPECIFIED",
2: "MIGRATE",
- 3: "MIGRATE_SDL",
- 4: "MIGRATE_GHOST",
- 6: "DATA",
+ 3: "SDL",
}
DatabaseChangeType_value = map[string]int32{
"DATABASE_CHANGE_TYPE_UNSPECIFIED": 0,
"MIGRATE": 2,
- "MIGRATE_SDL": 3,
- "MIGRATE_GHOST": 4,
- "DATA": 6,
+ "SDL": 3,
}
)
@@ -358,6 +350,62 @@ func (DatabaseChangeType) EnumDescriptor() ([]byte, []int) {
return file_v1_common_proto_rawDescGZIP(), []int{4}
}
+// MigrationType is the type for imperative schema migration.
+type MigrationType int32
+
+const (
+ MigrationType_MIGRATION_TYPE_UNSPECIFIED MigrationType = 0
+ // Used for DDL changes.
+ MigrationType_DDL MigrationType = 1
+ // Used for DML changes.
+ MigrationType_DML MigrationType = 2
+ // Used for DDL changes using gh-ost.
+ MigrationType_GHOST MigrationType = 3
+)
+
+// Enum value maps for MigrationType.
+var (
+ MigrationType_name = map[int32]string{
+ 0: "MIGRATION_TYPE_UNSPECIFIED",
+ 1: "DDL",
+ 2: "DML",
+ 3: "GHOST",
+ }
+ MigrationType_value = map[string]int32{
+ "MIGRATION_TYPE_UNSPECIFIED": 0,
+ "DDL": 1,
+ "DML": 2,
+ "GHOST": 3,
+ }
+)
+
+func (x MigrationType) Enum() *MigrationType {
+ p := new(MigrationType)
+ *p = x
+ return p
+}
+
+func (x MigrationType) String() string {
+ return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
+}
+
+func (MigrationType) Descriptor() protoreflect.EnumDescriptor {
+ return file_v1_common_proto_enumTypes[5].Descriptor()
+}
+
+func (MigrationType) Type() protoreflect.EnumType {
+ return &file_v1_common_proto_enumTypes[5]
+}
+
+func (x MigrationType) Number() protoreflect.EnumNumber {
+ return protoreflect.EnumNumber(x)
+}
+
+// Deprecated: Use MigrationType.Descriptor instead.
+func (MigrationType) EnumDescriptor() ([]byte, []int) {
+ return file_v1_common_proto_rawDescGZIP(), []int{5}
+}
+
// Position in a text expressed as zero-based line and zero-based column byte
// offset.
type Position struct {
@@ -527,13 +575,16 @@ const file_v1_common_proto_rawDesc = "" +
"\x03CSV\x10\x01\x12\b\n" +
"\x04JSON\x10\x02\x12\a\n" +
"\x03SQL\x10\x03\x12\b\n" +
- "\x04XLSX\x10\x04*u\n" +
+ "\x04XLSX\x10\x04*P\n" +
"\x12DatabaseChangeType\x12$\n" +
" DATABASE_CHANGE_TYPE_UNSPECIFIED\x10\x00\x12\v\n" +
- "\aMIGRATE\x10\x02\x12\x0f\n" +
- "\vMIGRATE_SDL\x10\x03\x12\x11\n" +
- "\rMIGRATE_GHOST\x10\x04\x12\b\n" +
- "\x04DATA\x10\x06B6Z4github.com/bytebase/bytebase/backend/generated-go/v1b\x06proto3"
+ "\aMIGRATE\x10\x02\x12\a\n" +
+ "\x03SDL\x10\x03*L\n" +
+ "\rMigrationType\x12\x1e\n" +
+ "\x1aMIGRATION_TYPE_UNSPECIFIED\x10\x00\x12\a\n" +
+ "\x03DDL\x10\x01\x12\a\n" +
+ "\x03DML\x10\x02\x12\t\n" +
+ "\x05GHOST\x10\x03B6Z4github.com/bytebase/bytebase/backend/generated-go/v1b\x06proto3"
var (
file_v1_common_proto_rawDescOnce sync.Once
@@ -547,7 +598,7 @@ func file_v1_common_proto_rawDescGZIP() []byte {
return file_v1_common_proto_rawDescData
}
-var file_v1_common_proto_enumTypes = make([]protoimpl.EnumInfo, 5)
+var file_v1_common_proto_enumTypes = make([]protoimpl.EnumInfo, 6)
var file_v1_common_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_v1_common_proto_goTypes = []any{
(State)(0), // 0: bytebase.v1.State
@@ -555,8 +606,9 @@ var file_v1_common_proto_goTypes = []any{
(VCSType)(0), // 2: bytebase.v1.VCSType
(ExportFormat)(0), // 3: bytebase.v1.ExportFormat
(DatabaseChangeType)(0), // 4: bytebase.v1.DatabaseChangeType
- (*Position)(nil), // 5: bytebase.v1.Position
- (*Range)(nil), // 6: bytebase.v1.Range
+ (MigrationType)(0), // 5: bytebase.v1.MigrationType
+ (*Position)(nil), // 6: bytebase.v1.Position
+ (*Range)(nil), // 7: bytebase.v1.Range
}
var file_v1_common_proto_depIdxs = []int32{
0, // [0:0] is the sub-list for method output_type
@@ -576,7 +628,7 @@ func file_v1_common_proto_init() {
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_v1_common_proto_rawDesc), len(file_v1_common_proto_rawDesc)),
- NumEnums: 5,
+ NumEnums: 6,
NumMessages: 2,
NumExtensions: 0,
NumServices: 0,
diff --git a/backend/generated-go/v1/plan_service.pb.go b/backend/generated-go/v1/plan_service.pb.go
index 1b618be658..45ebe4604a 100644
--- a/backend/generated-go/v1/plan_service.pb.go
+++ b/backend/generated-go/v1/plan_service.pb.go
@@ -1465,8 +1465,11 @@ type Plan_ChangeDatabaseConfig struct {
// Format: projects/{project}/releases/{release}
Release string `protobuf:"bytes,9,opt,name=release,proto3" json:"release,omitempty"`
// Type is the database change type.
- Type DatabaseChangeType `protobuf:"varint,3,opt,name=type,proto3,enum=bytebase.v1.DatabaseChangeType" json:"type,omitempty"`
- GhostFlags map[string]string `protobuf:"bytes,7,rep,name=ghost_flags,json=ghostFlags,proto3" json:"ghost_flags,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
+ Type DatabaseChangeType `protobuf:"varint,3,opt,name=type,proto3,enum=bytebase.v1.DatabaseChangeType" json:"type,omitempty"`
+ // migration_type is the migration type for imperative schema migration.
+ // It is only set when type is MIGRATE.
+ MigrationType MigrationType `protobuf:"varint,11,opt,name=migration_type,json=migrationType,proto3,enum=bytebase.v1.MigrationType" json:"migration_type,omitempty"`
+ GhostFlags map[string]string `protobuf:"bytes,7,rep,name=ghost_flags,json=ghostFlags,proto3" json:"ghost_flags,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
// If set, a backup of the modified data will be created automatically before any changes are applied.
EnablePriorBackup bool `protobuf:"varint,8,opt,name=enable_prior_backup,json=enablePriorBackup,proto3" json:"enable_prior_backup,omitempty"`
unknownFields protoimpl.UnknownFields
@@ -1531,6 +1534,13 @@ func (x *Plan_ChangeDatabaseConfig) GetType() DatabaseChangeType {
return DatabaseChangeType_DATABASE_CHANGE_TYPE_UNSPECIFIED
}
+func (x *Plan_ChangeDatabaseConfig) GetMigrationType() MigrationType {
+ if x != nil {
+ return x.MigrationType
+ }
+ return MigrationType_MIGRATION_TYPE_UNSPECIFIED
+}
+
func (x *Plan_ChangeDatabaseConfig) GetGhostFlags() map[string]string {
if x != nil {
return x.GhostFlags
@@ -2008,7 +2018,7 @@ const file_v1_plan_service_proto_rawDesc = "" +
"\x04plan\x18\x01 \x01(\v2\x11.bytebase.v1.PlanB\x03\xe0A\x02R\x04plan\x12@\n" +
"\vupdate_mask\x18\x02 \x01(\v2\x1a.google.protobuf.FieldMaskB\x03\xe0A\x02R\n" +
"updateMask\x12#\n" +
- "\rallow_missing\x18\x03 \x01(\bR\fallowMissing\"\xbc\x10\n" +
+ "\rallow_missing\x18\x03 \x01(\bR\fallowMissing\"\xff\x10\n" +
"\x04Plan\x12\x12\n" +
"\x04name\x18\x01 \x01(\tR\x04name\x12(\n" +
"\x05state\x18\x02 \x01(\x0e2\x12.bytebase.v1.StateR\x05state\x12\x19\n" +
@@ -2044,14 +2054,15 @@ const file_v1_plan_service_proto_rawDesc = "" +
"\tcollation\x18\x05 \x01(\tB\x03\xe0A\x01R\tcollation\x12\x1d\n" +
"\acluster\x18\x06 \x01(\tB\x03\xe0A\x01R\acluster\x12\x19\n" +
"\x05owner\x18\a \x01(\tB\x03\xe0A\x01R\x05owner\x12%\n" +
- "\venvironment\x18\t \x01(\tB\x03\xe0A\x01R\venvironment\x1a\x84\x03\n" +
+ "\venvironment\x18\t \x01(\tB\x03\xe0A\x01R\venvironment\x1a\xc7\x03\n" +
"\x14ChangeDatabaseConfig\x12\x18\n" +
"\atargets\x18\n" +
" \x03(\tR\atargets\x12\x14\n" +
"\x05sheet\x18\x02 \x01(\tR\x05sheet\x123\n" +
"\arelease\x18\t \x01(\tB\x19\xfaA\x16\n" +
"\x14bytebase.com/ReleaseR\arelease\x123\n" +
- "\x04type\x18\x03 \x01(\x0e2\x1f.bytebase.v1.DatabaseChangeTypeR\x04type\x12W\n" +
+ "\x04type\x18\x03 \x01(\x0e2\x1f.bytebase.v1.DatabaseChangeTypeR\x04type\x12A\n" +
+ "\x0emigration_type\x18\v \x01(\x0e2\x1a.bytebase.v1.MigrationTypeR\rmigrationType\x12W\n" +
"\vghost_flags\x18\a \x03(\v26.bytebase.v1.Plan.ChangeDatabaseConfig.GhostFlagsEntryR\n" +
"ghostFlags\x12.\n" +
"\x13enable_prior_backup\x18\b \x01(\bR\x11enablePriorBackup\x1a=\n" +
@@ -2203,9 +2214,10 @@ var file_v1_plan_service_proto_goTypes = []any{
(State)(0), // 30: bytebase.v1.State
(*timestamppb.Timestamp)(nil), // 31: google.protobuf.Timestamp
(DatabaseChangeType)(0), // 32: bytebase.v1.DatabaseChangeType
- (ExportFormat)(0), // 33: bytebase.v1.ExportFormat
- (*ChangedResources)(nil), // 34: bytebase.v1.ChangedResources
- (*Position)(nil), // 35: bytebase.v1.Position
+ (MigrationType)(0), // 33: bytebase.v1.MigrationType
+ (ExportFormat)(0), // 34: bytebase.v1.ExportFormat
+ (*ChangedResources)(nil), // 35: bytebase.v1.ChangedResources
+ (*Position)(nil), // 36: bytebase.v1.Position
}
var file_v1_plan_service_proto_depIdxs = []int32{
10, // 0: bytebase.v1.ListPlansResponse.plans:type_name -> bytebase.v1.Plan
@@ -2228,36 +2240,37 @@ var file_v1_plan_service_proto_depIdxs = []int32{
21, // 17: bytebase.v1.Plan.Spec.change_database_config:type_name -> bytebase.v1.Plan.ChangeDatabaseConfig
22, // 18: bytebase.v1.Plan.Spec.export_data_config:type_name -> bytebase.v1.Plan.ExportDataConfig
32, // 19: bytebase.v1.Plan.ChangeDatabaseConfig.type:type_name -> bytebase.v1.DatabaseChangeType
- 24, // 20: bytebase.v1.Plan.ChangeDatabaseConfig.ghost_flags:type_name -> bytebase.v1.Plan.ChangeDatabaseConfig.GhostFlagsEntry
- 33, // 21: bytebase.v1.Plan.ExportDataConfig.format:type_name -> bytebase.v1.ExportFormat
- 25, // 22: bytebase.v1.Plan.Deployment.database_group_mappings:type_name -> bytebase.v1.Plan.Deployment.DatabaseGroupMapping
- 2, // 23: bytebase.v1.PlanCheckRun.Result.status:type_name -> bytebase.v1.PlanCheckRun.Result.Status
- 27, // 24: bytebase.v1.PlanCheckRun.Result.sql_summary_report:type_name -> bytebase.v1.PlanCheckRun.Result.SqlSummaryReport
- 28, // 25: bytebase.v1.PlanCheckRun.Result.sql_review_report:type_name -> bytebase.v1.PlanCheckRun.Result.SqlReviewReport
- 34, // 26: bytebase.v1.PlanCheckRun.Result.SqlSummaryReport.changed_resources:type_name -> bytebase.v1.ChangedResources
- 35, // 27: bytebase.v1.PlanCheckRun.Result.SqlReviewReport.start_position:type_name -> bytebase.v1.Position
- 35, // 28: bytebase.v1.PlanCheckRun.Result.SqlReviewReport.end_position:type_name -> bytebase.v1.Position
- 3, // 29: bytebase.v1.PlanService.GetPlan:input_type -> bytebase.v1.GetPlanRequest
- 4, // 30: bytebase.v1.PlanService.ListPlans:input_type -> bytebase.v1.ListPlansRequest
- 6, // 31: bytebase.v1.PlanService.SearchPlans:input_type -> bytebase.v1.SearchPlansRequest
- 8, // 32: bytebase.v1.PlanService.CreatePlan:input_type -> bytebase.v1.CreatePlanRequest
- 9, // 33: bytebase.v1.PlanService.UpdatePlan:input_type -> bytebase.v1.UpdatePlanRequest
- 11, // 34: bytebase.v1.PlanService.ListPlanCheckRuns:input_type -> bytebase.v1.ListPlanCheckRunsRequest
- 13, // 35: bytebase.v1.PlanService.RunPlanChecks:input_type -> bytebase.v1.RunPlanChecksRequest
- 15, // 36: bytebase.v1.PlanService.BatchCancelPlanCheckRuns:input_type -> bytebase.v1.BatchCancelPlanCheckRunsRequest
- 10, // 37: bytebase.v1.PlanService.GetPlan:output_type -> bytebase.v1.Plan
- 5, // 38: bytebase.v1.PlanService.ListPlans:output_type -> bytebase.v1.ListPlansResponse
- 7, // 39: bytebase.v1.PlanService.SearchPlans:output_type -> bytebase.v1.SearchPlansResponse
- 10, // 40: bytebase.v1.PlanService.CreatePlan:output_type -> bytebase.v1.Plan
- 10, // 41: bytebase.v1.PlanService.UpdatePlan:output_type -> bytebase.v1.Plan
- 12, // 42: bytebase.v1.PlanService.ListPlanCheckRuns:output_type -> bytebase.v1.ListPlanCheckRunsResponse
- 14, // 43: bytebase.v1.PlanService.RunPlanChecks:output_type -> bytebase.v1.RunPlanChecksResponse
- 16, // 44: bytebase.v1.PlanService.BatchCancelPlanCheckRuns:output_type -> bytebase.v1.BatchCancelPlanCheckRunsResponse
- 37, // [37:45] is the sub-list for method output_type
- 29, // [29:37] is the sub-list for method input_type
- 29, // [29:29] is the sub-list for extension type_name
- 29, // [29:29] is the sub-list for extension extendee
- 0, // [0:29] is the sub-list for field type_name
+ 33, // 20: bytebase.v1.Plan.ChangeDatabaseConfig.migration_type:type_name -> bytebase.v1.MigrationType
+ 24, // 21: bytebase.v1.Plan.ChangeDatabaseConfig.ghost_flags:type_name -> bytebase.v1.Plan.ChangeDatabaseConfig.GhostFlagsEntry
+ 34, // 22: bytebase.v1.Plan.ExportDataConfig.format:type_name -> bytebase.v1.ExportFormat
+ 25, // 23: bytebase.v1.Plan.Deployment.database_group_mappings:type_name -> bytebase.v1.Plan.Deployment.DatabaseGroupMapping
+ 2, // 24: bytebase.v1.PlanCheckRun.Result.status:type_name -> bytebase.v1.PlanCheckRun.Result.Status
+ 27, // 25: bytebase.v1.PlanCheckRun.Result.sql_summary_report:type_name -> bytebase.v1.PlanCheckRun.Result.SqlSummaryReport
+ 28, // 26: bytebase.v1.PlanCheckRun.Result.sql_review_report:type_name -> bytebase.v1.PlanCheckRun.Result.SqlReviewReport
+ 35, // 27: bytebase.v1.PlanCheckRun.Result.SqlSummaryReport.changed_resources:type_name -> bytebase.v1.ChangedResources
+ 36, // 28: bytebase.v1.PlanCheckRun.Result.SqlReviewReport.start_position:type_name -> bytebase.v1.Position
+ 36, // 29: bytebase.v1.PlanCheckRun.Result.SqlReviewReport.end_position:type_name -> bytebase.v1.Position
+ 3, // 30: bytebase.v1.PlanService.GetPlan:input_type -> bytebase.v1.GetPlanRequest
+ 4, // 31: bytebase.v1.PlanService.ListPlans:input_type -> bytebase.v1.ListPlansRequest
+ 6, // 32: bytebase.v1.PlanService.SearchPlans:input_type -> bytebase.v1.SearchPlansRequest
+ 8, // 33: bytebase.v1.PlanService.CreatePlan:input_type -> bytebase.v1.CreatePlanRequest
+ 9, // 34: bytebase.v1.PlanService.UpdatePlan:input_type -> bytebase.v1.UpdatePlanRequest
+ 11, // 35: bytebase.v1.PlanService.ListPlanCheckRuns:input_type -> bytebase.v1.ListPlanCheckRunsRequest
+ 13, // 36: bytebase.v1.PlanService.RunPlanChecks:input_type -> bytebase.v1.RunPlanChecksRequest
+ 15, // 37: bytebase.v1.PlanService.BatchCancelPlanCheckRuns:input_type -> bytebase.v1.BatchCancelPlanCheckRunsRequest
+ 10, // 38: bytebase.v1.PlanService.GetPlan:output_type -> bytebase.v1.Plan
+ 5, // 39: bytebase.v1.PlanService.ListPlans:output_type -> bytebase.v1.ListPlansResponse
+ 7, // 40: bytebase.v1.PlanService.SearchPlans:output_type -> bytebase.v1.SearchPlansResponse
+ 10, // 41: bytebase.v1.PlanService.CreatePlan:output_type -> bytebase.v1.Plan
+ 10, // 42: bytebase.v1.PlanService.UpdatePlan:output_type -> bytebase.v1.Plan
+ 12, // 43: bytebase.v1.PlanService.ListPlanCheckRuns:output_type -> bytebase.v1.ListPlanCheckRunsResponse
+ 14, // 44: bytebase.v1.PlanService.RunPlanChecks:output_type -> bytebase.v1.RunPlanChecksResponse
+ 16, // 45: bytebase.v1.PlanService.BatchCancelPlanCheckRuns:output_type -> bytebase.v1.BatchCancelPlanCheckRunsResponse
+ 38, // [38:46] is the sub-list for method output_type
+ 30, // [30:38] is the sub-list for method input_type
+ 30, // [30:30] is the sub-list for extension type_name
+ 30, // [30:30] is the sub-list for extension extendee
+ 0, // [0:30] is the sub-list for field type_name
}
func init() { file_v1_plan_service_proto_init() }
diff --git a/backend/generated-go/v1/plan_service_equal.pb.go b/backend/generated-go/v1/plan_service_equal.pb.go
index 11f15a1761..35b9f7c486 100644
--- a/backend/generated-go/v1/plan_service_equal.pb.go
+++ b/backend/generated-go/v1/plan_service_equal.pb.go
@@ -223,6 +223,9 @@ func (x *Plan_ChangeDatabaseConfig) Equal(y *Plan_ChangeDatabaseConfig) bool {
if x.Type != y.Type {
return false
}
+ if x.MigrationType != y.MigrationType {
+ return false
+ }
if len(x.GhostFlags) != len(y.GhostFlags) {
return false
}
diff --git a/backend/generated-go/v1/rollout_service.pb.go b/backend/generated-go/v1/rollout_service.pb.go
index ace8803b50..68d3b98c9b 100644
--- a/backend/generated-go/v1/rollout_service.pb.go
+++ b/backend/generated-go/v1/rollout_service.pb.go
@@ -95,38 +95,30 @@ const (
// use payload DatabaseCreate
Task_DATABASE_CREATE Task_Type = 2
// use payload DatabaseUpdate
- Task_DATABASE_SCHEMA_UPDATE Task_Type = 4
+ Task_DATABASE_MIGRATE Task_Type = 3
// use payload DatabaseUpdate
- Task_DATABASE_SCHEMA_UPDATE_SDL Task_Type = 5
- // use payload DatabaseUpdate
- Task_DATABASE_SCHEMA_UPDATE_GHOST Task_Type = 9
- // use payload DatabaseUpdate
- Task_DATABASE_DATA_UPDATE Task_Type = 8
+ Task_DATABASE_SDL Task_Type = 6
// use payload DatabaseDataExport
- Task_DATABASE_EXPORT Task_Type = 12
+ Task_DATABASE_EXPORT Task_Type = 5
)
// Enum value maps for Task_Type.
var (
Task_Type_name = map[int32]string{
- 0: "TYPE_UNSPECIFIED",
- 1: "GENERAL",
- 2: "DATABASE_CREATE",
- 4: "DATABASE_SCHEMA_UPDATE",
- 5: "DATABASE_SCHEMA_UPDATE_SDL",
- 9: "DATABASE_SCHEMA_UPDATE_GHOST",
- 8: "DATABASE_DATA_UPDATE",
- 12: "DATABASE_EXPORT",
+ 0: "TYPE_UNSPECIFIED",
+ 1: "GENERAL",
+ 2: "DATABASE_CREATE",
+ 3: "DATABASE_MIGRATE",
+ 6: "DATABASE_SDL",
+ 5: "DATABASE_EXPORT",
}
Task_Type_value = map[string]int32{
- "TYPE_UNSPECIFIED": 0,
- "GENERAL": 1,
- "DATABASE_CREATE": 2,
- "DATABASE_SCHEMA_UPDATE": 4,
- "DATABASE_SCHEMA_UPDATE_SDL": 5,
- "DATABASE_SCHEMA_UPDATE_GHOST": 9,
- "DATABASE_DATA_UPDATE": 8,
- "DATABASE_EXPORT": 12,
+ "TYPE_UNSPECIFIED": 0,
+ "GENERAL": 1,
+ "DATABASE_CREATE": 2,
+ "DATABASE_MIGRATE": 3,
+ "DATABASE_SDL": 6,
+ "DATABASE_EXPORT": 5,
}
)
@@ -817,8 +809,8 @@ type ListRolloutsRequest struct {
//
// For example:
// creator == "users/[email protected]" && update_time >= "2025-01-02T15:04:05Z07:00"
- // task_type == "DATABASE_SCHEMA_UPDATE"
- // task_type in ["DATABASE_SCHEMA_UPDATE", "DATABASE_DATA_UPDATE"]
+ // task_type == "DATABASE_MIGRATE"
+ // task_type in ["DATABASE_MIGRATE", "DATABASE_EXPORT"]
Filter string `protobuf:"bytes,4,opt,name=filter,proto3" json:"filter,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
@@ -2289,8 +2281,11 @@ func (x *Task_DatabaseCreate) GetEnvironment() string {
type Task_DatabaseUpdate struct {
state protoimpl.MessageState `protogen:"open.v1"`
// Format: projects/{project}/sheets/{sheet}
- Sheet string `protobuf:"bytes,1,opt,name=sheet,proto3" json:"sheet,omitempty"`
- SchemaVersion string `protobuf:"bytes,2,opt,name=schema_version,json=schemaVersion,proto3" json:"schema_version,omitempty"`
+ Sheet string `protobuf:"bytes,1,opt,name=sheet,proto3" json:"sheet,omitempty"`
+ SchemaVersion string `protobuf:"bytes,2,opt,name=schema_version,json=schemaVersion,proto3" json:"schema_version,omitempty"`
+ DatabaseChangeType DatabaseChangeType `protobuf:"varint,3,opt,name=database_change_type,json=databaseChangeType,proto3,enum=bytebase.v1.DatabaseChangeType" json:"database_change_type,omitempty"`
+ // migration_type is only set when database_change_type is MIGRATE.
+ MigrationType MigrationType `protobuf:"varint,4,opt,name=migration_type,json=migrationType,proto3,enum=bytebase.v1.MigrationType" json:"migration_type,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
@@ -2339,6 +2334,20 @@ func (x *Task_DatabaseUpdate) GetSchemaVersion() string {
return ""
}
+func (x *Task_DatabaseUpdate) GetDatabaseChangeType() DatabaseChangeType {
+ if x != nil {
+ return x.DatabaseChangeType
+ }
+ return DatabaseChangeType_DATABASE_CHANGE_TYPE_UNSPECIFIED
+}
+
+func (x *Task_DatabaseUpdate) GetMigrationType() MigrationType {
+ if x != nil {
+ return x.MigrationType
+ }
+ return MigrationType_MIGRATION_TYPE_UNSPECIFIED
+}
+
type Task_DatabaseDataExport struct {
state protoimpl.MessageState `protogen:"open.v1"`
// The resource name of the target.
@@ -3631,7 +3640,7 @@ const file_v1_rollout_service_proto_rawDesc = "" +
"\x02id\x18\x03 \x01(\tB\x03\xe0A\x03R\x02id\x12 \n" +
"\venvironment\x18\x04 \x01(\tR\venvironment\x12'\n" +
"\x05tasks\x18\x05 \x03(\v2\x11.bytebase.v1.TaskR\x05tasks:M\xeaAJ\n" +
- "\x12bytebase.com/Stage\x124projects/{project}/rollouts/{rollout}/stages/{stage}J\x04\b\x02\x10\x03\"\xf0\v\n" +
+ "\x12bytebase.com/Stage\x124projects/{project}/rollouts/{rollout}/stages/{stage}J\x04\b\x02\x10\x03\"\xb6\f\n" +
"\x04Task\x12\x12\n" +
"\x04name\x18\x01 \x01(\tR\x04name\x12\x17\n" +
"\aspec_id\x18\x04 \x01(\tR\x06specId\x120\n" +
@@ -3652,10 +3661,12 @@ const file_v1_rollout_service_proto_rawDesc = "" +
"\x05sheet\x18\x04 \x01(\tR\x05sheet\x12#\n" +
"\rcharacter_set\x18\x05 \x01(\tR\fcharacterSet\x12\x1c\n" +
"\tcollation\x18\x06 \x01(\tR\tcollation\x12 \n" +
- "\venvironment\x18\a \x01(\tR\venvironment\x1aM\n" +
+ "\venvironment\x18\a \x01(\tR\venvironment\x1a\xe3\x01\n" +
"\x0eDatabaseUpdate\x12\x14\n" +
"\x05sheet\x18\x01 \x01(\tR\x05sheet\x12%\n" +
- "\x0eschema_version\x18\x02 \x01(\tR\rschemaVersion\x1a\xa3\x01\n" +
+ "\x0eschema_version\x18\x02 \x01(\tR\rschemaVersion\x12Q\n" +
+ "\x14database_change_type\x18\x03 \x01(\x0e2\x1f.bytebase.v1.DatabaseChangeTypeR\x12databaseChangeType\x12A\n" +
+ "\x0emigration_type\x18\x04 \x01(\x0e2\x1a.bytebase.v1.MigrationTypeR\rmigrationType\x1a\xa3\x01\n" +
"\x12DatabaseDataExport\x12\x16\n" +
"\x06target\x18\x01 \x01(\tR\x06target\x12\x14\n" +
"\x05sheet\x18\x02 \x01(\tR\x05sheet\x121\n" +
@@ -3671,16 +3682,14 @@ const file_v1_rollout_service_proto_rawDesc = "" +
"\n" +
"\x06FAILED\x10\x05\x12\f\n" +
"\bCANCELED\x10\x06\x12\v\n" +
- "\aSKIPPED\x10\a\"\xcb\x01\n" +
+ "\aSKIPPED\x10\a\"{\n" +
"\x04Type\x12\x14\n" +
"\x10TYPE_UNSPECIFIED\x10\x00\x12\v\n" +
"\aGENERAL\x10\x01\x12\x13\n" +
- "\x0fDATABASE_CREATE\x10\x02\x12\x1a\n" +
- "\x16DATABASE_SCHEMA_UPDATE\x10\x04\x12\x1e\n" +
- "\x1aDATABASE_SCHEMA_UPDATE_SDL\x10\x05\x12 \n" +
- "\x1cDATABASE_SCHEMA_UPDATE_GHOST\x10\t\x12\x18\n" +
- "\x14DATABASE_DATA_UPDATE\x10\b\x12\x13\n" +
- "\x0fDATABASE_EXPORT\x10\f:Y\xeaAV\n" +
+ "\x0fDATABASE_CREATE\x10\x02\x12\x14\n" +
+ "\x10DATABASE_MIGRATE\x10\x03\x12\x10\n" +
+ "\fDATABASE_SDL\x10\x06\x12\x13\n" +
+ "\x0fDATABASE_EXPORT\x10\x05:Y\xeaAV\n" +
"\x11bytebase.com/Task\x12Aprojects/{project}/rollouts/{rollout}/stages/{stage}/tasks/{task}B\t\n" +
"\apayloadB\x0e\n" +
"\f_update_timeB\v\n" +
@@ -3957,8 +3966,10 @@ var file_v1_rollout_service_proto_goTypes = []any{
(*TaskRunSession_Postgres_Session)(nil), // 51: bytebase.v1.TaskRunSession.Postgres.Session
(*timestamppb.Timestamp)(nil), // 52: google.protobuf.Timestamp
(*Plan)(nil), // 53: bytebase.v1.Plan
- (ExportFormat)(0), // 54: bytebase.v1.ExportFormat
- (*Position)(nil), // 55: bytebase.v1.Position
+ (DatabaseChangeType)(0), // 54: bytebase.v1.DatabaseChangeType
+ (MigrationType)(0), // 55: bytebase.v1.MigrationType
+ (ExportFormat)(0), // 56: bytebase.v1.ExportFormat
+ (*Position)(nil), // 57: bytebase.v1.Position
}
var file_v1_rollout_service_proto_depIdxs = []int32{
52, // 0: bytebase.v1.BatchRunTasksRequest.run_time:type_name -> google.protobuf.Timestamp
@@ -3997,64 +4008,66 @@ var file_v1_rollout_service_proto_depIdxs = []int32{
47, // 33: bytebase.v1.TaskRunLogEntry.retry_info:type_name -> bytebase.v1.TaskRunLogEntry.RetryInfo
48, // 34: bytebase.v1.TaskRunLogEntry.compute_diff:type_name -> bytebase.v1.TaskRunLogEntry.ComputeDiff
50, // 35: bytebase.v1.TaskRunSession.postgres:type_name -> bytebase.v1.TaskRunSession.Postgres
- 54, // 36: bytebase.v1.Task.DatabaseDataExport.format:type_name -> bytebase.v1.ExportFormat
- 37, // 37: bytebase.v1.TaskRun.PriorBackupDetail.items:type_name -> bytebase.v1.TaskRun.PriorBackupDetail.Item
- 52, // 38: bytebase.v1.TaskRun.SchedulerInfo.report_time:type_name -> google.protobuf.Timestamp
- 39, // 39: bytebase.v1.TaskRun.SchedulerInfo.waiting_cause:type_name -> bytebase.v1.TaskRun.SchedulerInfo.WaitingCause
- 38, // 40: bytebase.v1.TaskRun.PriorBackupDetail.Item.source_table:type_name -> bytebase.v1.TaskRun.PriorBackupDetail.Item.Table
- 38, // 41: bytebase.v1.TaskRun.PriorBackupDetail.Item.target_table:type_name -> bytebase.v1.TaskRun.PriorBackupDetail.Item.Table
- 55, // 42: bytebase.v1.TaskRun.PriorBackupDetail.Item.start_position:type_name -> bytebase.v1.Position
- 55, // 43: bytebase.v1.TaskRun.PriorBackupDetail.Item.end_position:type_name -> bytebase.v1.Position
- 40, // 44: bytebase.v1.TaskRun.SchedulerInfo.WaitingCause.task:type_name -> bytebase.v1.TaskRun.SchedulerInfo.WaitingCause.Task
- 52, // 45: bytebase.v1.TaskRunLogEntry.SchemaDump.start_time:type_name -> google.protobuf.Timestamp
- 52, // 46: bytebase.v1.TaskRunLogEntry.SchemaDump.end_time:type_name -> google.protobuf.Timestamp
- 52, // 47: bytebase.v1.TaskRunLogEntry.CommandExecute.log_time:type_name -> google.protobuf.Timestamp
- 49, // 48: bytebase.v1.TaskRunLogEntry.CommandExecute.response:type_name -> bytebase.v1.TaskRunLogEntry.CommandExecute.CommandResponse
- 52, // 49: bytebase.v1.TaskRunLogEntry.DatabaseSync.start_time:type_name -> google.protobuf.Timestamp
- 52, // 50: bytebase.v1.TaskRunLogEntry.DatabaseSync.end_time:type_name -> google.protobuf.Timestamp
- 5, // 51: bytebase.v1.TaskRunLogEntry.TaskRunStatusUpdate.status:type_name -> bytebase.v1.TaskRunLogEntry.TaskRunStatusUpdate.Status
- 6, // 52: bytebase.v1.TaskRunLogEntry.TransactionControl.type:type_name -> bytebase.v1.TaskRunLogEntry.TransactionControl.Type
- 52, // 53: bytebase.v1.TaskRunLogEntry.PriorBackup.start_time:type_name -> google.protobuf.Timestamp
- 52, // 54: bytebase.v1.TaskRunLogEntry.PriorBackup.end_time:type_name -> google.protobuf.Timestamp
- 35, // 55: bytebase.v1.TaskRunLogEntry.PriorBackup.prior_backup_detail:type_name -> bytebase.v1.TaskRun.PriorBackupDetail
- 52, // 56: bytebase.v1.TaskRunLogEntry.ComputeDiff.start_time:type_name -> google.protobuf.Timestamp
- 52, // 57: bytebase.v1.TaskRunLogEntry.ComputeDiff.end_time:type_name -> google.protobuf.Timestamp
- 52, // 58: bytebase.v1.TaskRunLogEntry.CommandExecute.CommandResponse.log_time:type_name -> google.protobuf.Timestamp
- 51, // 59: bytebase.v1.TaskRunSession.Postgres.session:type_name -> bytebase.v1.TaskRunSession.Postgres.Session
- 51, // 60: bytebase.v1.TaskRunSession.Postgres.blocking_sessions:type_name -> bytebase.v1.TaskRunSession.Postgres.Session
- 51, // 61: bytebase.v1.TaskRunSession.Postgres.blocked_sessions:type_name -> bytebase.v1.TaskRunSession.Postgres.Session
- 52, // 62: bytebase.v1.TaskRunSession.Postgres.Session.backend_start:type_name -> google.protobuf.Timestamp
- 52, // 63: bytebase.v1.TaskRunSession.Postgres.Session.xact_start:type_name -> google.protobuf.Timestamp
- 52, // 64: bytebase.v1.TaskRunSession.Postgres.Session.query_start:type_name -> google.protobuf.Timestamp
- 13, // 65: bytebase.v1.RolloutService.GetRollout:input_type -> bytebase.v1.GetRolloutRequest
- 14, // 66: bytebase.v1.RolloutService.ListRollouts:input_type -> bytebase.v1.ListRolloutsRequest
- 16, // 67: bytebase.v1.RolloutService.CreateRollout:input_type -> bytebase.v1.CreateRolloutRequest
- 17, // 68: bytebase.v1.RolloutService.PreviewRollout:input_type -> bytebase.v1.PreviewRolloutRequest
- 18, // 69: bytebase.v1.RolloutService.ListTaskRuns:input_type -> bytebase.v1.ListTaskRunsRequest
- 20, // 70: bytebase.v1.RolloutService.GetTaskRun:input_type -> bytebase.v1.GetTaskRunRequest
- 21, // 71: bytebase.v1.RolloutService.GetTaskRunLog:input_type -> bytebase.v1.GetTaskRunLogRequest
- 28, // 72: bytebase.v1.RolloutService.GetTaskRunSession:input_type -> bytebase.v1.GetTaskRunSessionRequest
- 7, // 73: bytebase.v1.RolloutService.BatchRunTasks:input_type -> bytebase.v1.BatchRunTasksRequest
- 9, // 74: bytebase.v1.RolloutService.BatchSkipTasks:input_type -> bytebase.v1.BatchSkipTasksRequest
- 11, // 75: bytebase.v1.RolloutService.BatchCancelTaskRuns:input_type -> bytebase.v1.BatchCancelTaskRunsRequest
- 30, // 76: bytebase.v1.RolloutService.PreviewTaskRunRollback:input_type -> bytebase.v1.PreviewTaskRunRollbackRequest
- 22, // 77: bytebase.v1.RolloutService.GetRollout:output_type -> bytebase.v1.Rollout
- 15, // 78: bytebase.v1.RolloutService.ListRollouts:output_type -> bytebase.v1.ListRolloutsResponse
- 22, // 79: bytebase.v1.RolloutService.CreateRollout:output_type -> bytebase.v1.Rollout
- 22, // 80: bytebase.v1.RolloutService.PreviewRollout:output_type -> bytebase.v1.Rollout
- 19, // 81: bytebase.v1.RolloutService.ListTaskRuns:output_type -> bytebase.v1.ListTaskRunsResponse
- 25, // 82: bytebase.v1.RolloutService.GetTaskRun:output_type -> bytebase.v1.TaskRun
- 26, // 83: bytebase.v1.RolloutService.GetTaskRunLog:output_type -> bytebase.v1.TaskRunLog
- 29, // 84: bytebase.v1.RolloutService.GetTaskRunSession:output_type -> bytebase.v1.TaskRunSession
- 8, // 85: bytebase.v1.RolloutService.BatchRunTasks:output_type -> bytebase.v1.BatchRunTasksResponse
- 10, // 86: bytebase.v1.RolloutService.BatchSkipTasks:output_type -> bytebase.v1.BatchSkipTasksResponse
- 12, // 87: bytebase.v1.RolloutService.BatchCancelTaskRuns:output_type -> bytebase.v1.BatchCancelTaskRunsResponse
- 31, // 88: bytebase.v1.RolloutService.PreviewTaskRunRollback:output_type -> bytebase.v1.PreviewTaskRunRollbackResponse
- 77, // [77:89] is the sub-list for method output_type
- 65, // [65:77] is the sub-list for method input_type
- 65, // [65:65] is the sub-list for extension type_name
- 65, // [65:65] is the sub-list for extension extendee
- 0, // [0:65] is the sub-list for field type_name
+ 54, // 36: bytebase.v1.Task.DatabaseUpdate.database_change_type:type_name -> bytebase.v1.DatabaseChangeType
+ 55, // 37: bytebase.v1.Task.DatabaseUpdate.migration_type:type_name -> bytebase.v1.MigrationType
+ 56, // 38: bytebase.v1.Task.DatabaseDataExport.format:type_name -> bytebase.v1.ExportFormat
+ 37, // 39: bytebase.v1.TaskRun.PriorBackupDetail.items:type_name -> bytebase.v1.TaskRun.PriorBackupDetail.Item
+ 52, // 40: bytebase.v1.TaskRun.SchedulerInfo.report_time:type_name -> google.protobuf.Timestamp
+ 39, // 41: bytebase.v1.TaskRun.SchedulerInfo.waiting_cause:type_name -> bytebase.v1.TaskRun.SchedulerInfo.WaitingCause
+ 38, // 42: bytebase.v1.TaskRun.PriorBackupDetail.Item.source_table:type_name -> bytebase.v1.TaskRun.PriorBackupDetail.Item.Table
+ 38, // 43: bytebase.v1.TaskRun.PriorBackupDetail.Item.target_table:type_name -> bytebase.v1.TaskRun.PriorBackupDetail.Item.Table
+ 57, // 44: bytebase.v1.TaskRun.PriorBackupDetail.Item.start_position:type_name -> bytebase.v1.Position
+ 57, // 45: bytebase.v1.TaskRun.PriorBackupDetail.Item.end_position:type_name -> bytebase.v1.Position
+ 40, // 46: bytebase.v1.TaskRun.SchedulerInfo.WaitingCause.task:type_name -> bytebase.v1.TaskRun.SchedulerInfo.WaitingCause.Task
+ 52, // 47: bytebase.v1.TaskRunLogEntry.SchemaDump.start_time:type_name -> google.protobuf.Timestamp
+ 52, // 48: bytebase.v1.TaskRunLogEntry.SchemaDump.end_time:type_name -> google.protobuf.Timestamp
+ 52, // 49: bytebase.v1.TaskRunLogEntry.CommandExecute.log_time:type_name -> google.protobuf.Timestamp
+ 49, // 50: bytebase.v1.TaskRunLogEntry.CommandExecute.response:type_name -> bytebase.v1.TaskRunLogEntry.CommandExecute.CommandResponse
+ 52, // 51: bytebase.v1.TaskRunLogEntry.DatabaseSync.start_time:type_name -> google.protobuf.Timestamp
+ 52, // 52: bytebase.v1.TaskRunLogEntry.DatabaseSync.end_time:type_name -> google.protobuf.Timestamp
+ 5, // 53: bytebase.v1.TaskRunLogEntry.TaskRunStatusUpdate.status:type_name -> bytebase.v1.TaskRunLogEntry.TaskRunStatusUpdate.Status
+ 6, // 54: bytebase.v1.TaskRunLogEntry.TransactionControl.type:type_name -> bytebase.v1.TaskRunLogEntry.TransactionControl.Type
+ 52, // 55: bytebase.v1.TaskRunLogEntry.PriorBackup.start_time:type_name -> google.protobuf.Timestamp
+ 52, // 56: bytebase.v1.TaskRunLogEntry.PriorBackup.end_time:type_name -> google.protobuf.Timestamp
+ 35, // 57: bytebase.v1.TaskRunLogEntry.PriorBackup.prior_backup_detail:type_name -> bytebase.v1.TaskRun.PriorBackupDetail
+ 52, // 58: bytebase.v1.TaskRunLogEntry.ComputeDiff.start_time:type_name -> google.protobuf.Timestamp
+ 52, // 59: bytebase.v1.TaskRunLogEntry.ComputeDiff.end_time:type_name -> google.protobuf.Timestamp
+ 52, // 60: bytebase.v1.TaskRunLogEntry.CommandExecute.CommandResponse.log_time:type_name -> google.protobuf.Timestamp
+ 51, // 61: bytebase.v1.TaskRunSession.Postgres.session:type_name -> bytebase.v1.TaskRunSession.Postgres.Session
+ 51, // 62: bytebase.v1.TaskRunSession.Postgres.blocking_sessions:type_name -> bytebase.v1.TaskRunSession.Postgres.Session
+ 51, // 63: bytebase.v1.TaskRunSession.Postgres.blocked_sessions:type_name -> bytebase.v1.TaskRunSession.Postgres.Session
+ 52, // 64: bytebase.v1.TaskRunSession.Postgres.Session.backend_start:type_name -> google.protobuf.Timestamp
+ 52, // 65: bytebase.v1.TaskRunSession.Postgres.Session.xact_start:type_name -> google.protobuf.Timestamp
+ 52, // 66: bytebase.v1.TaskRunSession.Postgres.Session.query_start:type_name -> google.protobuf.Timestamp
+ 13, // 67: bytebase.v1.RolloutService.GetRollout:input_type -> bytebase.v1.GetRolloutRequest
+ 14, // 68: bytebase.v1.RolloutService.ListRollouts:input_type -> bytebase.v1.ListRolloutsRequest
+ 16, // 69: bytebase.v1.RolloutService.CreateRollout:input_type -> bytebase.v1.CreateRolloutRequest
+ 17, // 70: bytebase.v1.RolloutService.PreviewRollout:input_type -> bytebase.v1.PreviewRolloutRequest
+ 18, // 71: bytebase.v1.RolloutService.ListTaskRuns:input_type -> bytebase.v1.ListTaskRunsRequest
+ 20, // 72: bytebase.v1.RolloutService.GetTaskRun:input_type -> bytebase.v1.GetTaskRunRequest
+ 21, // 73: bytebase.v1.RolloutService.GetTaskRunLog:input_type -> bytebase.v1.GetTaskRunLogRequest
+ 28, // 74: bytebase.v1.RolloutService.GetTaskRunSession:input_type -> bytebase.v1.GetTaskRunSessionRequest
+ 7, // 75: bytebase.v1.RolloutService.BatchRunTasks:input_type -> bytebase.v1.BatchRunTasksRequest
+ 9, // 76: bytebase.v1.RolloutService.BatchSkipTasks:input_type -> bytebase.v1.BatchSkipTasksRequest
+ 11, // 77: bytebase.v1.RolloutService.BatchCancelTaskRuns:input_type -> bytebase.v1.BatchCancelTaskRunsRequest
+ 30, // 78: bytebase.v1.RolloutService.PreviewTaskRunRollback:input_type -> bytebase.v1.PreviewTaskRunRollbackRequest
+ 22, // 79: bytebase.v1.RolloutService.GetRollout:output_type -> bytebase.v1.Rollout
+ 15, // 80: bytebase.v1.RolloutService.ListRollouts:output_type -> bytebase.v1.ListRolloutsResponse
+ 22, // 81: bytebase.v1.RolloutService.CreateRollout:output_type -> bytebase.v1.Rollout
+ 22, // 82: bytebase.v1.RolloutService.PreviewRollout:output_type -> bytebase.v1.Rollout
+ 19, // 83: bytebase.v1.RolloutService.ListTaskRuns:output_type -> bytebase.v1.ListTaskRunsResponse
+ 25, // 84: bytebase.v1.RolloutService.GetTaskRun:output_type -> bytebase.v1.TaskRun
+ 26, // 85: bytebase.v1.RolloutService.GetTaskRunLog:output_type -> bytebase.v1.TaskRunLog
+ 29, // 86: bytebase.v1.RolloutService.GetTaskRunSession:output_type -> bytebase.v1.TaskRunSession
+ 8, // 87: bytebase.v1.RolloutService.BatchRunTasks:output_type -> bytebase.v1.BatchRunTasksResponse
+ 10, // 88: bytebase.v1.RolloutService.BatchSkipTasks:output_type -> bytebase.v1.BatchSkipTasksResponse
+ 12, // 89: bytebase.v1.RolloutService.BatchCancelTaskRuns:output_type -> bytebase.v1.BatchCancelTaskRunsResponse
+ 31, // 90: bytebase.v1.RolloutService.PreviewTaskRunRollback:output_type -> bytebase.v1.PreviewTaskRunRollbackResponse
+ 79, // [79:91] is the sub-list for method output_type
+ 67, // [67:79] is the sub-list for method input_type
+ 67, // [67:67] is the sub-list for extension type_name
+ 67, // [67:67] is the sub-list for extension extendee
+ 0, // [0:67] is the sub-list for field type_name
}
func init() { file_v1_rollout_service_proto_init() }
diff --git a/backend/generated-go/v1/rollout_service_equal.pb.go b/backend/generated-go/v1/rollout_service_equal.pb.go
index 6973ccd555..593f81c82f 100644
--- a/backend/generated-go/v1/rollout_service_equal.pb.go
+++ b/backend/generated-go/v1/rollout_service_equal.pb.go
@@ -378,6 +378,12 @@ func (x *Task_DatabaseUpdate) Equal(y *Task_DatabaseUpdate) bool {
if x.SchemaVersion != y.SchemaVersion {
return false
}
+ if x.DatabaseChangeType != y.DatabaseChangeType {
+ return false
+ }
+ if x.MigrationType != y.MigrationType {
+ return false
+ }
return true
}
diff --git a/backend/migrator/migration/3.11/0001##migrate_task_type.sql b/backend/migrator/migration/3.11/0001##migrate_task_type.sql
new file mode 100644
index 0000000000..e8a584ef67
--- /dev/null
+++ b/backend/migrator/migration/3.11/0001##migrate_task_type.sql
@@ -0,0 +1,28 @@
+-- Migrate task types to consolidate DATABASE_SCHEMA_UPDATE, DATABASE_SCHEMA_UPDATE_GHOST,
+-- DATABASE_DATA_UPDATE into DATABASE_MIGRATE with migrateType field
+-- DATABASE_SCHEMA_UPDATE_SDL becomes DATABASE_SDL
+
+-- Migrate DATABASE_SCHEMA_UPDATE to DATABASE_MIGRATE with migrateType=DDL
+UPDATE task
+SET payload = payload || jsonb_build_object('migrateType', 'DDL')
+WHERE type = 'DATABASE_SCHEMA_UPDATE';
+
+-- Migrate DATABASE_SCHEMA_UPDATE_GHOST to DATABASE_MIGRATE with migrateType=GHOST
+UPDATE task
+SET payload = payload || jsonb_build_object('migrateType', 'GHOST')
+WHERE type = 'DATABASE_SCHEMA_UPDATE_GHOST';
+
+-- Migrate DATABASE_DATA_UPDATE to DATABASE_MIGRATE with migrateType=DML
+UPDATE task
+SET payload = payload || jsonb_build_object('migrateType', 'DML')
+WHERE type = 'DATABASE_DATA_UPDATE';
+
+-- Update task type values
+UPDATE task
+SET type = 'DATABASE_MIGRATE'
+WHERE type IN ('DATABASE_SCHEMA_UPDATE', 'DATABASE_SCHEMA_UPDATE_GHOST', 'DATABASE_DATA_UPDATE');
+
+-- Rename DATABASE_SCHEMA_UPDATE_SDL to DATABASE_SDL
+UPDATE task
+SET type = 'DATABASE_SDL'
+WHERE type = 'DATABASE_SCHEMA_UPDATE_SDL';
diff --git a/backend/migrator/migration/3.11/0002##refactor_plan_config.sql b/backend/migrator/migration/3.11/0002##refactor_plan_config.sql
new file mode 100644
index 0000000000..e4a4b3d82c
--- /dev/null
+++ b/backend/migrator/migration/3.11/0002##refactor_plan_config.sql
@@ -0,0 +1,39 @@
+-- Refactor plan config to use migrate_type.
+DO $$
+DECLARE
+ plan_record RECORD;
+ spec JSONB;
+ new_specs JSONB[] := '{}';
+ new_spec JSONB;
+ change_config JSONB;
+ old_type TEXT;
+ i INT;
+BEGIN
+ FOR plan_record IN SELECT id, config FROM plan LOOP
+ new_specs := '{}';
+ i := 0;
+ FOR spec IN SELECT * FROM jsonb_array_elements(plan_record.config->'specs') LOOP
+ i := i + 1;
+ new_spec := spec;
+ IF new_spec ? 'changeDatabaseConfig' THEN
+ change_config := new_spec->'changeDatabaseConfig';
+ old_type := change_config->>'type';
+
+ IF old_type = 'MIGRATE' THEN
+ change_config := jsonb_set(change_config, '{migrateType}', '"DDL"');
+ ELSIF old_type = 'MIGRATE_GHOST' THEN
+ change_config := jsonb_set(change_config, '{type}', '"MIGRATE"');
+ change_config := jsonb_set(change_config, '{migrateType}', '"GHOST"');
+ ELSIF old_type = 'DATA' THEN
+ change_config := jsonb_set(change_config, '{type}', '"MIGRATE"');
+ change_config := jsonb_set(change_config, '{migrateType}', '"DML"');
+ ELSIF old_type = 'MIGRATE_SDL' THEN
+ change_config := jsonb_set(change_config, '{type}', '"SDL"');
+ END IF;
+ new_spec := jsonb_set(new_spec, '{changeDatabaseConfig}', change_config);
+ END IF;
+ new_specs := array_append(new_specs, new_spec);
+ END LOOP;
+ UPDATE plan SET config = jsonb_set(plan_record.config, '{specs}', to_jsonb(new_specs)) WHERE id = plan_record.id;
+ END LOOP;
+END $$;
diff --git a/backend/migrator/migrator_test.go b/backend/migrator/migrator_test.go
index 596b2978ee..d114459a91 100644
--- a/backend/migrator/migrator_test.go
+++ b/backend/migrator/migrator_test.go
@@ -12,7 +12,7 @@ import (
func TestLatestVersion(t *testing.T) {
files, err := getSortedVersionedFiles()
require.NoError(t, err)
- require.Equal(t, semver.MustParse("3.11.0"), *files[len(files)-1].version)
+ require.Equal(t, semver.MustParse("3.11.2"), *files[len(files)-1].version)
}
func TestVersionUnique(t *testing.T) {
diff --git a/backend/runner/approval/runner.go b/backend/runner/approval/runner.go
index dcb533989a..48eb162c71 100644
--- a/backend/runner/approval/runner.go
+++ b/backend/runner/approval/runner.go
@@ -766,10 +766,16 @@ func getRiskSourceFromPlan(config *storepb.PlanConfig) store.RiskSource {
return store.RiskSourceDatabaseCreate
case *storepb.PlanConfig_Spec_ChangeDatabaseConfig:
switch v.ChangeDatabaseConfig.Type {
- case storepb.PlanConfig_ChangeDatabaseConfig_MIGRATE, storepb.PlanConfig_ChangeDatabaseConfig_MIGRATE_GHOST, storepb.PlanConfig_ChangeDatabaseConfig_MIGRATE_SDL:
+ case storepb.PlanConfig_ChangeDatabaseConfig_MIGRATE:
+ // For MIGRATE type, check the migrate type
+ switch v.ChangeDatabaseConfig.MigrateType {
+ case storepb.PlanConfig_ChangeDatabaseConfig_DML:
+ return store.RiskSourceDatabaseDataUpdate
+ default:
+ return store.RiskSourceDatabaseSchemaUpdate
+ }
+ case storepb.PlanConfig_ChangeDatabaseConfig_SDL:
return store.RiskSourceDatabaseSchemaUpdate
- case storepb.PlanConfig_ChangeDatabaseConfig_DATA:
- return store.RiskSourceDatabaseDataUpdate
default:
return store.RiskSourceDatabaseSchemaUpdate
}
diff --git a/backend/runner/taskrun/data_update_executor.go b/backend/runner/taskrun/database_migrate_executor.go
similarity index 73%
rename from backend/runner/taskrun/data_update_executor.go
rename to backend/runner/taskrun/database_migrate_executor.go
index fabfd6479c..b9f782b594 100644
--- a/backend/runner/taskrun/data_update_executor.go
+++ b/backend/runner/taskrun/database_migrate_executor.go
@@ -9,12 +9,15 @@ import (
"github.com/antlr4-go/antlr/v4"
"github.com/bytebase/parser/postgresql"
+ "github.com/github/gh-ost/go/logic"
+ gomysql "github.com/go-sql-driver/mysql"
"github.com/pkg/errors"
"github.com/bytebase/bytebase/backend/common"
"github.com/bytebase/bytebase/backend/common/log"
"github.com/bytebase/bytebase/backend/component/config"
"github.com/bytebase/bytebase/backend/component/dbfactory"
+ "github.com/bytebase/bytebase/backend/component/ghost"
"github.com/bytebase/bytebase/backend/component/state"
"github.com/bytebase/bytebase/backend/enterprise"
storepb "github.com/bytebase/bytebase/backend/generated-go/store"
@@ -25,11 +28,12 @@ import (
"github.com/bytebase/bytebase/backend/runner/schemasync"
"github.com/bytebase/bytebase/backend/store"
"github.com/bytebase/bytebase/backend/store/model"
+ "github.com/bytebase/bytebase/backend/utils"
)
-// NewDataUpdateExecutor creates a data update (DML) task executor.
-func NewDataUpdateExecutor(store *store.Store, dbFactory *dbfactory.DBFactory, license *enterprise.LicenseService, stateCfg *state.State, schemaSyncer *schemasync.Syncer, profile *config.Profile) Executor {
- return &DataUpdateExecutor{
+// NewDatabaseMigrateExecutor creates a database migration task executor.
+func NewDatabaseMigrateExecutor(store *store.Store, dbFactory *dbfactory.DBFactory, license *enterprise.LicenseService, stateCfg *state.State, schemaSyncer *schemasync.Syncer, profile *config.Profile) Executor {
+ return &DatabaseMigrateExecutor{
store: store,
dbFactory: dbFactory,
license: license,
@@ -39,8 +43,8 @@ func NewDataUpdateExecutor(store *store.Store, dbFactory *dbfactory.DBFactory, l
}
}
-// DataUpdateExecutor is the data update (DML) task executor.
-type DataUpdateExecutor struct {
+// DatabaseMigrateExecutor is the database migration task executor.
+type DatabaseMigrateExecutor struct {
store *store.Store
dbFactory *dbfactory.DBFactory
license *enterprise.LicenseService
@@ -49,8 +53,36 @@ type DataUpdateExecutor struct {
profile *config.Profile
}
-// RunOnce will run the data update (DML) task executor once.
-func (exec *DataUpdateExecutor) RunOnce(ctx context.Context, driverCtx context.Context, task *store.TaskMessage, taskRunUID int) (bool, *storepb.TaskRunResult, error) {
+// RunOnce will run the database migration task executor once.
+func (exec *DatabaseMigrateExecutor) RunOnce(ctx context.Context, driverCtx context.Context, task *store.TaskMessage, taskRunUID int) (bool, *storepb.TaskRunResult, error) {
+ migrateType := task.Payload.GetMigrateType()
+
+ //exhaustive:enforce
+ switch migrateType {
+ case storepb.Task_DDL:
+ return exec.runDDLMigration(ctx, driverCtx, task, taskRunUID)
+ case storepb.Task_DML:
+ return exec.runDMLMigration(ctx, driverCtx, task, taskRunUID)
+ case storepb.Task_GHOST:
+ return exec.runGhostMigration(ctx, driverCtx, task, taskRunUID)
+ case storepb.Task_MIGRATE_TYPE_UNSPECIFIED:
+ return true, nil, errors.Errorf("migrate type is unspecified")
+ default:
+ return true, nil, errors.Errorf("unsupported migrate type: %v", migrateType)
+ }
+}
+
+func (exec *DatabaseMigrateExecutor) runDDLMigration(ctx context.Context, driverCtx context.Context, task *store.TaskMessage, taskRunUID int) (bool, *storepb.TaskRunResult, error) {
+ sheetID := int(task.Payload.GetSheetId())
+ statement, err := exec.store.GetSheetStatementByID(ctx, sheetID)
+ if err != nil {
+ return true, nil, err
+ }
+
+ return runMigration(ctx, driverCtx, exec.store, exec.dbFactory, exec.stateCfg, exec.schemaSyncer, exec.profile, task, taskRunUID, statement, task.Payload.GetSchemaVersion(), &sheetID)
+}
+
+func (exec *DatabaseMigrateExecutor) runDMLMigration(ctx context.Context, driverCtx context.Context, task *store.TaskMessage, taskRunUID int) (bool, *storepb.TaskRunResult, error) {
sheetID := int(task.Payload.GetSheetId())
statement, err := exec.store.GetSheetStatementByID(ctx, sheetID)
if err != nil {
@@ -135,7 +167,107 @@ func (exec *DataUpdateExecutor) RunOnce(ctx context.Context, driverCtx context.C
return terminated, result, err
}
-func (exec *DataUpdateExecutor) shouldSkipBackupError(ctx context.Context, task *store.TaskMessage) (bool, error) {
+func (exec *DatabaseMigrateExecutor) runGhostMigration(ctx context.Context, driverCtx context.Context, task *store.TaskMessage, taskRunUID int) (bool, *storepb.TaskRunResult, error) {
+ sheetID := int(task.Payload.GetSheetId())
+ statement, err := exec.store.GetSheetStatementByID(ctx, sheetID)
+ if err != nil {
+ return true, nil, err
+ }
+ flags := task.Payload.GetFlags()
+
+ instance, err := exec.store.GetInstanceV2(ctx, &store.FindInstanceMessage{ResourceID: &task.InstanceID})
+ if err != nil {
+ return true, nil, err
+ }
+ if instance == nil {
+ return true, nil, errors.Errorf("instance %s not found", task.InstanceID)
+ }
+ database, err := exec.store.GetDatabaseV2(ctx, &store.FindDatabaseMessage{InstanceID: &task.InstanceID, DatabaseName: task.DatabaseName})
+ if err != nil {
+ return true, nil, err
+ }
+ if database == nil {
+ return true, nil, errors.Errorf("database not found")
+ }
+
+ execFunc := func(execCtx context.Context, execStatement string, driver db.Driver, _ db.ExecuteOptions) error {
+ // set buffer size to 1 to unblock the sender because there is no listener if the task is canceled.
+ migrationError := make(chan error, 1)
+
+ statement := strings.TrimSpace(execStatement)
+ // Trim trailing semicolons.
+ statement = strings.TrimRight(statement, ";")
+
+ tableName, err := ghost.GetTableNameFromStatement(statement)
+ if err != nil {
+ return err
+ }
+
+ adminDataSource := utils.DataSourceFromInstanceWithType(instance, storepb.DataSourceType_ADMIN)
+ if adminDataSource == nil {
+ return common.Errorf(common.Internal, "admin data source not found for instance %s", instance.ResourceID)
+ }
+
+ migrationContext, err := ghost.NewMigrationContext(ctx, task.ID, database, adminDataSource, tableName, fmt.Sprintf("_%d", time.Now().Unix()), execStatement, false, flags, 10000000)
+ if err != nil {
+ return errors.Wrap(err, "failed to init migrationContext for gh-ost")
+ }
+ defer func() {
+ // Use migrationContext.Uuid as the tls_config_key by convention.
+ // We need to deregister it when gh-ost exits.
+ // https://github.com/bytebase/gh-ost2/pull/4
+ gomysql.DeregisterTLSConfig(migrationContext.Uuid)
+ }()
+
+ migrator := logic.NewMigrator(migrationContext, "bb")
+
+ defer func() {
+ if err := func() error {
+ ctx := context.Background()
+
+ // Use the backup database name of MySQL as the ghost database name.
+ ghostDBName := common.BackupDatabaseNameOfEngine(storepb.Engine_MYSQL)
+ sql := fmt.Sprintf("DROP TABLE IF EXISTS `%s`.`%s`; DROP TABLE IF EXISTS `%s`.`%s`;",
+ ghostDBName,
+ migrationContext.GetGhostTableName(),
+ ghostDBName,
+ migrationContext.GetChangelogTableName(),
+ )
+
+ if _, err := driver.GetDB().ExecContext(ctx, sql); err != nil {
+ return errors.Wrapf(err, "failed to drop gh-ost temp tables")
+ }
+ return nil
+ }(); err != nil {
+ slog.Warn("failed to cleanup gh-ost temp tables", log.BBError(err))
+ }
+ }()
+
+ go func() {
+ if err := migrator.Migrate(); err != nil {
+ slog.Error("failed to run gh-ost migration", log.BBError(err))
+ migrationError <- err
+ return
+ }
+ migrationError <- nil
+ }()
+
+ select {
+ case err := <-migrationError:
+ if err != nil {
+ return err
+ }
+ return nil
+ case <-execCtx.Done():
+ migrationContext.PanicAbort <- errors.New("task canceled")
+ return errors.New("task canceled")
+ }
+ }
+
+ return runMigrationWithFunc(ctx, driverCtx, exec.store, exec.dbFactory, exec.stateCfg, exec.schemaSyncer, exec.profile, task, taskRunUID, statement, task.Payload.GetSchemaVersion(), &sheetID, execFunc)
+}
+
+func (exec *DatabaseMigrateExecutor) shouldSkipBackupError(ctx context.Context, task *store.TaskMessage) (bool, error) {
pipeline, pipelineErr := exec.store.GetPipelineV2ByID(ctx, task.PipelineID)
if pipelineErr != nil {
return false, errors.Wrapf(pipelineErr, "failed to get pipeline %v", task.PipelineID)
@@ -153,7 +285,7 @@ func (exec *DataUpdateExecutor) shouldSkipBackupError(ctx context.Context, task
return project.Setting.SkipBackupErrors, nil
}
-func (exec *DataUpdateExecutor) backupData(
+func (exec *DatabaseMigrateExecutor) backupData(
ctx context.Context,
driverCtx context.Context,
originStatement string,
@@ -208,8 +340,8 @@ func (exec *DataUpdateExecutor) backupData(
tc := parserbase.TransformContext{
InstanceID: instance.ResourceID,
- GetDatabaseMetadataFunc: BuildGetDatabaseMetadataFunc(exec.store),
- ListDatabaseNamesFunc: BuildListDatabaseNamesFunc(exec.store),
+ GetDatabaseMetadataFunc: buildGetDatabaseMetadataFunc(exec.store),
+ ListDatabaseNamesFunc: buildListDatabaseNamesFunc(exec.store),
IsCaseSensitive: store.IsObjectCaseSensitive(instance),
DatabaseName: database.DatabaseName,
}
@@ -349,7 +481,7 @@ func (exec *DataUpdateExecutor) backupData(
return priorBackupDetail, nil
}
-func BuildGetDatabaseMetadataFunc(storeInstance *store.Store) parserbase.GetDatabaseMetadataFunc {
+func buildGetDatabaseMetadataFunc(storeInstance *store.Store) parserbase.GetDatabaseMetadataFunc {
return func(ctx context.Context, instanceID, databaseName string) (string, *model.DatabaseMetadata, error) {
database, err := storeInstance.GetDatabaseV2(ctx, &store.FindDatabaseMessage{
InstanceID: &instanceID,
@@ -375,7 +507,7 @@ func BuildGetDatabaseMetadataFunc(storeInstance *store.Store) parserbase.GetData
}
}
-func BuildListDatabaseNamesFunc(storeInstance *store.Store) parserbase.ListDatabaseNamesFunc {
+func buildListDatabaseNamesFunc(storeInstance *store.Store) parserbase.ListDatabaseNamesFunc {
return func(ctx context.Context, instanceID string) ([]string, error) {
databases, err := storeInstance.ListDatabases(ctx, &store.FindDatabaseMessage{
InstanceID: &instanceID,
diff --git a/backend/runner/taskrun/executor.go b/backend/runner/taskrun/executor.go
index 45c58085f3..60bfc9165e 100644
--- a/backend/runner/taskrun/executor.go
+++ b/backend/runner/taskrun/executor.go
@@ -184,11 +184,9 @@ func getMigrationInfo(ctx context.Context, stores *store.Store, profile *config.
storepb.Task_DATABASE_EXPORT,
storepb.Task_DATABASE_CREATE:
return nil, errors.Errorf("task type %s is unexpected", task.Type)
- case
- storepb.Task_DATABASE_DATA_UPDATE,
- storepb.Task_DATABASE_SCHEMA_UPDATE,
- storepb.Task_DATABASE_SCHEMA_UPDATE_GHOST,
- storepb.Task_DATABASE_SCHEMA_UPDATE_SDL:
+ case storepb.Task_DATABASE_MIGRATE,
+ storepb.Task_DATABASE_SDL:
+ // Valid type for migration context
default:
return nil, errors.Errorf("task type %s is unexpected", task.Type)
}
@@ -205,7 +203,7 @@ func getMigrationInfo(ctx context.Context, stores *store.Store, profile *config.
mc.sheetName = common.FormatSheet(pipeline.ProjectID, sheet.UID)
}
- if isChangeDatabaseTask(task.Type) {
+ if isChangeDatabaseTask(task) {
if f := task.Payload.GetTaskReleaseSource().GetFile(); f != "" {
project, release, _, err := common.GetProjectReleaseUIDFile(f)
if err != nil {
@@ -439,7 +437,7 @@ func beginMigration(ctx context.Context, stores *store.Store, mc *migrateContext
// however we can warn users not to unless they know
// what they are doing
if mc.version != "" {
- if mc.task.Type == storepb.Task_DATABASE_SCHEMA_UPDATE_SDL {
+ if mc.task.Type == storepb.Task_DATABASE_SDL {
// Declarative case
list, err := stores.ListRevisions(ctx, &store.FindRevisionMessage{
InstanceID: &mc.database.InstanceID,
@@ -486,7 +484,7 @@ func beginMigration(ctx context.Context, stores *store.Store, mc *migrateContext
// sync history
var syncHistoryPrevUID *int64
- if needDump(mc.task.Type, mc.instance) {
+ if needDump(mc.task, mc.instance) {
opts.LogDatabaseSyncStart()
syncHistoryPrev, err := mc.syncer.SyncDatabaseSchemaToHistory(ctx, mc.database)
if err != nil {
@@ -511,7 +509,7 @@ func beginMigration(ctx context.Context, stores *store.Store, mc *migrateContext
ChangedResources: mc.changeHistoryPayload.GetChangedResources(),
Sheet: mc.sheetName,
Version: mc.version,
- Type: convertTaskType(mc.task.Type),
+ Type: convertTaskType(mc.task),
GitCommit: mc.profile.GitCommit,
}})
if err != nil {
@@ -528,7 +526,7 @@ func endMigration(ctx context.Context, storeInstance *store.Store, mc *migrateCo
UID: mc.changelog,
}
- if needDump(mc.task.Type, mc.instance) {
+ if needDump(mc.task, mc.instance) {
opts.LogDatabaseSyncStart()
syncHistory, err := mc.syncer.SyncDatabaseSchemaToHistory(ctx, mc.database)
if err != nil {
@@ -555,7 +553,7 @@ func endMigration(ctx context.Context, storeInstance *store.Store, mc *migrateCo
Type: storepb.RevisionPayload_VERSIONED,
},
}
- if mc.task.Type == storepb.Task_DATABASE_SCHEMA_UPDATE_SDL {
+ if mc.task.Type == storepb.Task_DATABASE_SDL {
r.Payload.Type = storepb.RevisionPayload_DECLARATIVE
}
if mc.sheet != nil {
@@ -620,16 +618,22 @@ func shouldUpdateVersion(currentVersion, newVersion string) bool {
return current.LessThan(nv)
}
-func convertTaskType(t storepb.Task_Type) storepb.ChangelogPayload_Type {
+func convertTaskType(t *store.TaskMessage) storepb.ChangelogPayload_Type {
//exhaustive:enforce
- switch t {
- case storepb.Task_DATABASE_DATA_UPDATE:
- return storepb.ChangelogPayload_DATA
- case storepb.Task_DATABASE_SCHEMA_UPDATE:
- return storepb.ChangelogPayload_MIGRATE
- case storepb.Task_DATABASE_SCHEMA_UPDATE_GHOST:
- return storepb.ChangelogPayload_MIGRATE_GHOST
- case storepb.Task_DATABASE_SCHEMA_UPDATE_SDL:
+ switch t.Type {
+ case storepb.Task_DATABASE_MIGRATE:
+ // Determine changelog type based on migrate_type
+ switch t.Payload.GetMigrateType() {
+ case storepb.Task_DML:
+ return storepb.ChangelogPayload_DATA
+ case storepb.Task_DDL:
+ return storepb.ChangelogPayload_MIGRATE
+ case storepb.Task_GHOST:
+ return storepb.ChangelogPayload_MIGRATE_GHOST
+ default:
+ return storepb.ChangelogPayload_TYPE_UNSPECIFIED
+ }
+ case storepb.Task_DATABASE_SDL:
return storepb.ChangelogPayload_MIGRATE_SDL
case
storepb.Task_TASK_TYPE_UNSPECIFIED,
@@ -642,11 +646,12 @@ func convertTaskType(t storepb.Task_Type) storepb.ChangelogPayload_Type {
}
// isChangeDatabaseTask returns whether the task involves changing a database.
-func isChangeDatabaseTask(taskType storepb.Task_Type) bool {
- switch taskType {
- case storepb.Task_DATABASE_DATA_UPDATE,
- storepb.Task_DATABASE_SCHEMA_UPDATE,
- storepb.Task_DATABASE_SCHEMA_UPDATE_GHOST:
+func isChangeDatabaseTask(task *store.TaskMessage) bool {
+ switch task.Type {
+ case storepb.Task_DATABASE_MIGRATE:
+ // All DATABASE_MIGRATE tasks involve changing a database except possibly UNSPECIFIED
+ return task.Payload.GetMigrateType() != storepb.Task_MIGRATE_TYPE_UNSPECIFIED
+ case storepb.Task_DATABASE_SDL:
return true
case storepb.Task_DATABASE_CREATE,
storepb.Task_DATABASE_EXPORT:
@@ -656,20 +661,17 @@ func isChangeDatabaseTask(taskType storepb.Task_Type) bool {
}
}
-func needDump(taskType storepb.Task_Type, instance *store.InstanceMessage) bool {
+func needDump(task *store.TaskMessage, instance *store.InstanceMessage) bool {
// Skip dump for TiDB DML operations
- if taskType == storepb.Task_DATABASE_DATA_UPDATE && instance.Metadata.GetEngine() == storepb.Engine_TIDB {
+ if task.Type == storepb.Task_DATABASE_MIGRATE && task.Payload.GetMigrateType() == storepb.Task_DML && instance.Metadata.GetEngine() == storepb.Engine_TIDB {
return false
}
//exhaustive:enforce
- switch taskType {
- case
- storepb.Task_DATABASE_SCHEMA_UPDATE,
- storepb.Task_DATABASE_SCHEMA_UPDATE_SDL,
- storepb.Task_DATABASE_SCHEMA_UPDATE_GHOST,
- storepb.Task_DATABASE_CREATE,
- storepb.Task_DATABASE_DATA_UPDATE:
+ switch task.Type {
+ case storepb.Task_DATABASE_MIGRATE,
+ storepb.Task_DATABASE_SDL,
+ storepb.Task_DATABASE_CREATE:
return true
case
storepb.Task_TASK_TYPE_UNSPECIFIED,
diff --git a/backend/runner/taskrun/schedulerv2.go b/backend/runner/taskrun/schedulerv2.go
index 1d76bd98b9..2b4d62f1cb 100644
--- a/backend/runner/taskrun/schedulerv2.go
+++ b/backend/runner/taskrun/schedulerv2.go
@@ -369,7 +369,7 @@ func (s *SchedulerV2) scheduleRunningTaskRuns(ctx context.Context) error {
}
databaseKey := getDatabaseKey(task.InstanceID, *task.DatabaseName)
- if isSequentialTask(task.Type) {
+ if isSequentialTask(task) {
if _, ok := minTaskIDForDatabase[databaseKey]; !ok {
minTaskIDForDatabase[databaseKey] = task.ID
} else if minTaskIDForDatabase[databaseKey] > task.ID {
@@ -396,7 +396,7 @@ func (s *SchedulerV2) scheduleRunningTaskRun(ctx context.Context, taskRun *store
if err != nil {
return errors.Wrapf(err, "failed to get task")
}
- if task.DatabaseName != nil && isSequentialTask(task.Type) {
+ if task.DatabaseName != nil && isSequentialTask(task) {
// Skip the task run if there is an ongoing migration on the database.
if taskUIDAny, ok := s.stateCfg.RunningDatabaseMigration.Load(getDatabaseKey(task.InstanceID, *task.DatabaseName)); ok {
if taskUID, ok := taskUIDAny.(int); ok {
@@ -998,15 +998,23 @@ func tasksSkippedOrDone(tasks []*store.TaskMessage) bool {
}
// isSequentialTask returns whether the task should be executed sequentially.
-func isSequentialTask(taskType storepb.Task_Type) bool {
+func isSequentialTask(task *store.TaskMessage) bool {
//exhaustive:enforce
- switch taskType {
- case storepb.Task_DATABASE_SCHEMA_UPDATE,
- storepb.Task_DATABASE_SCHEMA_UPDATE_GHOST,
- storepb.Task_DATABASE_SCHEMA_UPDATE_SDL:
+ switch task.Type {
+ case storepb.Task_DATABASE_MIGRATE:
+ // DDL and GHOST operations should be sequential
+ switch task.Payload.GetMigrateType() {
+ case storepb.Task_DDL, storepb.Task_GHOST:
+ return true
+ case storepb.Task_DML:
+ return false
+ default:
+ return false
+ }
+ case storepb.Task_DATABASE_SDL:
+ // SDL operations should be sequential
return true
case storepb.Task_DATABASE_CREATE,
- storepb.Task_DATABASE_DATA_UPDATE,
storepb.Task_DATABASE_EXPORT:
return false
case storepb.Task_TASK_TYPE_UNSPECIFIED:
diff --git a/backend/runner/taskrun/schema_update_executor.go b/backend/runner/taskrun/schema_update_executor.go
deleted file mode 100644
index 24fcd7206f..0000000000
--- a/backend/runner/taskrun/schema_update_executor.go
+++ /dev/null
@@ -1,46 +0,0 @@
-package taskrun
-
-import (
- "context"
-
- "github.com/bytebase/bytebase/backend/component/config"
- "github.com/bytebase/bytebase/backend/component/dbfactory"
- "github.com/bytebase/bytebase/backend/component/state"
- "github.com/bytebase/bytebase/backend/enterprise"
- storepb "github.com/bytebase/bytebase/backend/generated-go/store"
- "github.com/bytebase/bytebase/backend/runner/schemasync"
- "github.com/bytebase/bytebase/backend/store"
-)
-
-// NewSchemaUpdateExecutor creates a schema update (DDL) task executor.
-func NewSchemaUpdateExecutor(store *store.Store, dbFactory *dbfactory.DBFactory, license *enterprise.LicenseService, stateCfg *state.State, schemaSyncer *schemasync.Syncer, profile *config.Profile) Executor {
- return &SchemaUpdateExecutor{
- store: store,
- dbFactory: dbFactory,
- license: license,
- stateCfg: stateCfg,
- schemaSyncer: schemaSyncer,
- profile: profile,
- }
-}
-
-// SchemaUpdateExecutor is the schema update (DDL) task executor.
-type SchemaUpdateExecutor struct {
- store *store.Store
- dbFactory *dbfactory.DBFactory
- license *enterprise.LicenseService
- stateCfg *state.State
- schemaSyncer *schemasync.Syncer
- profile *config.Profile
-}
-
-// RunOnce will run the schema update (DDL) task executor once.
-func (exec *SchemaUpdateExecutor) RunOnce(ctx context.Context, driverCtx context.Context, task *store.TaskMessage, taskRunUID int) (bool, *storepb.TaskRunResult, error) {
- sheetID := int(task.Payload.GetSheetId())
- statement, err := exec.store.GetSheetStatementByID(ctx, sheetID)
- if err != nil {
- return true, nil, err
- }
-
- return runMigration(ctx, driverCtx, exec.store, exec.dbFactory, exec.stateCfg, exec.schemaSyncer, exec.profile, task, taskRunUID, statement, task.Payload.GetSchemaVersion(), &sheetID)
-}
diff --git a/backend/runner/taskrun/schema_update_ghost_executor.go b/backend/runner/taskrun/schema_update_ghost_executor.go
deleted file mode 100644
index 7d9f91c666..0000000000
--- a/backend/runner/taskrun/schema_update_ghost_executor.go
+++ /dev/null
@@ -1,148 +0,0 @@
-package taskrun
-
-import (
- "context"
- "fmt"
- "log/slog"
- "strings"
- "time"
-
- "github.com/github/gh-ost/go/logic"
- gomysql "github.com/go-sql-driver/mysql"
- "github.com/pkg/errors"
-
- "github.com/bytebase/bytebase/backend/common"
- "github.com/bytebase/bytebase/backend/common/log"
- "github.com/bytebase/bytebase/backend/component/config"
- "github.com/bytebase/bytebase/backend/component/dbfactory"
- "github.com/bytebase/bytebase/backend/component/ghost"
- "github.com/bytebase/bytebase/backend/component/state"
- "github.com/bytebase/bytebase/backend/enterprise"
- storepb "github.com/bytebase/bytebase/backend/generated-go/store"
- "github.com/bytebase/bytebase/backend/plugin/db"
- "github.com/bytebase/bytebase/backend/runner/schemasync"
- "github.com/bytebase/bytebase/backend/store"
- "github.com/bytebase/bytebase/backend/utils"
-)
-
-// NewSchemaUpdateGhostExecutor creates a schema update (gh-ost) task executor.
-func NewSchemaUpdateGhostExecutor(s *store.Store, dbFactory *dbfactory.DBFactory, license *enterprise.LicenseService, stateCfg *state.State, schemaSyncer *schemasync.Syncer, profile *config.Profile) Executor {
- return &SchemaUpdateGhostExecutor{
- s: s,
- dbFactory: dbFactory,
- license: license,
- stateCfg: stateCfg,
- schemaSyncer: schemaSyncer,
- profile: profile,
- }
-}
-
-// SchemaUpdateGhostExecutor is the schema update (gh-ost) task executor.
-type SchemaUpdateGhostExecutor struct {
- s *store.Store
- dbFactory *dbfactory.DBFactory
- license *enterprise.LicenseService
- stateCfg *state.State
- schemaSyncer *schemasync.Syncer
- profile *config.Profile
-}
-
-func (exec *SchemaUpdateGhostExecutor) RunOnce(ctx context.Context, driverCtx context.Context, task *store.TaskMessage, taskRunUID int) (bool, *storepb.TaskRunResult, error) {
- sheetID := int(task.Payload.GetSheetId())
- statement, err := exec.s.GetSheetStatementByID(ctx, sheetID)
- if err != nil {
- return true, nil, err
- }
- flags := task.Payload.GetFlags()
-
- instance, err := exec.s.GetInstanceV2(ctx, &store.FindInstanceMessage{ResourceID: &task.InstanceID})
- if err != nil {
- return true, nil, err
- }
- if instance == nil {
- return true, nil, errors.Errorf("instance %s not found", task.InstanceID)
- }
- database, err := exec.s.GetDatabaseV2(ctx, &store.FindDatabaseMessage{InstanceID: &task.InstanceID, DatabaseName: task.DatabaseName})
- if err != nil {
- return true, nil, err
- }
- if database == nil {
- return true, nil, errors.Errorf("database not found")
- }
-
- execFunc := func(execCtx context.Context, execStatement string, driver db.Driver, _ db.ExecuteOptions) error {
- // set buffer size to 1 to unblock the sender because there is no listener if the task is canceled.
- migrationError := make(chan error, 1)
-
- statement := strings.TrimSpace(execStatement)
- // Trim trailing semicolons.
- statement = strings.TrimRight(statement, ";")
-
- tableName, err := ghost.GetTableNameFromStatement(statement)
- if err != nil {
- return err
- }
-
- adminDataSource := utils.DataSourceFromInstanceWithType(instance, storepb.DataSourceType_ADMIN)
- if adminDataSource == nil {
- return common.Errorf(common.Internal, "admin data source not found for instance %s", instance.ResourceID)
- }
-
- migrationContext, err := ghost.NewMigrationContext(ctx, task.ID, database, adminDataSource, tableName, fmt.Sprintf("_%d", time.Now().Unix()), execStatement, false, flags, 10000000)
- if err != nil {
- return errors.Wrap(err, "failed to init migrationContext for gh-ost")
- }
- defer func() {
- // Use migrationContext.Uuid as the tls_config_key by convention.
- // We need to deregister it when gh-ost exits.
- // https://github.com/bytebase/gh-ost2/pull/4
- gomysql.DeregisterTLSConfig(migrationContext.Uuid)
- }()
-
- migrator := logic.NewMigrator(migrationContext, "bb")
-
- defer func() {
- if err := func() error {
- ctx := context.Background()
-
- // Use the backup database name of MySQL as the ghost database name.
- ghostDBName := common.BackupDatabaseNameOfEngine(storepb.Engine_MYSQL)
- sql := fmt.Sprintf("DROP TABLE IF EXISTS `%s`.`%s`; DROP TABLE IF EXISTS `%s`.`%s`;",
- ghostDBName,
- migrationContext.GetGhostTableName(),
- ghostDBName,
- migrationContext.GetChangelogTableName(),
- )
-
- if _, err := driver.GetDB().ExecContext(ctx, sql); err != nil {
- return errors.Wrapf(err, "failed to drop gh-ost temp tables")
- }
- return nil
- }(); err != nil {
- slog.Warn("failed to cleanup gh-ost temp tables", log.BBError(err))
- }
- }()
-
- go func() {
- if err := migrator.Migrate(); err != nil {
- slog.Error("failed to run gh-ost migration", log.BBError(err))
- migrationError <- err
- return
- }
- migrationError <- nil
- }()
-
- select {
- case err := <-migrationError:
- if err != nil {
- return err
- }
- return nil
- case <-execCtx.Done():
- migrationContext.PanicAbort <- errors.New("task canceled")
- return errors.New("task canceled")
- }
- }
-
- return runMigrationWithFunc(ctx, driverCtx, exec.s, exec.dbFactory, exec.stateCfg, exec.schemaSyncer, exec.profile, task, taskRunUID, statement, task.Payload.GetSchemaVersion(), &sheetID, execFunc)
-}
diff --git a/backend/server/server.go b/backend/server/server.go
index 073bc613c7..946bc51d26 100644
--- a/backend/server/server.go
+++ b/backend/server/server.go
@@ -190,11 +190,9 @@ func NewServer(ctx context.Context, profile *config.Profile) (*Server, error) {
s.taskSchedulerV2 = taskrun.NewSchedulerV2(stores, s.stateCfg, s.webhookManager, profile, s.licenseService)
s.taskSchedulerV2.Register(storepb.Task_DATABASE_CREATE, taskrun.NewDatabaseCreateExecutor(stores, s.dbFactory, s.schemaSyncer, s.stateCfg, profile))
- s.taskSchedulerV2.Register(storepb.Task_DATABASE_SCHEMA_UPDATE, taskrun.NewSchemaUpdateExecutor(stores, s.dbFactory, s.licenseService, s.stateCfg, s.schemaSyncer, profile))
- s.taskSchedulerV2.Register(storepb.Task_DATABASE_DATA_UPDATE, taskrun.NewDataUpdateExecutor(stores, s.dbFactory, s.licenseService, s.stateCfg, s.schemaSyncer, profile))
+ s.taskSchedulerV2.Register(storepb.Task_DATABASE_MIGRATE, taskrun.NewDatabaseMigrateExecutor(stores, s.dbFactory, s.licenseService, s.stateCfg, s.schemaSyncer, profile))
s.taskSchedulerV2.Register(storepb.Task_DATABASE_EXPORT, taskrun.NewDataExportExecutor(stores, s.dbFactory, s.licenseService, s.stateCfg, s.schemaSyncer, profile))
- s.taskSchedulerV2.Register(storepb.Task_DATABASE_SCHEMA_UPDATE_GHOST, taskrun.NewSchemaUpdateGhostExecutor(stores, s.dbFactory, s.licenseService, s.stateCfg, s.schemaSyncer, s.profile))
- s.taskSchedulerV2.Register(storepb.Task_DATABASE_SCHEMA_UPDATE_SDL, taskrun.NewSchemaDeclareExecutor(stores, s.dbFactory, s.licenseService, s.stateCfg, s.schemaSyncer, profile))
+ s.taskSchedulerV2.Register(storepb.Task_DATABASE_SDL, taskrun.NewSchemaDeclareExecutor(stores, s.dbFactory, s.licenseService, s.stateCfg, s.schemaSyncer, profile))
s.planCheckScheduler = plancheck.NewScheduler(stores, s.licenseService, s.stateCfg)
databaseConnectExecutor := plancheck.NewDatabaseConnectExecutor(stores, s.dbFactory)
diff --git a/backend/store/issue.go b/backend/store/issue.go
index d701c9a3d1..94f629f803 100644
--- a/backend/store/issue.go
+++ b/backend/store/issue.go
@@ -79,8 +79,9 @@ type FindIssueMessage struct {
CreatedAtAfter *time.Time
Types *[]storepb.Issue_Type
- StatusList []storepb.Issue_Status
- TaskTypes *[]storepb.Task_Type
+ StatusList []storepb.Issue_Status
+ TaskTypes *[]storepb.Task_Type
+ MigrateTypes *[]storepb.Task_MigrateType
// Any of the task in the issue changes the instance with InstanceResourceID.
InstanceResourceID *string
// Any of the task in the issue changes the database with InstanceID and DatabaseName.
@@ -325,8 +326,18 @@ func (s *Store) ListIssueV2(ctx context.Context, find *FindIssueMessage) ([]*Iss
for _, t := range *v {
taskTypeStrings = append(taskTypeStrings, t.String())
}
- where = append(where, fmt.Sprintf("EXISTS (SELECT 1 FROM task WHERE task.pipeline_id = issue.pipeline_id AND task.type = ANY($%d))", len(args)+1))
- args = append(args, taskTypeStrings)
+ if find.MigrateTypes != nil && len(*find.MigrateTypes) > 0 {
+ // Filter by both task type and migrate type
+ migrateTypeStrings := make([]string, 0, len(*find.MigrateTypes))
+ for _, mt := range *find.MigrateTypes {
+ migrateTypeStrings = append(migrateTypeStrings, mt.String())
+ }
+ where = append(where, fmt.Sprintf("EXISTS (SELECT 1 FROM task WHERE task.pipeline_id = issue.pipeline_id AND task.type = ANY($%d) AND task.payload->>'migrateType' = ANY($%d))", len(args)+1, len(args)+2))
+ args = append(args, taskTypeStrings, migrateTypeStrings)
+ } else {
+ where = append(where, fmt.Sprintf("EXISTS (SELECT 1 FROM task WHERE task.pipeline_id = issue.pipeline_id AND task.type = ANY($%d))", len(args)+1))
+ args = append(args, taskTypeStrings)
+ }
}
if v := find.EnvironmentID; v != nil {
where = append(where, fmt.Sprintf("EXISTS (SELECT 1 FROM task WHERE task.pipeline_id = issue.pipeline_id AND task.environment = $%d)", len(args)+1))
diff --git a/backend/store/task.go b/backend/store/task.go
index 0d12b3e747..ffdb90bfe2 100644
--- a/backend/store/task.go
+++ b/backend/store/task.go
@@ -84,6 +84,7 @@ type TaskPatch struct {
ExportFormat *storepb.ExportFormat
ExportPassword *string
EnablePriorBackup *bool
+ MigrateType *storepb.Task_MigrateType
// Flags for gh-ost.
Flags *map[string]string
@@ -406,6 +407,9 @@ func (s *Store) UpdateTaskV2(ctx context.Context, patch *TaskPatch) (*TaskMessag
if v := patch.EnablePriorBackup; v != nil {
payloadSet, args = append(payloadSet, fmt.Sprintf(`jsonb_build_object('enablePriorBackup', $%d::BOOLEAN)`, len(args)+1)), append(args, *v)
}
+ if v := patch.MigrateType; v != nil {
+ payloadSet, args = append(payloadSet, fmt.Sprintf(`jsonb_build_object('migrateType', $%d::TEXT)`, len(args)+1)), append(args, v.String())
+ }
if v := patch.Flags; v != nil {
jsonb, err := json.Marshal(v)
if err != nil {
diff --git a/backend/tests/change_history_test.go b/backend/tests/change_history_test.go
index c878c3c998..f9d20a9b3a 100644
--- a/backend/tests/change_history_test.go
+++ b/backend/tests/change_history_test.go
@@ -110,7 +110,7 @@ func TestFilterChangeHistoryByResources(t *testing.T) {
a.NoError(err)
// Create an issue that updates database schema.
- err = ctl.changeDatabase(ctx, ctl.project, databaseResp.Msg, sheetResp.Msg, v1pb.DatabaseChangeType_MIGRATE)
+ err = ctl.changeDatabase(ctx, ctl.project, databaseResp.Msg, sheetResp.Msg, v1pb.MigrationType_DDL)
a.NoError(err)
}
diff --git a/backend/tests/ghost_test.go b/backend/tests/ghost_test.go
index 8c50533e03..c771cf25b2 100644
--- a/backend/tests/ghost_test.go
+++ b/backend/tests/ghost_test.go
@@ -103,7 +103,7 @@ func TestGhostSchemaUpdate(t *testing.T) {
a.NoError(err)
sheet1 := sheet1Response.Msg
- err = ctl.changeDatabase(ctx, ctl.project, database, sheet1, v1pb.DatabaseChangeType_MIGRATE)
+ err = ctl.changeDatabase(ctx, ctl.project, database, sheet1, v1pb.MigrationType_DDL)
a.NoError(err)
dbMetadataResponse, err := ctl.databaseServiceClient.GetDatabaseSchema(ctx, connect.NewRequest(&v1pb.GetDatabaseSchemaRequest{Name: fmt.Sprintf("%s/schema", database.Name)}))
@@ -121,7 +121,7 @@ func TestGhostSchemaUpdate(t *testing.T) {
a.NoError(err)
sheet2 := sheet2Response.Msg
- err = ctl.changeDatabase(ctx, ctl.project, database, sheet2, v1pb.DatabaseChangeType_MIGRATE_GHOST)
+ err = ctl.changeDatabase(ctx, ctl.project, database, sheet2, v1pb.MigrationType_GHOST)
a.NoError(err)
dbMetadataResponse, err = ctl.databaseServiceClient.GetDatabaseSchema(ctx, connect.NewRequest(&v1pb.GetDatabaseSchemaRequest{Name: fmt.Sprintf("%s/schema", database.Name)}))
a.NoError(err)
diff --git a/backend/tests/rollout.go b/backend/tests/rollout.go
index 4801a7d529..e0f2647065 100644
--- a/backend/tests/rollout.go
+++ b/backend/tests/rollout.go
@@ -12,14 +12,15 @@ import (
v1pb "github.com/bytebase/bytebase/backend/generated-go/v1"
)
-func (ctl *controller) changeDatabase(ctx context.Context, project *v1pb.Project, database *v1pb.Database, sheet *v1pb.Sheet, changeType v1pb.DatabaseChangeType) error {
+func (ctl *controller) changeDatabase(ctx context.Context, project *v1pb.Project, database *v1pb.Database, sheet *v1pb.Sheet, migrationType v1pb.MigrationType) error {
spec := &v1pb.Plan_Spec{
Id: uuid.NewString(),
Config: &v1pb.Plan_Spec_ChangeDatabaseConfig{
ChangeDatabaseConfig: &v1pb.Plan_ChangeDatabaseConfig{
- Targets: []string{database.Name},
- Sheet: sheet.Name,
- Type: changeType,
+ Targets: []string{database.Name},
+ Sheet: sheet.Name,
+ Type: v1pb.DatabaseChangeType_MIGRATE,
+ MigrationType: migrationType,
},
},
}
diff --git a/backend/tests/schema_update_test.go b/backend/tests/schema_update_test.go
index fa31603614..6dc76b14b3 100644
--- a/backend/tests/schema_update_test.go
+++ b/backend/tests/schema_update_test.go
@@ -66,7 +66,7 @@ func TestSchemaAndDataUpdate(t *testing.T) {
sheet := sheetResp.Msg
// Create an issue that updates database schema.
- err = ctl.changeDatabase(ctx, ctl.project, database, sheet, v1pb.DatabaseChangeType_MIGRATE)
+ err = ctl.changeDatabase(ctx, ctl.project, database, sheet, v1pb.MigrationType_DDL)
a.NoError(err)
// Query schema.
@@ -86,7 +86,7 @@ func TestSchemaAndDataUpdate(t *testing.T) {
sheet = sheetResp.Msg
// Create an issue that updates database data.
- err = ctl.changeDatabase(ctx, ctl.project, database, sheet, v1pb.DatabaseChangeType_DATA)
+ err = ctl.changeDatabase(ctx, ctl.project, database, sheet, v1pb.MigrationType_DML)
a.NoError(err)
resp, err := ctl.databaseServiceClient.ListChangelogs(ctx, connect.NewRequest(&v1pb.ListChangelogsRequest{
@@ -327,7 +327,7 @@ CREATE TABLE "public"."book" (
ddlSheet := ddlSheetResp.Msg
// Create an issue that updates database schema.
- err = ctl.changeDatabase(ctx, ctl.project, database, ddlSheet, v1pb.DatabaseChangeType_MIGRATE)
+ err = ctl.changeDatabase(ctx, ctl.project, database, ddlSheet, v1pb.MigrationType_DDL)
a.NoError(err)
latestSchemaResp, err := ctl.databaseServiceClient.GetDatabaseSchema(ctx, connect.NewRequest(&v1pb.GetDatabaseSchemaRequest{
diff --git a/backend/tests/sensitive_data_test.go b/backend/tests/sensitive_data_test.go
index a4e344ea3e..70f1fa86a5 100644
--- a/backend/tests/sensitive_data_test.go
+++ b/backend/tests/sensitive_data_test.go
@@ -202,7 +202,7 @@ func TestSensitiveData(t *testing.T) {
sheet := sheetResp.Msg
// Create an issue that updates database schema.
- err = ctl.changeDatabase(ctx, ctl.project, database, sheet, v1pb.DatabaseChangeType_MIGRATE)
+ err = ctl.changeDatabase(ctx, ctl.project, database, sheet, v1pb.MigrationType_DDL)
a.NoError(err)
// Create sensitive data in the database config.
@@ -248,7 +248,7 @@ func TestSensitiveData(t *testing.T) {
insertDataSheet := insertDataSheetResp.Msg
// Insert data into table tech_book.
- err = ctl.changeDatabase(ctx, ctl.project, database, insertDataSheet, v1pb.DatabaseChangeType_DATA)
+ err = ctl.changeDatabase(ctx, ctl.project, database, insertDataSheet, v1pb.MigrationType_DML)
a.NoError(err)
// Query masked data.
diff --git a/backend/tests/sql_editor_test.go b/backend/tests/sql_editor_test.go
index e03931c116..cae39850ef 100644
--- a/backend/tests/sql_editor_test.go
+++ b/backend/tests/sql_editor_test.go
@@ -205,7 +205,7 @@ func TestAdminQueryAffectedRows(t *testing.T) {
a.NoError(err)
sheet := sheetResp.Msg
- err = ctl.changeDatabase(ctx, ctl.project, database, sheet, v1pb.DatabaseChangeType_MIGRATE)
+ err = ctl.changeDatabase(ctx, ctl.project, database, sheet, v1pb.MigrationType_DDL)
a.NoError(err)
results, err := ctl.adminQuery(ctx, database, tt.query)
diff --git a/backend/tests/sql_export_test.go b/backend/tests/sql_export_test.go
index 2ea26540fb..a1cd495af6 100644
--- a/backend/tests/sql_export_test.go
+++ b/backend/tests/sql_export_test.go
@@ -195,7 +195,7 @@ func TestSQLExport(t *testing.T) {
a.Equal(1, len(database.InstanceResource.DataSources))
dataSource := database.InstanceResource.DataSources[0]
- err = ctl.changeDatabase(ctx, ctl.project, database, sheet, v1pb.DatabaseChangeType_MIGRATE)
+ err = ctl.changeDatabase(ctx, ctl.project, database, sheet, v1pb.MigrationType_DDL)
a.NoError(err)
statement := tt.query
diff --git a/backend/tests/sql_review_test.go b/backend/tests/sql_review_test.go
index efb065a5c0..7d9cb777ea 100644
--- a/backend/tests/sql_review_test.go
+++ b/backend/tests/sql_review_test.go
@@ -477,9 +477,10 @@ func createIssueAndReturnSQLReviewResult(ctx context.Context, a *require.Asserti
Id: uuid.NewString(),
Config: &v1pb.Plan_Spec_ChangeDatabaseConfig{
ChangeDatabaseConfig: &v1pb.Plan_ChangeDatabaseConfig{
- Targets: []string{database.Name},
- Sheet: sheet.Msg.Name,
- Type: v1pb.DatabaseChangeType_MIGRATE,
+ Targets: []string{database.Name},
+ Sheet: sheet.Msg.Name,
+ Type: v1pb.DatabaseChangeType_MIGRATE,
+ MigrationType: v1pb.MigrationType_DDL,
},
},
},
diff --git a/backend/tests/sync_schema_test.go b/backend/tests/sync_schema_test.go
index 3102abe64b..f1dc66f610 100644
--- a/backend/tests/sync_schema_test.go
+++ b/backend/tests/sync_schema_test.go
@@ -93,7 +93,7 @@ DROP SCHEMA "schema_a";
sheet := sheetResp.Msg
// Create an issue that updates database schema.
- err = ctl.changeDatabase(ctx, ctl.project, database, sheet, v1pb.DatabaseChangeType_MIGRATE)
+ err = ctl.changeDatabase(ctx, ctl.project, database, sheet, v1pb.MigrationType_DDL)
a.NoError(err)
resp, err := ctl.databaseServiceClient.ListChangelogs(ctx, connect.NewRequest(&v1pb.ListChangelogsRequest{
diff --git a/backend/tests/syncer_test.go b/backend/tests/syncer_test.go
index 92fde7ef4c..63aee4c4e3 100644
--- a/backend/tests/syncer_test.go
+++ b/backend/tests/syncer_test.go
@@ -237,7 +237,7 @@ func TestSyncerForPostgreSQL(t *testing.T) {
sheet := sheetResp.Msg
// Create an issue that updates database schema.
- err = ctl.changeDatabase(ctx, ctl.project, database, sheet, v1pb.DatabaseChangeType_MIGRATE)
+ err = ctl.changeDatabase(ctx, ctl.project, database, sheet, v1pb.MigrationType_DDL)
a.NoError(err)
latestSchemaMetadataResp, err := ctl.databaseServiceClient.GetDatabaseMetadata(ctx, connect.NewRequest(&v1pb.GetDatabaseMetadataRequest{
@@ -521,7 +521,7 @@ func TestSyncerForMySQL(t *testing.T) {
sheet := sheetResp.Msg
// Create an issue that updates database schema.
- err = ctl.changeDatabase(ctx, ctl.project, database, sheet, v1pb.DatabaseChangeType_MIGRATE)
+ err = ctl.changeDatabase(ctx, ctl.project, database, sheet, v1pb.MigrationType_DDL)
a.NoError(err)
latestSchemaMetadataResp, err := ctl.databaseServiceClient.GetDatabaseMetadata(ctx, connect.NewRequest(&v1pb.GetDatabaseMetadataRequest{
diff --git a/backend/tests/tenant_test.go b/backend/tests/tenant_test.go
index 32dcf5e6ce..ba54d4d93f 100644
--- a/backend/tests/tenant_test.go
+++ b/backend/tests/tenant_test.go
@@ -155,9 +155,10 @@ func TestDatabaseGroup(t *testing.T) {
Id: uuid.NewString(),
Config: &v1pb.Plan_Spec_ChangeDatabaseConfig{
ChangeDatabaseConfig: &v1pb.Plan_ChangeDatabaseConfig{
- Targets: []string{databaseGroup.Name},
- Sheet: sheet.Name,
- Type: v1pb.DatabaseChangeType_MIGRATE,
+ Targets: []string{databaseGroup.Name},
+ Sheet: sheet.Name,
+ Type: v1pb.DatabaseChangeType_MIGRATE,
+ MigrationType: v1pb.MigrationType_DDL,
},
},
}
diff --git a/frontend/src/components/IssueV1/components/Panel/TaskRolloutActionPanel.vue b/frontend/src/components/IssueV1/components/Panel/TaskRolloutActionPanel.vue
index 8fe55e4dfd..c037b536f8 100644
--- a/frontend/src/components/IssueV1/components/Panel/TaskRolloutActionPanel.vue
+++ b/frontend/src/components/IssueV1/components/Panel/TaskRolloutActionPanel.vue
@@ -78,12 +78,32 @@
class="flex items-center"
>
<NTag
- v-if="semanticTaskType(task.type)"
+ v-if="
+ semanticTaskType(
+ task.type,
+ task.payload?.case === 'databaseUpdate'
+ ? task.payload.value.databaseChangeType
+ : undefined,
+ task.payload?.case === 'databaseUpdate'
+ ? task.payload.value.migrationType
+ : undefined
+ )
+ "
class="mr-2"
size="small"
>
<span class="inline-block text-center">
- {{ semanticTaskType(task.type) }}
+ {{
+ semanticTaskType(
+ task.type,
+ task.payload?.case === "databaseUpdate"
+ ? task.payload.value.databaseChangeType
+ : undefined,
+ task.payload?.case === "databaseUpdate"
+ ? task.payload.value.migrationType
+ : undefined
+ )
+ }}
</span>
</NTag>
<RolloutTaskDatabaseName :task="task" />
diff --git a/frontend/src/components/IssueV1/components/StatementSection/EditorView/EditorActionPopover.vue b/frontend/src/components/IssueV1/components/StatementSection/EditorView/EditorActionPopover.vue
index 572a1b58b8..06f406f3c5 100644
--- a/frontend/src/components/IssueV1/components/StatementSection/EditorView/EditorActionPopover.vue
+++ b/frontend/src/components/IssueV1/components/StatementSection/EditorView/EditorActionPopover.vue
@@ -57,12 +57,7 @@ const shouldShowInstanceRoleSelect = computed(() => {
return false;
}
// Only works for DDL/DML, exclude creating database and schema baseline.
- if (
- ![
- Task_Type.DATABASE_SCHEMA_UPDATE,
- Task_Type.DATABASE_DATA_UPDATE,
- ].includes(selectedTask.value.type)
- ) {
+ if (selectedTask.value.type !== Task_Type.DATABASE_MIGRATE) {
return false;
}
return true;
@@ -76,12 +71,7 @@ const shouldShowTransactionModeToggle = computed(() => {
return false;
}
// Only show for DDL/DML tasks
- if (
- ![
- Task_Type.DATABASE_SCHEMA_UPDATE,
- Task_Type.DATABASE_DATA_UPDATE,
- ].includes(selectedTask.value.type)
- ) {
+ if (selectedTask.value.type !== Task_Type.DATABASE_MIGRATE) {
return false;
}
return true;
diff --git a/frontend/src/components/IssueV1/components/TaskListSection/TaskCard.vue b/frontend/src/components/IssueV1/components/TaskListSection/TaskCard.vue
index 8f72c4b79e..a16d2a24de 100644
--- a/frontend/src/components/IssueV1/components/TaskListSection/TaskCard.vue
+++ b/frontend/src/components/IssueV1/components/TaskListSection/TaskCard.vue
@@ -59,7 +59,10 @@ import { computed } from "vue";
import { InstanceV1Name } from "@/components/v2";
import { useCurrentProjectV1 } from "@/store";
import { isValidDatabaseName } from "@/types";
-import { DatabaseChangeType } from "@/types/proto-es/v1/common_pb";
+import {
+ DatabaseChangeType,
+ MigrationType,
+} from "@/types/proto-es/v1/common_pb";
import type { Task } from "@/types/proto-es/v1/rollout_service_pb";
import { Task_Type, Task_Status } from "@/types/proto-es/v1/rollout_service_pb";
import { databaseForTask } from "@/utils";
@@ -99,10 +102,18 @@ const showGhostTag = computed(() => {
const spec = specForTask(issue.value.planEntity, props.task);
return (
spec?.config?.case === "changeDatabaseConfig" &&
- spec.config.value?.type === DatabaseChangeType.MIGRATE_GHOST
+ spec.config.value?.type === DatabaseChangeType.MIGRATE &&
+ spec.config.value?.migrationType === MigrationType.GHOST
);
}
- return props.task.type === Task_Type.DATABASE_SCHEMA_UPDATE_GHOST;
+ // Check if it's a MIGRATE task with GHOST type
+ return (
+ props.task.type === Task_Type.DATABASE_MIGRATE &&
+ props.task.payload?.case === "databaseUpdate" &&
+ props.task.payload.value.databaseChangeType ===
+ DatabaseChangeType.MIGRATE &&
+ props.task.payload.value.migrationType === MigrationType.GHOST
+ );
});
const taskClass = computed(() => {
diff --git a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunComment.vue b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunComment.vue
index a92fdf0712..47bb67d068 100644
--- a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunComment.vue
+++ b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunComment.vue
@@ -151,10 +151,8 @@ const commentLink = computed((): CommentLink => {
}
} else if (taskRun.status === TaskRun_Status.DONE) {
switch (task.type) {
- case Task_Type.DATABASE_SCHEMA_UPDATE:
- case Task_Type.DATABASE_SCHEMA_UPDATE_SDL:
- case Task_Type.DATABASE_SCHEMA_UPDATE_GHOST:
- case Task_Type.DATABASE_DATA_UPDATE: {
+ case Task_Type.DATABASE_MIGRATE:
+ case Task_Type.DATABASE_SDL: {
if (taskRun.changelog === "") {
return {
title: "",
diff --git a/frontend/src/components/IssueV1/logic/action/task.ts b/frontend/src/components/IssueV1/logic/action/task.ts
index b97e1b4b03..6550cf934a 100644
--- a/frontend/src/components/IssueV1/logic/action/task.ts
+++ b/frontend/src/components/IssueV1/logic/action/task.ts
@@ -33,10 +33,8 @@ export const PrimaryTaskRolloutActionList: TaskRolloutAction[] = [
export const SecondaryTaskRolloutActionList: TaskRolloutAction[] = ["SKIP"];
export const CancelableTaskTypeList: Task_Type[] = [
- Task_Type.DATABASE_DATA_UPDATE,
- Task_Type.DATABASE_SCHEMA_UPDATE,
- Task_Type.DATABASE_SCHEMA_UPDATE_SDL,
- Task_Type.DATABASE_SCHEMA_UPDATE_GHOST,
+ Task_Type.DATABASE_MIGRATE,
+ Task_Type.DATABASE_SDL,
];
export const TaskRolloutActionMap: Record<Task_Status, TaskRolloutAction[]> = {
diff --git a/frontend/src/components/IssueV1/logic/poll.ts b/frontend/src/components/IssueV1/logic/poll.ts
index 7c5a84317e..6f18b06f85 100644
--- a/frontend/src/components/IssueV1/logic/poll.ts
+++ b/frontend/src/components/IssueV1/logic/poll.ts
@@ -9,6 +9,10 @@ import {
} from "@/store";
import { useListCache } from "@/store/modules/v1/cache";
import type { ComposedIssue } from "@/types";
+import {
+ DatabaseChangeType,
+ MigrationType,
+} from "@/types/proto-es/v1/common_pb";
import { IssueStatus } from "@/types/proto-es/v1/issue_service_pb";
import { Task_Type } from "@/types/proto-es/v1/rollout_service_pb";
import { databaseForTask } from "@/utils";
@@ -35,8 +39,22 @@ const clearCache = (issue: ComposedIssue) => {
case Task_Type.DATABASE_EXPORT:
case Task_Type.TYPE_UNSPECIFIED:
continue;
- case Task_Type.DATABASE_DATA_UPDATE:
- changelogStore.clearCache(database.name);
+ case Task_Type.DATABASE_MIGRATE:
+ // For DML tasks, clear the changelog cache
+ if (
+ task.payload?.case === "databaseUpdate" &&
+ task.payload.value.databaseChangeType ===
+ DatabaseChangeType.MIGRATE &&
+ task.payload.value.migrationType === MigrationType.DML
+ ) {
+ changelogStore.clearCache(database.name);
+ } else {
+ // For DDL/Ghost tasks, clear the schema cache
+ useDBSchemaV1Store().removeCache(database.name);
+ }
+ break;
+ case Task_Type.DATABASE_SDL:
+ useDBSchemaV1Store().removeCache(database.name);
break;
default:
useDBSchemaV1Store().removeCache(database.name);
diff --git a/frontend/src/components/IssueV1/logic/rollout.ts b/frontend/src/components/IssueV1/logic/rollout.ts
index 20b3668af8..958562fc0b 100644
--- a/frontend/src/components/IssueV1/logic/rollout.ts
+++ b/frontend/src/components/IssueV1/logic/rollout.ts
@@ -2,6 +2,10 @@ import { head, includes } from "lodash-es";
import { t } from "@/plugins/i18n";
import { extractUserId, useCurrentUserV1 } from "@/store";
import type { ComposedIssue } from "@/types";
+import {
+ DatabaseChangeType,
+ MigrationType,
+} from "@/types/proto-es/v1/common_pb";
import { Issue_Type, IssueStatus } from "@/types/proto-es/v1/issue_service_pb";
import type { Task } from "@/types/proto-es/v1/rollout_service_pb";
import { Task_Status, Task_Type } from "@/types/proto-es/v1/rollout_service_pb";
@@ -82,18 +86,25 @@ export const isTaskFinished = (task: Task): boolean => {
return [Task_Status.DONE, Task_Status.SKIPPED].includes(task.status);
};
-export const semanticTaskType = (type: Task_Type) => {
+export const semanticTaskType = (
+ type: Task_Type,
+ databaseChangeType?: DatabaseChangeType,
+ migrationType?: MigrationType
+) => {
switch (type) {
case Task_Type.DATABASE_CREATE:
return t("db.create");
- case Task_Type.DATABASE_DATA_UPDATE:
- return "DML";
- case Task_Type.DATABASE_SCHEMA_UPDATE:
- return "DDL";
- case Task_Type.DATABASE_SCHEMA_UPDATE_SDL:
+ case Task_Type.DATABASE_MIGRATE:
+ switch (migrationType) {
+ case MigrationType.DML:
+ return "DML";
+ case MigrationType.GHOST:
+ return "gh-ost";
+ default:
+ return "DDL";
+ }
+ case Task_Type.DATABASE_SDL:
return "SDL";
- case Task_Type.DATABASE_SCHEMA_UPDATE_GHOST:
- return "gh-ost";
case Task_Type.DATABASE_EXPORT:
return "Export";
}
diff --git a/frontend/src/components/IssueV1/logic/utils.ts b/frontend/src/components/IssueV1/logic/utils.ts
index 46d67ee96c..2c84d922c0 100644
--- a/frontend/src/components/IssueV1/logic/utils.ts
+++ b/frontend/src/components/IssueV1/logic/utils.ts
@@ -45,10 +45,8 @@ export const useInstanceForTask = (task: Task) => {
case Task_Type.DATABASE_CREATE:
instanceName = task.target;
break;
- case Task_Type.DATABASE_SCHEMA_UPDATE:
- case Task_Type.DATABASE_SCHEMA_UPDATE_SDL:
- case Task_Type.DATABASE_SCHEMA_UPDATE_GHOST:
- case Task_Type.DATABASE_DATA_UPDATE:
+ case Task_Type.DATABASE_MIGRATE:
+ case Task_Type.DATABASE_SDL:
case Task_Type.DATABASE_EXPORT:
instanceName = extractDatabaseResourceName(task.target).instance;
break;
diff --git a/frontend/src/components/Plan/components/AddSpecDrawer.vue b/frontend/src/components/Plan/components/AddSpecDrawer.vue
index 54dc354cd6..7370923dde 100644
--- a/frontend/src/components/Plan/components/AddSpecDrawer.vue
+++ b/frontend/src/components/Plan/components/AddSpecDrawer.vue
@@ -25,7 +25,7 @@
<!-- Step 1: Select Change Type -->
<template v-if="currentStep === Step.SELECT_CHANGE_TYPE">
<NRadioGroup
- v-model:value="selectedChangeType"
+ v-model:value="selectedMigrationType"
size="large"
class="space-y-4 w-full"
>
@@ -35,7 +35,7 @@
'border-blue-500 bg-blue-50': isMigrateSelected,
}"
>
- <NRadio :value="DatabaseChangeType.MIGRATE" class="w-full">
+ <NRadio :value="MigrationType.DDL" class="w-full">
<div class="flex items-start space-x-3 w-full">
<FileDiffIcon
class="w-6 h-6 mt-1 flex-shrink-0"
@@ -57,10 +57,10 @@
<div
class="border border-gray-200 rounded-lg p-4 hover:border-gray-300 transition-colors"
:class="{
- 'border-blue-500 bg-blue-50': isDataSelected,
+ 'border-blue-500 bg-blue-50': isDMLSelected,
}"
>
- <NRadio :value="DatabaseChangeType.DATA" class="w-full">
+ <NRadio :value="MigrationType.DML" class="w-full">
<div class="flex items-start space-x-3 w-full">
<EditIcon
class="w-6 h-6 mt-1 flex-shrink-0"
@@ -230,7 +230,10 @@ import {
batchGetOrFetchDatabases,
pushNotification,
} from "@/store";
-import { DatabaseChangeType } from "@/types/proto-es/v1/common_pb";
+import {
+ DatabaseChangeType,
+ MigrationType,
+} from "@/types/proto-es/v1/common_pb";
import {
Plan_ChangeDatabaseConfigSchema,
Plan_SpecSchema,
@@ -260,9 +263,7 @@ const databaseV1Store = useDatabaseV1Store();
const dbSchemaStore = useDBSchemaV1Store();
const dbCatalogStore = useDatabaseCatalogV1Store();
-const selectedChangeType: Ref<DatabaseChangeType> = ref(
- DatabaseChangeType.MIGRATE
-);
+const selectedMigrationType: Ref<MigrationType> = ref(MigrationType.DDL);
const isCreating = ref(false);
const currentStep = ref(Step.SELECT_CHANGE_TYPE);
const isPreparingMetadata = ref(false);
@@ -286,12 +287,12 @@ const hasSelection = computed(() => {
});
const canSubmit = computed(() => {
- return hasSelection.value && selectedChangeType.value;
+ return hasSelection.value && selectedMigrationType.value;
});
const canProceedToNextStep = computed(() => {
if (currentStep.value === Step.SELECT_CHANGE_TYPE) {
- return !!selectedChangeType.value;
+ return !!selectedMigrationType.value;
}
if (currentStep.value === Step.SELECT_TARGETS) {
return hasSelection.value;
@@ -324,9 +325,9 @@ const isLastStep = computed(() => {
const changeTypeTitle = computed(() => {
if (currentStep.value !== Step.SELECT_CHANGE_TYPE) {
- if (selectedChangeType.value === DatabaseChangeType.MIGRATE) {
+ if (selectedMigrationType.value === MigrationType.DDL) {
return t("plan.schema-migration");
- } else if (selectedChangeType.value === DatabaseChangeType.DATA) {
+ } else if (selectedMigrationType.value === MigrationType.DML) {
return t("plan.data-change");
}
}
@@ -334,18 +335,18 @@ const changeTypeTitle = computed(() => {
});
const isMigrateSelected = computed(() => {
- return selectedChangeType.value === DatabaseChangeType.MIGRATE;
+ return selectedMigrationType.value === MigrationType.DDL;
});
-const isDataSelected = computed(() => {
- return selectedChangeType.value === DatabaseChangeType.DATA;
+const isDMLSelected = computed(() => {
+ return selectedMigrationType.value === MigrationType.DML;
});
// Reset state when drawer opens
watch(show, (newVal) => {
if (newVal) {
currentStep.value = Step.SELECT_CHANGE_TYPE;
- selectedChangeType.value = DatabaseChangeType.MIGRATE;
+ selectedMigrationType.value = MigrationType.DDL;
databaseSelectState.changeSource = "DATABASE";
databaseSelectState.selectedDatabaseNameList = [];
databaseSelectState.selectedDatabaseGroup = undefined;
@@ -415,7 +416,7 @@ const prepareDatabaseMetadata = async () => {
const handleNextStep = async () => {
if (
currentStep.value === Step.SELECT_CHANGE_TYPE &&
- selectedChangeType.value
+ selectedMigrationType.value
) {
currentStep.value = Step.SELECT_TARGETS;
} else if (currentStep.value === Step.SELECT_TARGETS && hasSelection.value) {
@@ -551,7 +552,7 @@ const handleConfirm = async () => {
`${project.value.name}/sheets/${sheetUID}`
);
localSheet.title =
- selectedChangeType.value === DatabaseChangeType.MIGRATE
+ selectedMigrationType.value === MigrationType.DDL
? "Schema Migration"
: "Data Change";
if (statement) {
@@ -565,7 +566,8 @@ const handleConfirm = async () => {
case: "changeDatabaseConfig",
value: createProto(Plan_ChangeDatabaseConfigSchema, {
targets,
- type: selectedChangeType.value,
+ type: DatabaseChangeType.MIGRATE,
+ migrationType: selectedMigrationType.value,
sheet: localSheet.name,
}),
},
diff --git a/frontend/src/components/Plan/components/Configuration/GhostSection/GhostSwitch.vue b/frontend/src/components/Plan/components/Configuration/GhostSection/GhostSwitch.vue
index 6b30fdd328..eac764dc37 100644
--- a/frontend/src/components/Plan/components/Configuration/GhostSection/GhostSwitch.vue
+++ b/frontend/src/components/Plan/components/Configuration/GhostSection/GhostSwitch.vue
@@ -37,7 +37,7 @@ import type { ErrorItem } from "@/components/misc/ErrorList.vue";
import { default as ErrorList } from "@/components/misc/ErrorList.vue";
import { planServiceClientConnect } from "@/grpcweb";
import { pushNotification } from "@/store";
-import { DatabaseChangeType } from "@/types/proto-es/v1/common_pb";
+import { MigrationType } from "@/types/proto-es/v1/common_pb";
import { UpdatePlanRequestSchema } from "@/types/proto-es/v1/plan_service_pb";
import { allowGhostForDatabase } from "./common";
import { useGhostSettingContext } from "./context";
@@ -142,9 +142,9 @@ const toggleChecked = async (on: boolean) => {
selectedSpec.value.config?.case !== "changeDatabaseConfig"
)
return;
- selectedSpec.value.config.value.type = on
- ? DatabaseChangeType.MIGRATE_GHOST
- : DatabaseChangeType.MIGRATE;
+ selectedSpec.value.config.value.migrationType = on
+ ? MigrationType.GHOST
+ : MigrationType.DDL;
} else {
const planPatch = cloneDeep(plan.value);
const spec = (planPatch?.specs || []).find((spec) => {
@@ -157,9 +157,9 @@ const toggleChecked = async (on: boolean) => {
);
}
- spec.config.value.type = on
- ? DatabaseChangeType.MIGRATE_GHOST
- : DatabaseChangeType.MIGRATE;
+ spec.config.value.migrationType = on
+ ? MigrationType.GHOST
+ : MigrationType.DDL;
const request = create(UpdatePlanRequestSchema, {
plan: planPatch,
updateMask: { paths: ["specs"] },
diff --git a/frontend/src/components/Plan/components/Configuration/GhostSection/common.ts b/frontend/src/components/Plan/components/Configuration/GhostSection/common.ts
index cfe28a3fdc..1e43e1743b 100644
--- a/frontend/src/components/Plan/components/Configuration/GhostSection/common.ts
+++ b/frontend/src/components/Plan/components/Configuration/GhostSection/common.ts
@@ -1,7 +1,10 @@
import { isDBGroupChangeSpec } from "@/components/Plan/logic";
import type { ComposedDatabase } from "@/types";
import { Engine } from "@/types/proto-es/v1/common_pb";
-import { DatabaseChangeType } from "@/types/proto-es/v1/common_pb";
+import {
+ DatabaseChangeType,
+ MigrationType,
+} from "@/types/proto-es/v1/common_pb";
import { type Plan_Spec } from "@/types/proto-es/v1/plan_service_pb";
import { semverCompare } from "@/utils";
@@ -36,10 +39,7 @@ export const allowGhostForSpec = (spec: Plan_Spec | undefined) => {
: undefined;
if (!config) return false;
- return [
- DatabaseChangeType.MIGRATE,
- DatabaseChangeType.MIGRATE_GHOST,
- ].includes(config.type);
+ return config.type === DatabaseChangeType.MIGRATE;
};
export const getGhostEnabledForSpec = (
@@ -56,10 +56,7 @@ export const getGhostEnabledForSpec = (
return undefined;
}
if (config.type === DatabaseChangeType.MIGRATE) {
- return false;
- }
- if (config.type === DatabaseChangeType.MIGRATE_GHOST) {
- return true;
+ return config.migrationType === MigrationType.GHOST;
}
return undefined;
};
diff --git a/frontend/src/components/Plan/components/Configuration/InstanceRoleSection/context.ts b/frontend/src/components/Plan/components/Configuration/InstanceRoleSection/context.ts
index af6391263c..88e2879971 100644
--- a/frontend/src/components/Plan/components/Configuration/InstanceRoleSection/context.ts
+++ b/frontend/src/components/Plan/components/Configuration/InstanceRoleSection/context.ts
@@ -4,8 +4,7 @@ import { computed, inject, provide, ref } from "vue";
import { targetsForSpec } from "@/components/Plan/logic";
import { useDatabaseV1Store } from "@/store";
import { isValidDatabaseName } from "@/types";
-import { Engine } from "@/types/proto-es/v1/common_pb";
-import { DatabaseChangeType } from "@/types/proto-es/v1/common_pb";
+import { DatabaseChangeType, Engine } from "@/types/proto-es/v1/common_pb";
import type { Issue } from "@/types/proto-es/v1/issue_service_pb";
import { IssueStatus } from "@/types/proto-es/v1/issue_service_pb";
import { type Plan, type Plan_Spec } from "@/types/proto-es/v1/plan_service_pb";
@@ -63,11 +62,9 @@ export const provideInstanceRoleSettingContext = (refs: {
if (selectedSpec.value.config?.case !== "changeDatabaseConfig") {
return false;
}
- return [
- DatabaseChangeType.DATA,
- DatabaseChangeType.MIGRATE,
- DatabaseChangeType.MIGRATE_GHOST,
- ].includes(selectedSpec.value.config.value.type);
+ const config = selectedSpec.value.config.value;
+ // Show for all MIGRATE types (DDL, DML, Ghost), but not SDL
+ return config.type === DatabaseChangeType.MIGRATE;
});
const allowChange = computed(() => {
diff --git a/frontend/src/components/Plan/components/Configuration/IsolationLevelSection/context.ts b/frontend/src/components/Plan/components/Configuration/IsolationLevelSection/context.ts
index 1f5294e840..f83e0bccff 100644
--- a/frontend/src/components/Plan/components/Configuration/IsolationLevelSection/context.ts
+++ b/frontend/src/components/Plan/components/Configuration/IsolationLevelSection/context.ts
@@ -4,8 +4,7 @@ import { computed, inject, provide, ref } from "vue";
import { targetsForSpec } from "@/components/Plan/logic";
import { useDatabaseV1Store } from "@/store";
import { isValidDatabaseName } from "@/types";
-import { Engine } from "@/types/proto-es/v1/common_pb";
-import { DatabaseChangeType } from "@/types/proto-es/v1/common_pb";
+import { DatabaseChangeType, Engine } from "@/types/proto-es/v1/common_pb";
import type { Issue } from "@/types/proto-es/v1/issue_service_pb";
import { IssueStatus } from "@/types/proto-es/v1/issue_service_pb";
import { type Plan, type Plan_Spec } from "@/types/proto-es/v1/plan_service_pb";
@@ -69,11 +68,9 @@ export const provideIsolationLevelSettingContext = (refs: {
if (selectedSpec.value.config?.case !== "changeDatabaseConfig") {
return false;
}
- return [
- DatabaseChangeType.DATA,
- DatabaseChangeType.MIGRATE,
- DatabaseChangeType.MIGRATE_GHOST,
- ].includes(selectedSpec.value.config.value.type);
+ const config = selectedSpec.value.config.value;
+ // Show for all MIGRATE types (DDL, DML, Ghost), but not SDL
+ return config.type === DatabaseChangeType.MIGRATE;
});
const allowChange = computed(() => {
diff --git a/frontend/src/components/Plan/components/Configuration/PreBackupSection/context.ts b/frontend/src/components/Plan/components/Configuration/PreBackupSection/context.ts
index 8e11304587..97c7e54de6 100644
--- a/frontend/src/components/Plan/components/Configuration/PreBackupSection/context.ts
+++ b/frontend/src/components/Plan/components/Configuration/PreBackupSection/context.ts
@@ -13,7 +13,11 @@ import { isDatabaseChangeSpec, targetsForSpec } from "@/components/Plan/logic";
import { planServiceClientConnect } from "@/grpcweb";
import { useCurrentUserV1, extractUserId, useDatabaseV1Store } from "@/store";
import { isValidDatabaseName } from "@/types";
-import { DatabaseChangeType, Engine } from "@/types/proto-es/v1/common_pb";
+import {
+ DatabaseChangeType,
+ Engine,
+ MigrationType,
+} from "@/types/proto-es/v1/common_pb";
import { IssueStatus, type Issue } from "@/types/proto-es/v1/issue_service_pb";
import {
UpdatePlanRequestSchema,
@@ -73,8 +77,16 @@ export const providePreBackupSettingContext = (refs: {
const shouldShow = computed((): boolean => {
if (
!selectedSpec.value ||
- selectedSpec.value.config?.case !== "changeDatabaseConfig" ||
- selectedSpec.value.config.value.type !== DatabaseChangeType.DATA
+ selectedSpec.value.config?.case !== "changeDatabaseConfig"
+ ) {
+ return false;
+ }
+ const config = selectedSpec.value.config.value;
+ if (
+ !(
+ config.type === DatabaseChangeType.MIGRATE &&
+ config.migrationType === MigrationType.DML
+ )
) {
return false;
}
diff --git a/frontend/src/components/Plan/components/Configuration/TransactionModeSection/context.ts b/frontend/src/components/Plan/components/Configuration/TransactionModeSection/context.ts
index 32d4018a67..93a5e11f87 100644
--- a/frontend/src/components/Plan/components/Configuration/TransactionModeSection/context.ts
+++ b/frontend/src/components/Plan/components/Configuration/TransactionModeSection/context.ts
@@ -62,11 +62,9 @@ export const provideTransactionModeSettingContext = (refs: {
if (selectedSpec.value.config?.case !== "changeDatabaseConfig") {
return false;
}
- return [
- DatabaseChangeType.DATA,
- DatabaseChangeType.MIGRATE,
- DatabaseChangeType.MIGRATE_GHOST,
- ].includes(selectedSpec.value.config.value.type);
+ const config = selectedSpec.value.config.value;
+ // Show for all MIGRATE types (DDL, DML, Ghost), but not SDL
+ return config.type === DatabaseChangeType.MIGRATE;
});
const allowChange = computed(() => {
diff --git a/frontend/src/components/Plan/components/RolloutView/TaskRolloutActionPanel.vue b/frontend/src/components/Plan/components/RolloutView/TaskRolloutActionPanel.vue
index 32be106844..bec68d8f06 100644
--- a/frontend/src/components/Plan/components/RolloutView/TaskRolloutActionPanel.vue
+++ b/frontend/src/components/Plan/components/RolloutView/TaskRolloutActionPanel.vue
@@ -103,12 +103,32 @@
:style="{ height: `${itemHeight}px` }"
>
<NTag
- v-if="semanticTaskType(task.type)"
+ v-if="
+ semanticTaskType(
+ task.type,
+ task.payload?.case === 'databaseUpdate'
+ ? task.payload.value.databaseChangeType
+ : undefined,
+ task.payload?.case === 'databaseUpdate'
+ ? task.payload.value.migrationType
+ : undefined
+ )
+ "
class="mr-2"
size="small"
>
<span class="inline-block text-center">
- {{ semanticTaskType(task.type) }}
+ {{
+ semanticTaskType(
+ task.type,
+ task.payload?.case === "databaseUpdate"
+ ? task.payload.value.databaseChangeType
+ : undefined,
+ task.payload?.case === "databaseUpdate"
+ ? task.payload.value.migrationType
+ : undefined
+ )
+ }}
</span>
</NTag>
<TaskDatabaseName :task="task" />
@@ -125,12 +145,32 @@
class="flex items-center"
>
<NTag
- v-if="semanticTaskType(task.type)"
+ v-if="
+ semanticTaskType(
+ task.type,
+ task.payload?.case === 'databaseUpdate'
+ ? task.payload.value.databaseChangeType
+ : undefined,
+ task.payload?.case === 'databaseUpdate'
+ ? task.payload.value.migrationType
+ : undefined
+ )
+ "
class="mr-2"
size="small"
>
<span class="inline-block text-center">
- {{ semanticTaskType(task.type) }}
+ {{
+ semanticTaskType(
+ task.type,
+ task.payload?.case === "databaseUpdate"
+ ? task.payload.value.databaseChangeType
+ : undefined,
+ task.payload?.case === "databaseUpdate"
+ ? task.payload.value.migrationType
+ : undefined
+ )
+ }}
</span>
</NTag>
<TaskDatabaseName :task="task" />
diff --git a/frontend/src/components/Plan/components/RolloutView/TaskRunRollbackDrawer.vue b/frontend/src/components/Plan/components/RolloutView/TaskRunRollbackDrawer.vue
index f76e5fc455..8b77a23c32 100644
--- a/frontend/src/components/Plan/components/RolloutView/TaskRunRollbackDrawer.vue
+++ b/frontend/src/components/Plan/components/RolloutView/TaskRunRollbackDrawer.vue
@@ -139,7 +139,10 @@ import {
useCurrentProjectV1,
useSheetV1Store,
} from "@/store";
-import { DatabaseChangeType } from "@/types/proto-es/v1/common_pb";
+import {
+ DatabaseChangeType,
+ MigrationType,
+} from "@/types/proto-es/v1/common_pb";
import type { Plan_Spec } from "@/types/proto-es/v1/plan_service_pb";
import {
CreatePlanRequestSchema,
@@ -313,7 +316,8 @@ const handleConfirm = async () => {
case: "changeDatabaseConfig",
value: create(Plan_ChangeDatabaseConfigSchema, {
targets: [preview.task.target],
- type: DatabaseChangeType.DATA,
+ type: DatabaseChangeType.MIGRATE,
+ migrationType: MigrationType.DML,
sheet: sheet.name,
}),
},
diff --git a/frontend/src/components/Plan/components/RolloutView/TaskTable.vue b/frontend/src/components/Plan/components/RolloutView/TaskTable.vue
index 21e64ea92a..241a105dca 100644
--- a/frontend/src/components/Plan/components/RolloutView/TaskTable.vue
+++ b/frontend/src/components/Plan/components/RolloutView/TaskTable.vue
@@ -203,7 +203,15 @@ const columnList = computed((): DataTableColumn<Task>[] => {
<div class="flex items-center gap-2">
<DatabaseDisplay database={task.target} />
<NTag round size="small">
- {semanticTaskType(task.type)}
+ {semanticTaskType(
+ task.type,
+ task.payload?.case === "databaseUpdate"
+ ? task.payload.value.databaseChangeType
+ : undefined,
+ task.payload?.case === "databaseUpdate"
+ ? task.payload.value.migrationType
+ : undefined
+ )}
</NTag>
{schemaVersion && (
<NTag round size="small">
diff --git a/frontend/src/components/Plan/components/RolloutView/TaskView.vue b/frontend/src/components/Plan/components/RolloutView/TaskView.vue
index 24977ece34..d6bd0cf402 100644
--- a/frontend/src/components/Plan/components/RolloutView/TaskView.vue
+++ b/frontend/src/components/Plan/components/RolloutView/TaskView.vue
@@ -12,7 +12,17 @@
</div>
<div class="flex flex-row gap-x-2 flex-wrap">
<NTag round>
- {{ semanticTaskType(task.type) }}
+ {{
+ semanticTaskType(
+ task.type,
+ task.payload?.case === "databaseUpdate"
+ ? task.payload.value.databaseChangeType
+ : undefined,
+ task.payload?.case === "databaseUpdate"
+ ? task.payload.value.migrationType
+ : undefined
+ )
+ }}
</NTag>
<NTooltip v-if="schemaVersion">
<template #trigger>
diff --git a/frontend/src/components/Plan/components/SQLCheckSection/common.ts b/frontend/src/components/Plan/components/SQLCheckSection/common.ts
index bf9647516b..a3a92ab151 100644
--- a/frontend/src/components/Plan/components/SQLCheckSection/common.ts
+++ b/frontend/src/components/Plan/components/SQLCheckSection/common.ts
@@ -1,4 +1,7 @@
-import { DatabaseChangeType } from "@/types/proto-es/v1/common_pb";
+import {
+ DatabaseChangeType,
+ MigrationType,
+} from "@/types/proto-es/v1/common_pb";
import type { Plan_Spec } from "@/types/proto-es/v1/plan_service_pb";
import { Release_File_ChangeType } from "@/types/proto-es/v1/release_service_pb";
@@ -13,13 +16,16 @@ export const getSpecChangeType = (
spec?.config?.case === "changeDatabaseConfig"
? spec.config.value
: undefined;
- switch (changeDatabaseConfig?.type) {
- case DatabaseChangeType.MIGRATE:
- return Release_File_ChangeType.DDL;
- case DatabaseChangeType.MIGRATE_GHOST:
- return Release_File_ChangeType.DDL_GHOST;
- case DatabaseChangeType.DATA:
+ if (changeDatabaseConfig?.type === DatabaseChangeType.MIGRATE) {
+ if (changeDatabaseConfig.migrationType === MigrationType.DML) {
return Release_File_ChangeType.DML;
+ } else if (changeDatabaseConfig.migrationType === MigrationType.GHOST) {
+ return Release_File_ChangeType.DDL_GHOST;
+ }
+ return Release_File_ChangeType.DDL;
+ }
+ if (changeDatabaseConfig?.type === DatabaseChangeType.SDL) {
+ return Release_File_ChangeType.DDL;
}
// Default to DDL if no type is specified.
return Release_File_ChangeType.DDL;
diff --git a/frontend/src/components/Plan/components/SQLCheckV1Section/SQLCheckV1Section.vue b/frontend/src/components/Plan/components/SQLCheckV1Section/SQLCheckV1Section.vue
index 2ea298d654..25bc9484b4 100644
--- a/frontend/src/components/Plan/components/SQLCheckV1Section/SQLCheckV1Section.vue
+++ b/frontend/src/components/Plan/components/SQLCheckV1Section/SQLCheckV1Section.vue
@@ -96,7 +96,10 @@ import Drawer from "@/components/v2/Container/Drawer.vue";
import DrawerContent from "@/components/v2/Container/DrawerContent.vue";
import { releaseServiceClientConnect } from "@/grpcweb";
import { projectNamePrefix } from "@/store";
-import { DatabaseChangeType } from "@/types/proto-es/v1/common_pb";
+import {
+ DatabaseChangeType,
+ MigrationType,
+} from "@/types/proto-es/v1/common_pb";
import {
PlanCheckRun_Type,
PlanCheckRun_Status,
@@ -221,7 +224,8 @@ const runChecks = async () => {
type: Release_File_Type.VERSIONED,
statement: new TextEncoder().encode(statement),
changeType:
- config.type === DatabaseChangeType.DATA
+ config.type === DatabaseChangeType.MIGRATE &&
+ config.migrationType === MigrationType.DML
? Release_File_ChangeType.DML
: Release_File_ChangeType.DDL,
},
diff --git a/frontend/src/components/Plan/logic/initialize/create.ts b/frontend/src/components/Plan/logic/initialize/create.ts
index 3012ecf671..d3ae8dbca1 100644
--- a/frontend/src/components/Plan/logic/initialize/create.ts
+++ b/frontend/src/components/Plan/logic/initialize/create.ts
@@ -12,6 +12,7 @@ import type { IssueType } from "@/types";
import {
DatabaseChangeType,
ExportFormat,
+ MigrationType,
} from "@/types/proto-es/v1/common_pb";
import type { Plan_Spec } from "@/types/proto-es/v1/plan_service_pb";
import {
@@ -163,10 +164,11 @@ const buildSpecForTargetsV1 = async (
value: createProto(Plan_ChangeDatabaseConfigSchema, {
targets,
sheet,
- type:
+ type: DatabaseChangeType.MIGRATE,
+ migrationType:
template === "bb.issue.database.data.update"
- ? DatabaseChangeType.DATA
- : DatabaseChangeType.MIGRATE,
+ ? MigrationType.DML
+ : MigrationType.DDL,
enablePriorBackup:
template === "bb.issue.database.data.update" &&
project.autoEnableBackup,
diff --git a/frontend/src/components/Plan/logic/utils.ts b/frontend/src/components/Plan/logic/utils.ts
index 1d518719be..1554840c65 100644
--- a/frontend/src/components/Plan/logic/utils.ts
+++ b/frontend/src/components/Plan/logic/utils.ts
@@ -4,7 +4,10 @@ import { planServiceClientConnect } from "@/grpcweb";
import { t } from "@/plugins/i18n";
import { projectNamePrefix, useSheetV1Store } from "@/store";
import { useProjectV1Store } from "@/store";
-import { DatabaseChangeType } from "@/types/proto-es/v1/common_pb";
+import {
+ DatabaseChangeType,
+ MigrationType,
+} from "@/types/proto-es/v1/common_pb";
import type { Plan, Plan_Spec } from "@/types/proto-es/v1/plan_service_pb";
import { UpdatePlanRequestSchema } from "@/types/proto-es/v1/plan_service_pb";
import type { Project } from "@/types/proto-es/v1/project_service_pb";
@@ -22,22 +25,19 @@ export const getSpecTitle = (spec: Plan_Spec): string => {
if (spec.config?.case === "createDatabaseConfig") {
title = t("plan.spec.type.create-database");
} else if (spec.config?.case === "changeDatabaseConfig") {
- const changeType = spec.config.value.type;
- switch (changeType) {
- case DatabaseChangeType.MIGRATE:
- title = t("plan.spec.type.schema-change");
- break;
- case DatabaseChangeType.MIGRATE_SDL:
- title = "SDL";
- break;
- case DatabaseChangeType.MIGRATE_GHOST:
- title = t("plan.spec.type.ghost-migration");
- break;
- case DatabaseChangeType.DATA:
+ const config = spec.config.value;
+ if (config.type === DatabaseChangeType.MIGRATE) {
+ if (config.migrationType === MigrationType.DML) {
title = t("plan.spec.type.data-change");
- break;
- default:
- title = t("plan.spec.type.database-change");
+ } else if (config.migrationType === MigrationType.GHOST) {
+ title = t("plan.spec.type.ghost-migration");
+ } else {
+ title = t("plan.spec.type.schema-change");
+ }
+ } else if (config.type === DatabaseChangeType.SDL) {
+ title = "SDL";
+ } else {
+ title = t("plan.spec.type.database-change");
}
} else if (spec.config?.case === "exportDataConfig") {
title = t("plan.spec.type.export-data");
diff --git a/frontend/src/components/Release/ReleaseDetail/NavBar/ApplyToDatabasePanel.vue b/frontend/src/components/Release/ReleaseDetail/NavBar/ApplyToDatabasePanel.vue
index 3c4e44211e..04c47f9cd1 100644
--- a/frontend/src/components/Release/ReleaseDetail/NavBar/ApplyToDatabasePanel.vue
+++ b/frontend/src/components/Release/ReleaseDetail/NavBar/ApplyToDatabasePanel.vue
@@ -62,12 +62,17 @@ import { planServiceClientConnect } from "@/grpcweb";
import { PROJECT_V1_ROUTE_ISSUE_DETAIL } from "@/router/dashboard/projectV1";
import { useDatabaseV1Store, useDBGroupStore } from "@/store";
import { getProjectNameReleaseId } from "@/store/modules/v1/common";
+import {
+ DatabaseChangeType,
+ MigrationType,
+} from "@/types/proto-es/v1/common_pb";
import { DatabaseGroupSchema } from "@/types/proto-es/v1/database_group_service_pb";
import { CreatePlanRequestSchema } from "@/types/proto-es/v1/plan_service_pb";
import {
PlanSchema,
Plan_ChangeDatabaseConfigSchema,
} from "@/types/proto-es/v1/plan_service_pb";
+import { Release_File_ChangeType } from "@/types/proto-es/v1/release_service_pb";
import { generateIssueTitle, issueV1Slug } from "@/utils";
import { useReleaseDetailContext } from "../context";
import { createIssueFromPlan } from "./utils";
@@ -115,6 +120,25 @@ const handleCreate = async () => {
state.targetSelectState.selectedDatabaseGroup || ""
)
);
+
+ // Determine migration type from release files
+ let migrationType = MigrationType.DDL;
+ const firstFile = release.value.files?.[0];
+ if (firstFile) {
+ switch (firstFile.changeType) {
+ case Release_File_ChangeType.DML:
+ migrationType = MigrationType.DML;
+ break;
+ case Release_File_ChangeType.DDL_GHOST:
+ migrationType = MigrationType.GHOST;
+ break;
+ case Release_File_ChangeType.DDL:
+ default:
+ migrationType = MigrationType.DDL;
+ break;
+ }
+ }
+
const newPlan = create(PlanSchema, {
title: `Release "${release.value.title}"`,
description: `Apply release "${release.value.title}" to selected databases.`,
@@ -129,6 +153,8 @@ const handleCreate = async () => {
? state.targetSelectState.selectedDatabaseNameList
: [state.targetSelectState.selectedDatabaseGroup!]) || [],
release: release.value.name,
+ type: DatabaseChangeType.MIGRATE,
+ migrationType,
}),
},
},
diff --git a/frontend/src/types/proto-es/v1/common_pb.d.ts b/frontend/src/types/proto-es/v1/common_pb.d.ts
index dac8bab014..f69e241b19 100644
--- a/frontend/src/types/proto-es/v1/common_pb.d.ts
+++ b/frontend/src/types/proto-es/v1/common_pb.d.ts
@@ -306,36 +306,60 @@ export enum DatabaseChangeType {
DATABASE_CHANGE_TYPE_UNSPECIFIED = 0,
/**
- * Used for DDL changes including CREATE DATABASE.
+ * Used for imperative schema migration including CREATE DATABASE.
*
* @generated from enum value: MIGRATE = 2;
*/
MIGRATE = 2,
/**
- * Used for schema changes via state-based schema migration including CREATE DATABASE.
+ * Used for state-based declarative schema migration including CREATE DATABASE.
*
- * @generated from enum value: MIGRATE_SDL = 3;
+ * @generated from enum value: SDL = 3;
*/
- MIGRATE_SDL = 3,
+ SDL = 3,
+}
+
+/**
+ * Describes the enum bytebase.v1.DatabaseChangeType.
+ */
+export declare const DatabaseChangeTypeSchema: GenEnum<DatabaseChangeType>;
+/**
+ * MigrationType is the type for imperative schema migration.
+ *
+ * @generated from enum bytebase.v1.MigrationType
+ */
+export enum MigrationType {
/**
- * Used for DDL changes using gh-ost.
+ * @generated from enum value: MIGRATION_TYPE_UNSPECIFIED = 0;
+ */
+ MIGRATION_TYPE_UNSPECIFIED = 0,
+
+ /**
+ * Used for DDL changes.
+ *
+ * @generated from enum value: DDL = 1;
+ */
+ DDL = 1,
+
+ /**
+ * Used for DML changes.
*
- * @generated from enum value: MIGRATE_GHOST = 4;
+ * @generated from enum value: DML = 2;
*/
- MIGRATE_GHOST = 4,
+ DML = 2,
/**
- * Used for DML change.
+ * Used for DDL changes using gh-ost.
*
- * @generated from enum value: DATA = 6;
+ * @generated from enum value: GHOST = 3;
*/
- DATA = 6,
+ GHOST = 3,
}
/**
- * Describes the enum bytebase.v1.DatabaseChangeType.
+ * Describes the enum bytebase.v1.MigrationType.
*/
-export declare const DatabaseChangeTypeSchema: GenEnum<DatabaseChangeType>;
+export declare const MigrationTypeSchema: GenEnum<MigrationType>;
diff --git a/frontend/src/types/proto-es/v1/common_pb.js b/frontend/src/types/proto-es/v1/common_pb.js
index e7ded00068..a78f7ad455 100644
--- a/frontend/src/types/proto-es/v1/common_pb.js
+++ b/frontend/src/types/proto-es/v1/common_pb.js
@@ -8,7 +8,7 @@ import { enumDesc, fileDesc, messageDesc, tsEnum } from "@bufbuild/protobuf/code
* Describes the file v1/common.proto.
*/
export const file_v1_common = /*@__PURE__*/
- fileDesc("Cg92MS9jb21tb24ucHJvdG8SC2J5dGViYXNlLnYxIigKCFBvc2l0aW9uEgw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EVfVU5TUEVDSUZJRUQQABILCgdNSUdSQVRFEAISBwoDU0RMEAMqTAoNTWlncmF0aW9uVHlwZRIeChpNSUdSQVRJT05fVFlQRV9VTlNQRUNJRklFRBAAEgcKA0RETBABEgcKA0RNTBACEgkKBUdIT1NUEANCNlo0Z2l0aHViLmNvbS9ieXRlYmFzZS9ieXRlYmFzZS9iYWNrZW5kL2dlbmVyYXRlZC1nby92MWIGcHJvdG8z");
/**
* Describes the message bytebase.v1.Position.
@@ -86,3 +86,17 @@ export const DatabaseChangeTypeSchema = /*@__PURE__*/
export const DatabaseChangeType = /*@__PURE__*/
tsEnum(DatabaseChangeTypeSchema);
+/**
+ * Describes the enum bytebase.v1.MigrationType.
+ */
+export const MigrationTypeSchema = /*@__PURE__*/
+ enumDesc(file_v1_common, 5);
+
+/**
+ * MigrationType is the type for imperative schema migration.
+ *
+ * @generated from enum bytebase.v1.MigrationType
+ */
+export const MigrationType = /*@__PURE__*/
+ tsEnum(MigrationTypeSchema);
+
diff --git a/frontend/src/types/proto-es/v1/plan_service_pb.d.ts b/frontend/src/types/proto-es/v1/plan_service_pb.d.ts
index dd11141b22..d8de776ba7 100644
--- a/frontend/src/types/proto-es/v1/plan_service_pb.d.ts
+++ b/frontend/src/types/proto-es/v1/plan_service_pb.d.ts
@@ -5,7 +5,7 @@
import type { GenEnum, GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv2";
import type { Message } from "@bufbuild/protobuf";
import type { FieldMask, Timestamp } from "@bufbuild/protobuf/wkt";
-import type { DatabaseChangeType, ExportFormat, Position, State } from "./common_pb";
+import type { DatabaseChangeType, ExportFormat, MigrationType, Position, State } from "./common_pb";
import type { ChangedResources } from "./database_service_pb";
/**
@@ -494,6 +494,14 @@ export declare type Plan_ChangeDatabaseConfig = Message<"bytebase.v1.Plan.Change
*/
type: DatabaseChangeType;
+ /**
+ * migration_type is the migration type for imperative schema migration.
+ * It is only set when type is MIGRATE.
+ *
+ * @generated from field: bytebase.v1.MigrationType migration_type = 11;
+ */
+ migrationType: MigrationType;
+
/**
* @generated from field: map<string, string> ghost_flags = 7;
*/
diff --git a/frontend/src/types/proto-es/v1/plan_service_pb.js b/frontend/src/types/proto-es/v1/plan_service_pb.js
index 568bce9cf3..462e12efc5 100644
--- a/frontend/src/types/proto-es/v1/plan_service_pb.js
+++ b/frontend/src/types/proto-es/v1/plan_service_pb.js
@@ -16,7 +16,7 @@ import { file_v1_database_service } from "./database_service_pb";
* Describes the file v1/plan_service.proto.
*/
export const file_v1_plan_service = /*@__PURE__*/
- fileDesc("ChV2MS9wbGFuX3NlcnZpY2UucHJvdG8SC2J5dGViYXNlLnYxIjkKDkdldFBsYW5SZXF1ZXN0EicKBG5hbWUYASABKAlCGeBBAvpBEwoRYnl0ZWJhc2UuY29tL1BsYW4iZwoQTGlzdFBsYW5zUmVxdWVzdBIsCgZwYXJlbnQYASABKAlCHOBBAvpBFgoUYnl0ZWJhc2UuY29tL1Byb2plY3QSEQoJcGFnZV9zaXplGAIgASgFEhIKCnBhZ2VfdG9rZW4YAyABKAkiTgoRTGlzdFBsYW5zUmVzcG9uc2USIAoFcGxhbnMYASADKAsyES5ieXRlYmFzZS52MS5QbGFuEhcKD25leHRfcGFnZV90b2tlbhgCIAEoCSJgChJTZWFyY2hQbGFuc1JlcXVlc3QSEwoGcGFyZW50GAEgASgJQgPgQQISEQoJcGFnZV9zaXplGAIgASgFEhIKCnBhZ2VfdG9rZW4YAyABKAkSDgoGZmlsdGVyGAQgASgJIlAKE1NlYXJjaFBsYW5zUmVzcG9uc2USIAoFcGxhbnMYASADKAsyES5ieXRlYmFzZS52MS5QbGFuEhcKD25leHRfcGFnZV90b2tlbhgCIAEoCSJnChFDcmVhdGVQbGFuUmVxdWVzdBIsCgZwYXJlbnQYASABKAlCHOBBAvpBFgoUYnl0ZWJhc2UuY29tL1Byb2plY3QSJAoEcGxhbhgCIAEoCzIRLmJ5dGViYXNlLnYxLlBsYW5CA+BBAiKGAQoRVXBkYXRlUGxhbl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ASoiOS92MS97cGFyZW50PXByb2plY3RzLyovcGxhbnMvKn0vcGxhbkNoZWNrUnVuczpiYXRjaENhbmNlbEI2WjRnaXRodWIuY29tL2J5dGViYXNlL2J5dGViYXNlL2JhY2tlbmQvZ2VuZXJhdGVkLWdvL3YxYgZwcm90bzM", [file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_field_mask, file_google_protobuf_timestamp, file_v1_annotation, file_v1_common, file_v1_database_service]);
+ fileDesc("ChV2MS9wbGFuX3NlcnZpY2UucHJvdG8SC2J5dGViYXNlLnYxIjkKDkdldFBsYW5SZXF1ZXN0EicKBG5hbWUYASABKAlCGeBBAvpBEwoRYnl0ZWJhc2UuY29tL1BsYW4iZwoQTGlzdFBsYW5zUmVxdWVzdBIsCgZwYXJlbnQYASABKAlCHOBBAvpBFgoUYnl0ZWJhc2UuY29tL1Byb2plY3QSEQoJcGFnZV9zaXplGAIgASgFEhIKCnBhZ2VfdG9rZW4YAyABKAkiTgoRTGlzdFBsYW5zUmVzcG9uc2USIAoFcGxhbnMYASADKAsyES5ieXRlYmFzZS52MS5QbGFuEhcKD25leHRfcGFnZV90b2tlbhgCIAEoCSJgChJTZWFyY2hQbGFuc1JlcXVlc3QSEwoGcGFyZW50GAEgASgJQgPgQQISEQoJcGFnZV9zaXplGAIgASgFEhIKCnBhZ2VfdG9rZW4YAyABKAkSDgoGZmlsdGVyGAQgASgJIlAKE1NlYXJjaFBsYW5zUmVzcG9uc2USIAoFcGxhbnMYASADKAsyES5ieXRlYmFzZS52MS5QbGFuEhcKD25leHRfcGFnZV90b2tlbhgCIAEoCSJnChFDcmVhdGVQbGFuUmVxdWVzdBIsCgZwYXJlbnQYASABKAlCHOBBAvpBFgoUYnl0ZWJhc2UuY29tL1Byb2plY3QSJAoEcGxhbhgCIAEoCzIRLmJ5dGViYXNlLnYxLlBsYW5CA+BBAiKGAQoRVXBkYXRlUGxhblJlcXVlc3QSJAoEcGxhbhgBIAEoCzI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GxhbkNoZWNrUnVucy5ydW6Q6jABgtPkkwI+OgEqIjkvdjEve3BhcmVudD1wcm9qZWN0cy8qL3BsYW5zLyp9L3BsYW5DaGVja1J1bnM6YmF0Y2hDYW5jZWxCNlo0Z2l0aHViLmNvbS9ieXRlYmFzZS9ieXRlYmFzZS9iYWNrZW5kL2dlbmVyYXRlZC1nby92MWIGcHJvdG8z", [file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_field_mask, file_google_protobuf_timestamp, file_v1_annotation, file_v1_common, file_v1_database_service]);
/**
* Describes the message bytebase.v1.GetPlanRequest.
diff --git a/frontend/src/types/proto-es/v1/rollout_service_pb.d.ts b/frontend/src/types/proto-es/v1/rollout_service_pb.d.ts
index 24309e765b..5d7b6f5786 100644
--- a/frontend/src/types/proto-es/v1/rollout_service_pb.d.ts
+++ b/frontend/src/types/proto-es/v1/rollout_service_pb.d.ts
@@ -6,7 +6,7 @@ import type { GenEnum, GenFile, GenMessage, GenService } from "@bufbuild/protobu
import type { Message } from "@bufbuild/protobuf";
import type { Timestamp } from "@bufbuild/protobuf/wkt";
import type { Plan } from "./plan_service_pb";
-import type { ExportFormat, Position } from "./common_pb";
+import type { DatabaseChangeType, ExportFormat, MigrationType, Position } from "./common_pb";
/**
* Describes the file v1/rollout_service.proto.
@@ -217,8 +217,8 @@ export declare type ListRolloutsRequest = Message<"bytebase.v1.ListRolloutsReque
*
* For example:
* creator == "users/[email protected]" && update_time >= "2025-01-02T15:04:05Z07:00"
- * task_type == "DATABASE_SCHEMA_UPDATE"
- * task_type in ["DATABASE_SCHEMA_UPDATE", "DATABASE_DATA_UPDATE"]
+ * task_type == "DATABASE_MIGRATE"
+ * task_type in ["DATABASE_MIGRATE", "DATABASE_EXPORT"]
*
* @generated from field: string filter = 4;
*/
@@ -701,6 +701,18 @@ export declare type Task_DatabaseUpdate = Message<"bytebase.v1.Task.DatabaseUpda
* @generated from field: string schema_version = 2;
*/
schemaVersion: string;
+
+ /**
+ * @generated from field: bytebase.v1.DatabaseChangeType database_change_type = 3;
+ */
+ databaseChangeType: DatabaseChangeType;
+
+ /**
+ * migration_type is only set when database_change_type is MIGRATE.
+ *
+ * @generated from field: bytebase.v1.MigrationType migration_type = 4;
+ */
+ migrationType: MigrationType;
};
/**
@@ -825,37 +837,23 @@ export enum Task_Type {
/**
* use payload DatabaseUpdate
*
- * @generated from enum value: DATABASE_SCHEMA_UPDATE = 4;
- */
- DATABASE_SCHEMA_UPDATE = 4,
-
- /**
- * use payload DatabaseUpdate
- *
- * @generated from enum value: DATABASE_SCHEMA_UPDATE_SDL = 5;
- */
- DATABASE_SCHEMA_UPDATE_SDL = 5,
-
- /**
- * use payload DatabaseUpdate
- *
- * @generated from enum value: DATABASE_SCHEMA_UPDATE_GHOST = 9;
+ * @generated from enum value: DATABASE_MIGRATE = 3;
*/
- DATABASE_SCHEMA_UPDATE_GHOST = 9,
+ DATABASE_MIGRATE = 3,
/**
* use payload DatabaseUpdate
*
- * @generated from enum value: DATABASE_DATA_UPDATE = 8;
+ * @generated from enum value: DATABASE_SDL = 6;
*/
- DATABASE_DATA_UPDATE = 8,
+ DATABASE_SDL = 6,
/**
* use payload DatabaseDataExport
*
- * @generated from enum value: DATABASE_EXPORT = 12;
+ * @generated from enum value: DATABASE_EXPORT = 5;
*/
- DATABASE_EXPORT = 12,
+ DATABASE_EXPORT = 5,
}
/**
diff --git a/frontend/src/types/proto-es/v1/rollout_service_pb.js b/frontend/src/types/proto-es/v1/rollout_service_pb.js
index c6bdca35ab..47a35eaf13 100644
--- a/frontend/src/types/proto-es/v1/rollout_service_pb.js
+++ b/frontend/src/types/proto-es/v1/rollout_service_pb.js
@@ -16,7 +16,7 @@ import { file_v1_plan_service } from "./plan_service_pb";
* Describes the file v1/rollout_service.proto.
*/
export const file_v1_rollout_service = /*@__PURE__*/
- fileDesc("Chh2MS9yb2xsb3V0X3NlcnZpY2UucHJvdG8SC2J5dGViYXNlLnYxIoUBChRCYXRjaFJ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um9sbGJhY2tCNlo0Z2l0aHViLmNvbS9ieXRlYmFzZS9ieXRlYmFzZS9iYWNrZW5kL2dlbmVyYXRlZC1nby92MWIGcHJvdG8z", [file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_timestamp, file_v1_annotation, file_v1_common, file_v1_plan_service]);
+ fileDesc("Chh2MS9yb2xsb3V0X3NlcnZpY2UucHJvdG8SC2J5dGViYXNlLnYxIoUBChRCYXRjaFJ1blRhc2tzUmVxdWVzdBIOCgZwYXJlbnQYASABKAkSDQoFdGFza3MYAiADKAkSDgoGcmVhc29uGAMgASgJEjEKCHJ1bl90aW1lGAQgASgLMhouZ29vZ2xlLnByb3RvYnVmLlRpbWVzdGFtcEgAiAEBQgsKCV9ydW5fdGltZSIXChVCYXRjaFJ1blRhc2tzUmVzcG9uc2UiRgoVQmF0Y2hTa2lwVGFza3NSZXF1ZXN0Eg4KBnBhcmVudBgBIAEoCRINCgV0YXNrcxgCIAMoCRIOCgZyZWFzb24YAyABKAkiGAoWQmF0Y2hTa2lwVGFza3NSZXNwb25zZSJPChpCYXRjaENhbmNlbFRhc2tSdW5zUmVxdWVzdBIOCgZwYXJlbnQYASABKAkSEQoJdGFza19ydW5zGAIgAygJEg4KBnJlYXNvbhgDIAEoCSIdChtCYXRjaENhbmNlbFRhc2tSdW5zUmVzcG9uc2UiPwoRR2V0Um9sbG91dFJlcXVlc3QSKgoEbmFtZRgBIAEoCUIc4EEC+kEWChRieXRlYmFzZS5jb20vUm9sbG91dCJ6ChNMaXN0Um9sbG91dHNSZXF1ZXN0EiwKBnBhcmVudBgBIAEoCUIc4EEC+kEWChRieXRlYmFzZS5jb20vUHJvamVjdBIRCglwYWdlX3NpemUYAiABKAUSEgoKcGFnZV90b2tlbhgDIAEoCRIOCgZmaWx0ZXIYBCABKAkiVwoUTGlzdFJvbGxvdXRzUmVzcG9uc2USJgoIcm9sbG91dHMYASADKAsyFC5ieXRlYmFzZS52MS5Sb2xsb3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6QEKFlByZXZpZXdUYXNrUnVuUm9sbGJhY2sSKi5ieXRlYmFzZS52MS5QcmV2aWV3VGFza1J1blJvbGxiYWNrUmVxdWVzdBorLmJ5dGViYXNlLnYxLlByZXZpZXdUYXNrUnVuUm9sbGJhY2tSZXNwb25zZSJ22kEEbmFtZYrqMBBiYi50YXNrUnVucy5saXN0kOowAYLT5JMCUToBKiJML3YxL3tuYW1lPXByb2plY3RzLyovcm9sbG91dHMvKi9zdGFnZXMvKi90YXNrcy8qL3Rhc2tSdW5zLyp9OnByZXZpZXdSb2xsYmFja0I2WjRnaXRodWIuY29tL2J5dGViYXNlL2J5dGViYXNlL2JhY2tlbmQvZ2VuZXJhdGVkLWdvL3YxYgZwcm90bzM", [file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_timestamp, file_v1_annotation, file_v1_common, file_v1_plan_service]);
/**
* Describes the message bytebase.v1.BatchRunTasksRequest.
diff --git a/frontend/src/types/v1/issue/rollout.ts b/frontend/src/types/v1/issue/rollout.ts
index b7909de843..502bae6006 100644
--- a/frontend/src/types/v1/issue/rollout.ts
+++ b/frontend/src/types/v1/issue/rollout.ts
@@ -43,9 +43,7 @@ export const unknownTask = () => {
export const TaskTypeListWithStatement: Task_Type[] = [
Task_Type.GENERAL,
Task_Type.DATABASE_CREATE,
- Task_Type.DATABASE_DATA_UPDATE,
- Task_Type.DATABASE_SCHEMA_UPDATE,
- Task_Type.DATABASE_SCHEMA_UPDATE_SDL,
- Task_Type.DATABASE_SCHEMA_UPDATE_GHOST,
+ Task_Type.DATABASE_MIGRATE,
+ Task_Type.DATABASE_SDL,
Task_Type.DATABASE_EXPORT,
];
diff --git a/frontend/src/utils/v1/issue/issue.ts b/frontend/src/utils/v1/issue/issue.ts
index 386ef3e0ec..5a9a51afe2 100644
--- a/frontend/src/utils/v1/issue/issue.ts
+++ b/frontend/src/utils/v1/issue/issue.ts
@@ -30,10 +30,8 @@ export const flattenTaskV1List = (rollout: Rollout | undefined) => {
const DATABASE_RELATED_TASK_TYPE_LIST = [
Task_Type.DATABASE_CREATE,
- Task_Type.DATABASE_SCHEMA_UPDATE,
- Task_Type.DATABASE_SCHEMA_UPDATE_GHOST,
- Task_Type.DATABASE_SCHEMA_UPDATE_SDL,
- Task_Type.DATABASE_DATA_UPDATE,
+ Task_Type.DATABASE_MIGRATE,
+ Task_Type.DATABASE_SDL,
];
export const isDatabaseChangeRelatedIssue = (issue: ComposedIssue): boolean => {
diff --git a/frontend/src/utils/v1/issue/rollout.ts b/frontend/src/utils/v1/issue/rollout.ts
index 8bfc861ea5..e978b84f50 100644
--- a/frontend/src/utils/v1/issue/rollout.ts
+++ b/frontend/src/utils/v1/issue/rollout.ts
@@ -289,10 +289,8 @@ export const databaseForTask = (project: Project, task: Task) => {
// The database is not created yet.
// extract database info from the task's and payload's properties.
return extractCoreDatabaseInfoFromDatabaseCreateTask(project, task);
- case Task_Type.DATABASE_SCHEMA_UPDATE:
- case Task_Type.DATABASE_SCHEMA_UPDATE_SDL:
- case Task_Type.DATABASE_SCHEMA_UPDATE_GHOST:
- case Task_Type.DATABASE_DATA_UPDATE:
+ case Task_Type.DATABASE_MIGRATE:
+ case Task_Type.DATABASE_SDL:
case Task_Type.DATABASE_EXPORT:
const db = useDatabaseV1Store().getDatabaseByName(task.target);
if (!isValidDatabaseName(db.name)) {
diff --git a/frontend/src/views/project/ProjectPlanDashboard.vue b/frontend/src/views/project/ProjectPlanDashboard.vue
index 44ad331744..098667b789 100644
--- a/frontend/src/views/project/ProjectPlanDashboard.vue
+++ b/frontend/src/views/project/ProjectPlanDashboard.vue
@@ -75,7 +75,10 @@ import {
import { usePlanStore } from "@/store/modules/v1/plan";
import { buildPlanFindBySearchParams } from "@/store/modules/v1/plan";
import { isValidDatabaseGroupName, SYSTEM_BOT_USER_NAME } from "@/types";
-import { DatabaseChangeType } from "@/types/proto-es/v1/common_pb";
+import {
+ DatabaseChangeType,
+ MigrationType,
+} from "@/types/proto-es/v1/common_pb";
import { type Plan, type Plan_Spec } from "@/types/proto-es/v1/plan_service_pb";
import { UserType } from "@/types/proto-es/v1/user_service_pb";
import {
@@ -289,7 +292,8 @@ const allowToCreatePlan = computed(() => {
const handleSpecCreated = async (spec: Plan_Spec) => {
const template =
spec.config?.case === "changeDatabaseConfig" &&
- spec.config.value.type === DatabaseChangeType.DATA
+ spec.config.value.type === DatabaseChangeType.MIGRATE &&
+ spec.config.value.migrationType === MigrationType.DML
? "bb.issue.database.data.update"
: "bb.issue.database.schema.update";
const targets = targetsForSpec(spec);
diff --git a/frontend/src/views/project/ProjectRolloutDashboard.vue b/frontend/src/views/project/ProjectRolloutDashboard.vue
index 84f25ea537..ad6e30bd61 100644
--- a/frontend/src/views/project/ProjectRolloutDashboard.vue
+++ b/frontend/src/views/project/ProjectRolloutDashboard.vue
@@ -203,12 +203,7 @@ const rolloutSearchParams = computed(() => {
const mergedRolloutFind = computed((): RolloutFind => {
return buildRolloutFindBySearchParams(rolloutSearchParams.value, {
- taskType: [
- Task_Type.DATABASE_DATA_UPDATE,
- Task_Type.DATABASE_SCHEMA_UPDATE,
- Task_Type.DATABASE_SCHEMA_UPDATE_GHOST,
- Task_Type.DATABASE_SCHEMA_UPDATE_SDL,
- ],
+ taskType: [Task_Type.DATABASE_MIGRATE, Task_Type.DATABASE_SDL],
});
});
diff --git a/proto/gen/grpc-doc/openapi.yaml b/proto/gen/grpc-doc/openapi.yaml
index 976f3a6d87..05c50e6645 100644
--- a/proto/gen/grpc-doc/openapi.yaml
+++ b/proto/gen/grpc-doc/openapi.yaml
@@ -5508,8 +5508,8 @@ paths:
For example:
creator == "users/[email protected]" && update_time >= "2025-01-02T15:04:05Z07:00"
- task_type == "DATABASE_SCHEMA_UPDATE"
- task_type in ["DATABASE_SCHEMA_UPDATE", "DATABASE_DATA_UPDATE"]
+ task_type == "DATABASE_MIGRATE"
+ task_type in ["DATABASE_MIGRATE", "DATABASE_EXPORT"]
schema:
type: string
responses:
@@ -11790,12 +11790,21 @@ components:
enum:
- DATABASE_CHANGE_TYPE_UNSPECIFIED
- MIGRATE
- - MIGRATE_SDL
- - MIGRATE_GHOST
- - DATA
+ - SDL
type: string
description: Type is the database change type.
format: enum
+ migrationType:
+ enum:
+ - MIGRATION_TYPE_UNSPECIFIED
+ - DDL
+ - DML
+ - GHOST
+ type: string
+ description: |-
+ migration_type is the migration type for imperative schema migration.
+ It is only set when type is MIGRATE.
+ format: enum
ghostFlags:
type: object
additionalProperties:
@@ -13987,10 +13996,8 @@ components:
- TYPE_UNSPECIFIED
- GENERAL
- DATABASE_CREATE
- - DATABASE_SCHEMA_UPDATE
- - DATABASE_SCHEMA_UPDATE_SDL
- - DATABASE_SCHEMA_UPDATE_GHOST
- - DATABASE_DATA_UPDATE
+ - DATABASE_MIGRATE
+ - DATABASE_SDL
- DATABASE_EXPORT
type: string
format: enum
@@ -14264,6 +14271,22 @@ components:
description: 'Format: projects/{project}/sheets/{sheet}'
schemaVersion:
type: string
+ databaseChangeType:
+ enum:
+ - DATABASE_CHANGE_TYPE_UNSPECIFIED
+ - MIGRATE
+ - SDL
+ type: string
+ format: enum
+ migrationType:
+ enum:
+ - MIGRATION_TYPE_UNSPECIFIED
+ - DDL
+ - DML
+ - GHOST
+ type: string
+ description: migration_type is only set when database_change_type is MIGRATE.
+ format: enum
TessellationConfig:
type: object
properties:
diff --git a/proto/gen/grpc-doc/store/README.md b/proto/gen/grpc-doc/store/README.md
index 32c09a8bfe..bcd89059bf 100644
--- a/proto/gen/grpc-doc/store/README.md
+++ b/proto/gen/grpc-doc/store/README.md
@@ -188,6 +188,7 @@
- [PlanConfig.ExportDataConfig](#bytebase-store-PlanConfig-ExportDataConfig)
- [PlanConfig.Spec](#bytebase-store-PlanConfig-Spec)
+ - [PlanConfig.ChangeDatabaseConfig.MigrateType](#bytebase-store-PlanConfig-ChangeDatabaseConfig-MigrateType)
- [PlanConfig.ChangeDatabaseConfig.Type](#bytebase-store-PlanConfig-ChangeDatabaseConfig-Type)
- [store/plan_check_run.proto](#store_plan_check_run-proto)
@@ -308,6 +309,7 @@
- [Task.FlagsEntry](#bytebase-store-Task-FlagsEntry)
- [TaskReleaseSource](#bytebase-store-TaskReleaseSource)
+ - [Task.MigrateType](#bytebase-store-Task-MigrateType)
- [Task.Type](#bytebase-store-Task-Type)
- [store/task_run.proto](#store_task_run-proto)
@@ -3091,6 +3093,7 @@ InstanceRole is the API message for instance role.
| sheet | [string](#string) | | The resource name of the sheet. Format: projects/{project}/sheets/{sheet} |
| release | [string](#string) | | The resource name of the release. Format: projects/{project}/releases/{release} |
| type | [PlanConfig.ChangeDatabaseConfig.Type](#bytebase-store-PlanConfig-ChangeDatabaseConfig-Type) | | |
+| migrate_type | [PlanConfig.ChangeDatabaseConfig.MigrateType](#bytebase-store-PlanConfig-ChangeDatabaseConfig-MigrateType) | | |
| ghost_flags | [PlanConfig.ChangeDatabaseConfig.GhostFlagsEntry](#bytebase-store-PlanConfig-ChangeDatabaseConfig-GhostFlagsEntry) | repeated | |
| enable_prior_backup | [bool](#bool) | | If set, a backup of the modified data will be created automatically before any changes are applied. |
@@ -3207,6 +3210,21 @@ InstanceRole is the API message for instance role.
+<a name="bytebase-store-PlanConfig-ChangeDatabaseConfig-MigrateType"></a>
+
+### PlanConfig.ChangeDatabaseConfig.MigrateType
+MigrateType is the migration type for imperative schema migration.
+It is only set when type is MIGRATE.
+
+| Name | Number | Description |
+| ---- | ------ | ----------- |
+| MIGRATE_TYPE_UNSPECIFIED | 0 | |
+| DDL | 1 | Used for DDL changes. |
+| DML | 2 | Used for DML changes. |
+| GHOST | 3 | Used for DDL changes using gh-ost. |
+
+
+
<a name="bytebase-store-PlanConfig-ChangeDatabaseConfig-Type"></a>
### PlanConfig.ChangeDatabaseConfig.Type
@@ -3215,10 +3233,8 @@ Type is the database change type.
| Name | Number | Description |
| ---- | ------ | ----------- |
| TYPE_UNSPECIFIED | 0 | |
-| 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. |
-| DATA | 6 | Used for DML change. |
+| MIGRATE | 2 | Used for imperative schema migration including CREATE DATABASE. |
+| SDL | 3 | Used for state-based declarative schema migration including CREATE DATABASE. |
@@ -4865,6 +4881,7 @@ We support three levels of AlertLevel: INFO, WARNING, and ERROR.
| enable_prior_backup | [bool](#bool) | | |
| flags | [Task.FlagsEntry](#bytebase-store-Task-FlagsEntry) | repeated | ghost flags. |
| task_release_source | [TaskReleaseSource](#bytebase-store-TaskReleaseSource) | | |
+| migrate_type | [Task.MigrateType](#bytebase-store-Task-MigrateType) | | |
| password | [string](#string) | | Export data fields. |
| format | [ExportFormat](#bytebase-store-ExportFormat) | | |
@@ -4906,6 +4923,20 @@ We support three levels of AlertLevel: INFO, WARNING, and ERROR.
+<a name="bytebase-store-Task-MigrateType"></a>
+
+### Task.MigrateType
+MigrateType is the database migration type.
+
+| Name | Number | Description |
+| ---- | ------ | ----------- |
+| MIGRATE_TYPE_UNSPECIFIED | 0 | |
+| DDL | 1 | |
+| DML | 2 | |
+| GHOST | 3 | |
+
+
+
<a name="bytebase-store-Task-Type"></a>
### Task.Type
@@ -4915,11 +4946,9 @@ We support three levels of AlertLevel: INFO, WARNING, and ERROR.
| ---- | ------ | ----------- |
| TASK_TYPE_UNSPECIFIED | 0 | |
| DATABASE_CREATE | 1 | |
-| DATABASE_SCHEMA_UPDATE | 2 | |
-| DATABASE_SCHEMA_UPDATE_GHOST | 3 | |
-| DATABASE_DATA_UPDATE | 4 | |
+| DATABASE_MIGRATE | 2 | |
| DATABASE_EXPORT | 5 | |
-| DATABASE_SCHEMA_UPDATE_SDL | 6 | |
+| DATABASE_SDL | 6 | |
diff --git a/proto/gen/grpc-doc/store/index.html b/proto/gen/grpc-doc/store/index.html
index 0dacd5173f..d99100d2ac 100644
--- a/proto/gen/grpc-doc/store/index.html
+++ b/proto/gen/grpc-doc/store/index.html
@@ -919,6 +919,10 @@
</li>
+ <li>
+ <a href="#bytebase.store.PlanConfig.ChangeDatabaseConfig.MigrateType"><span class="badge">E</span>PlanConfig.ChangeDatabaseConfig.MigrateType</a>
+ </li>
+
<li>
<a href="#bytebase.store.PlanConfig.ChangeDatabaseConfig.Type"><span class="badge">E</span>PlanConfig.ChangeDatabaseConfig.Type</a>
</li>
@@ -1411,6 +1415,10 @@
</li>
+ <li>
+ <a href="#bytebase.store.Task.MigrateType"><span class="badge">E</span>Task.MigrateType</a>
+ </li>
+
<li>
<a href="#bytebase.store.Task.Type"><span class="badge">E</span>Task.Type</a>
</li>
@@ -8742,6 +8750,13 @@ Format: projects/{project}/releases/{release} </p></td>
<td><p> </p></td>
</tr>
+ <tr>
+ <td>migrate_type</td>
+ <td><a href="#bytebase.store.PlanConfig.ChangeDatabaseConfig.MigrateType">PlanConfig.ChangeDatabaseConfig.MigrateType</a></td>
+ <td></td>
+ <td><p> </p></td>
+ </tr>
+
<tr>
<td>ghost_flags</td>
<td><a href="#bytebase.store.PlanConfig.ChangeDatabaseConfig.GhostFlagsEntry">PlanConfig.ChangeDatabaseConfig.GhostFlagsEntry</a></td>
@@ -9028,8 +9043,8 @@ Leave it empty if no needs to encrypt the zip file. </p></td>
- <h3 id="bytebase.store.PlanConfig.ChangeDatabaseConfig.Type">PlanConfig.ChangeDatabaseConfig.Type</h3>
- <p>Type is the database change type.</p>
+ <h3 id="bytebase.store.PlanConfig.ChangeDatabaseConfig.MigrateType">PlanConfig.ChangeDatabaseConfig.MigrateType</h3>
+ <p>MigrateType is the migration type for imperative schema migration.</p><p>It is only set when type is MIGRATE.</p>
<table class="enum-table">
<thead>
<tr><td>Name</td><td>Number</td><td>Description</td></tr>
@@ -9037,33 +9052,56 @@ Leave it empty if no needs to encrypt the zip file. </p></td>
<tbody>
<tr>
- <td>TYPE_UNSPECIFIED</td>
+ <td>MIGRATE_TYPE_UNSPECIFIED</td>
<td>0</td>
<td><p></p></td>
</tr>
<tr>
- <td>MIGRATE</td>
+ <td>DDL</td>
+ <td>1</td>
+ <td><p>Used for DDL changes.</p></td>
+ </tr>
+
+ <tr>
+ <td>DML</td>
<td>2</td>
- <td><p>Used for DDL changes including CREATE DATABASE.</p></td>
+ <td><p>Used for DML changes.</p></td>
</tr>
<tr>
- <td>MIGRATE_SDL</td>
+ <td>GHOST</td>
<td>3</td>
- <td><p>Used for schema changes via state-based schema migration including CREATE DATABASE.</p></td>
+ <td><p>Used for DDL changes using gh-ost.</p></td>
</tr>
+ </tbody>
+ </table>
+
+ <h3 id="bytebase.store.PlanConfig.ChangeDatabaseConfig.Type">PlanConfig.ChangeDatabaseConfig.Type</h3>
+ <p>Type is the database change type.</p>
+ <table class="enum-table">
+ <thead>
+ <tr><td>Name</td><td>Number</td><td>Description</td></tr>
+ </thead>
+ <tbody>
+
<tr>
- <td>MIGRATE_GHOST</td>
- <td>4</td>
- <td><p>Used for DDL changes using gh-ost.</p></td>
+ <td>TYPE_UNSPECIFIED</td>
+ <td>0</td>
+ <td><p></p></td>
</tr>
<tr>
- <td>DATA</td>
- <td>6</td>
- <td><p>Used for DML change.</p></td>
+ <td>MIGRATE</td>
+ <td>2</td>
+ <td><p>Used for imperative schema migration including CREATE DATABASE.</p></td>
+ </tr>
+
+ <tr>
+ <td>SDL</td>
+ <td>3</td>
+ <td><p>Used for state-based declarative schema migration including CREATE DATABASE.</p></td>
</tr>
</tbody>
@@ -12748,6 +12786,13 @@ Default to this mode.</p></td>
<td><p> </p></td>
</tr>
+ <tr>
+ <td>migrate_type</td>
+ <td><a href="#bytebase.store.Task.MigrateType">Task.MigrateType</a></td>
+ <td></td>
+ <td><p> </p></td>
+ </tr>
+
<tr>
<td>password</td>
<td><a href="#string">string</a></td>
@@ -12826,8 +12871,8 @@ Default to this mode.</p></td>
- <h3 id="bytebase.store.Task.Type">Task.Type</h3>
- <p></p>
+ <h3 id="bytebase.store.Task.MigrateType">Task.MigrateType</h3>
+ <p>MigrateType is the database migration type.</p>
<table class="enum-table">
<thead>
<tr><td>Name</td><td>Number</td><td>Description</td></tr>
@@ -12835,32 +12880,55 @@ Default to this mode.</p></td>
<tbody>
<tr>
- <td>TASK_TYPE_UNSPECIFIED</td>
+ <td>MIGRATE_TYPE_UNSPECIFIED</td>
<td>0</td>
<td><p></p></td>
</tr>
<tr>
- <td>DATABASE_CREATE</td>
+ <td>DDL</td>
<td>1</td>
<td><p></p></td>
</tr>
<tr>
- <td>DATABASE_SCHEMA_UPDATE</td>
+ <td>DML</td>
<td>2</td>
<td><p></p></td>
</tr>
<tr>
- <td>DATABASE_SCHEMA_UPDATE_GHOST</td>
+ <td>GHOST</td>
<td>3</td>
<td><p></p></td>
</tr>
+ </tbody>
+ </table>
+
+ <h3 id="bytebase.store.Task.Type">Task.Type</h3>
+ <p></p>
+ <table class="enum-table">
+ <thead>
+ <tr><td>Name</td><td>Number</td><td>Description</td></tr>
+ </thead>
+ <tbody>
+
+ <tr>
+ <td>TASK_TYPE_UNSPECIFIED</td>
+ <td>0</td>
+ <td><p></p></td>
+ </tr>
+
<tr>
- <td>DATABASE_DATA_UPDATE</td>
- <td>4</td>
+ <td>DATABASE_CREATE</td>
+ <td>1</td>
+ <td><p></p></td>
+ </tr>
+
+ <tr>
+ <td>DATABASE_MIGRATE</td>
+ <td>2</td>
<td><p></p></td>
</tr>
@@ -12871,7 +12939,7 @@ Default to this mode.</p></td>
</tr>
<tr>
- <td>DATABASE_SCHEMA_UPDATE_SDL</td>
+ <td>DATABASE_SDL</td>
<td>6</td>
<td><p></p></td>
</tr>
diff --git a/proto/gen/grpc-doc/v1/README.md b/proto/gen/grpc-doc/v1/README.md
index 20310dd668..a7ff4de8ce 100644
--- a/proto/gen/grpc-doc/v1/README.md
+++ b/proto/gen/grpc-doc/v1/README.md
@@ -18,6 +18,7 @@
- [DatabaseChangeType](#bytebase-v1-DatabaseChangeType)
- [Engine](#bytebase-v1-Engine)
- [ExportFormat](#bytebase-v1-ExportFormat)
+ - [MigrationType](#bytebase-v1-MigrationType)
- [State](#bytebase-v1-State)
- [VCSType](#bytebase-v1-VCSType)
@@ -803,10 +804,8 @@ DatabaseChangeType is the database change type.
| Name | Number | Description |
| ---- | ------ | ----------- |
| DATABASE_CHANGE_TYPE_UNSPECIFIED | 0 | |
-| 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. |
-| DATA | 6 | Used for DML change. |
+| MIGRATE | 2 | Used for imperative schema migration including CREATE DATABASE. |
+| SDL | 3 | Used for state-based declarative schema migration including CREATE DATABASE. |
@@ -861,6 +860,20 @@ DatabaseChangeType is the database change type.
+<a name="bytebase-v1-MigrationType"></a>
+
+### MigrationType
+MigrationType is the type for imperative schema migration.
+
+| Name | Number | Description |
+| ---- | ------ | ----------- |
+| MIGRATION_TYPE_UNSPECIFIED | 0 | |
+| DDL | 1 | Used for DDL changes. |
+| DML | 2 | Used for DML changes. |
+| GHOST | 3 | Used for DDL changes using gh-ost. |
+
+
+
<a name="bytebase-v1-State"></a>
### State
@@ -7355,6 +7368,7 @@ When paginating, all other parameters provided to `ListPlans` must match the cal
| sheet | [string](#string) | | The resource name of the sheet. Format: projects/{project}/sheets/{sheet} |
| release | [string](#string) | | The resource name of the release. Format: projects/{project}/releases/{release} |
| type | [DatabaseChangeType](#bytebase-v1-DatabaseChangeType) | | Type is the database change type. |
+| migration_type | [MigrationType](#bytebase-v1-MigrationType) | | migration_type is the migration type for imperative schema migration. It is only set when type is MIGRATE. |
| ghost_flags | [Plan.ChangeDatabaseConfig.GhostFlagsEntry](#bytebase-v1-Plan-ChangeDatabaseConfig-GhostFlagsEntry) | repeated | |
| enable_prior_backup | [bool](#bool) | | If set, a backup of the modified data will be created automatically before any changes are applied. |
@@ -10076,7 +10090,7 @@ When paginating, all other parameters provided to `ListRollouts` must match the
Supported filters: - creator: the rollout creator full name in &#34;users/{email or id}&#34; format, support &#34;==&#34; operator. - update_time: rollout update time in &#34;2006-01-02T15:04:05Z07:00&#34; format, support &#34;&gt;=&#34; or &#34;&lt;=&#34; operator. - task_type: the task type, support &#34;==&#34; and &#34;in&#34; operators, check the Task.Type enum for the values.
-For example: creator == &#34;users/[email protected]&#34; &amp;&amp; update_time &gt;= &#34;2025-01-02T15:04:05Z07:00&#34; task_type == &#34;DATABASE_SCHEMA_UPDATE&#34; task_type in [&#34;DATABASE_SCHEMA_UPDATE&#34;, &#34;DATABASE_DATA_UPDATE&#34;] |
+For example: creator == &#34;users/[email protected]&#34; &amp;&amp; update_time &gt;= &#34;2025-01-02T15:04:05Z07:00&#34; task_type == &#34;DATABASE_MIGRATE&#34; task_type in [&#34;DATABASE_MIGRATE&#34;, &#34;DATABASE_EXPORT&#34;] |
@@ -10294,6 +10308,8 @@ When paginating, all other parameters provided to `ListTaskRuns` must match the
| ----- | ---- | ----- | ----------- |
| sheet | [string](#string) | | Format: projects/{project}/sheets/{sheet} |
| schema_version | [string](#string) | | |
+| database_change_type | [DatabaseChangeType](#bytebase-v1-DatabaseChangeType) | | |
+| migration_type | [MigrationType](#bytebase-v1-MigrationType) | | migration_type is only set when database_change_type is MIGRATE. |
@@ -10712,11 +10728,9 @@ Read from `pg_stat_activity`
| TYPE_UNSPECIFIED | 0 | |
| GENERAL | 1 | |
| DATABASE_CREATE | 2 | use payload DatabaseCreate |
-| DATABASE_SCHEMA_UPDATE | 4 | use payload DatabaseUpdate |
-| DATABASE_SCHEMA_UPDATE_SDL | 5 | use payload DatabaseUpdate |
-| DATABASE_SCHEMA_UPDATE_GHOST | 9 | use payload DatabaseUpdate |
-| DATABASE_DATA_UPDATE | 8 | use payload DatabaseUpdate |
-| DATABASE_EXPORT | 12 | use payload DatabaseDataExport |
+| DATABASE_MIGRATE | 3 | use payload DatabaseUpdate |
+| DATABASE_SDL | 6 | use payload DatabaseUpdate |
+| DATABASE_EXPORT | 5 | use payload DatabaseDataExport |
diff --git a/proto/gen/grpc-doc/v1/index.html b/proto/gen/grpc-doc/v1/index.html
index fa4636e844..98f83f6e79 100644
--- a/proto/gen/grpc-doc/v1/index.html
+++ b/proto/gen/grpc-doc/v1/index.html
@@ -230,6 +230,10 @@
<a href="#bytebase.v1.ExportFormat"><span class="badge">E</span>ExportFormat</a>
</li>
+ <li>
+ <a href="#bytebase.v1.MigrationType"><span class="badge">E</span>MigrationType</a>
+ </li>
+
<li>
<a href="#bytebase.v1.State"><span class="badge">E</span>State</a>
</li>
@@ -3059,25 +3063,13 @@
<tr>
<td>MIGRATE</td>
<td>2</td>
- <td><p>Used for DDL changes including CREATE DATABASE.</p></td>
+ <td><p>Used for imperative schema migration including CREATE DATABASE.</p></td>
</tr>
<tr>
- <td>MIGRATE_SDL</td>
+ <td>SDL</td>
<td>3</td>
- <td><p>Used for schema changes via state-based schema migration including CREATE DATABASE.</p></td>
- </tr>
-
- <tr>
- <td>MIGRATE_GHOST</td>
- <td>4</td>
- <td><p>Used for DDL changes using gh-ost.</p></td>
- </tr>
-
- <tr>
- <td>DATA</td>
- <td>6</td>
- <td><p>Used for DML change.</p></td>
+ <td><p>Used for state-based declarative schema migration including CREATE DATABASE.</p></td>
</tr>
</tbody>
@@ -3291,6 +3283,41 @@
</tbody>
</table>
+ <h3 id="bytebase.v1.MigrationType">MigrationType</h3>
+ <p>MigrationType is the type for imperative schema migration.</p>
+ <table class="enum-table">
+ <thead>
+ <tr><td>Name</td><td>Number</td><td>Description</td></tr>
+ </thead>
+ <tbody>
+
+ <tr>
+ <td>MIGRATION_TYPE_UNSPECIFIED</td>
+ <td>0</td>
+ <td><p></p></td>
+ </tr>
+
+ <tr>
+ <td>DDL</td>
+ <td>1</td>
+ <td><p>Used for DDL changes.</p></td>
+ </tr>
+
+ <tr>
+ <td>DML</td>
+ <td>2</td>
+ <td><p>Used for DML changes.</p></td>
+ </tr>
+
+ <tr>
+ <td>GHOST</td>
+ <td>3</td>
+ <td><p>Used for DDL changes using gh-ost.</p></td>
+ </tr>
+
+ </tbody>
+ </table>
+
<h3 id="bytebase.v1.State">State</h3>
<p></p>
<table class="enum-table">
@@ -20714,6 +20741,14 @@ Format: projects/{project}/releases/{release} </p></td>
<td><p>Type is the database change type. </p></td>
</tr>
+ <tr>
+ <td>migration_type</td>
+ <td><a href="#bytebase.v1.MigrationType">MigrationType</a></td>
+ <td></td>
+ <td><p>migration_type is the migration type for imperative schema migration.
+It is only set when type is MIGRATE. </p></td>
+ </tr>
+
<tr>
<td>ghost_flags</td>
<td><a href="#bytebase.v1.Plan.ChangeDatabaseConfig.GhostFlagsEntry">Plan.ChangeDatabaseConfig.GhostFlagsEntry</a></td>
@@ -28016,8 +28051,8 @@ Supported filters:
For example:
creator == &#34;users/[email protected]&#34; &amp;&amp; update_time &gt;= &#34;2025-01-02T15:04:05Z07:00&#34;
-task_type == &#34;DATABASE_SCHEMA_UPDATE&#34;
-task_type in [&#34;DATABASE_SCHEMA_UPDATE&#34;, &#34;DATABASE_DATA_UPDATE&#34;] </p></td>
+task_type == &#34;DATABASE_MIGRATE&#34;
+task_type in [&#34;DATABASE_MIGRATE&#34;, &#34;DATABASE_EXPORT&#34;] </p></td>
</tr>
</tbody>
@@ -28583,6 +28618,20 @@ Leave it empty if no needs to encrypt the zip file. </p></td>
<td><p> </p></td>
</tr>
+ <tr>
+ <td>database_change_type</td>
+ <td><a href="#bytebase.v1.DatabaseChangeType">DatabaseChangeType</a></td>
+ <td></td>
+ <td><p> </p></td>
+ </tr>
+
+ <tr>
+ <td>migration_type</td>
+ <td><a href="#bytebase.v1.MigrationType">MigrationType</a></td>
+ <td></td>
+ <td><p>migration_type is only set when database_change_type is MIGRATE. </p></td>
+ </tr>
+
</tbody>
</table>
@@ -29656,32 +29705,20 @@ The indexes of the executed commands. </p></td>
</tr>
<tr>
- <td>DATABASE_SCHEMA_UPDATE</td>
- <td>4</td>
- <td><p>use payload DatabaseUpdate</p></td>
- </tr>
-
- <tr>
- <td>DATABASE_SCHEMA_UPDATE_SDL</td>
- <td>5</td>
- <td><p>use payload DatabaseUpdate</p></td>
- </tr>
-
- <tr>
- <td>DATABASE_SCHEMA_UPDATE_GHOST</td>
- <td>9</td>
+ <td>DATABASE_MIGRATE</td>
+ <td>3</td>
<td><p>use payload DatabaseUpdate</p></td>
</tr>
<tr>
- <td>DATABASE_DATA_UPDATE</td>
- <td>8</td>
+ <td>DATABASE_SDL</td>
+ <td>6</td>
<td><p>use payload DatabaseUpdate</p></td>
</tr>
<tr>
<td>DATABASE_EXPORT</td>
- <td>12</td>
+ <td>5</td>
<td><p>use payload DatabaseDataExport</p></td>
</tr>
diff --git a/proto/store/store/plan.proto b/proto/store/store/plan.proto
index 830bf5adf1..8e88e98c44 100644
--- a/proto/store/store/plan.proto
+++ b/proto/store/store/plan.proto
@@ -59,17 +59,26 @@ message PlanConfig {
// Type is the database change type.
enum Type {
TYPE_UNSPECIFIED = 0;
- // Used for DDL changes including CREATE DATABASE.
+ // Used for imperative schema migration 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 for DML change.
- DATA = 6;
+ // Used for state-based declarative schema migration including CREATE DATABASE.
+ SDL = 3;
}
Type type = 3;
+ // MigrateType is the migration type for imperative schema migration.
+ // It is only set when type is MIGRATE.
+ enum MigrateType {
+ MIGRATE_TYPE_UNSPECIFIED = 0;
+ // Used for DDL changes.
+ DDL = 1;
+ // Used for DML changes.
+ DML = 2;
+ // Used for DDL changes using gh-ost.
+ GHOST = 3;
+ }
+ MigrateType migrate_type = 11;
+
map<string, string> ghost_flags = 7;
// If set, a backup of the modified data will be created automatically before any changes are applied.
diff --git a/proto/store/store/task.proto b/proto/store/store/task.proto
index 63426ca651..534516eb6a 100644
--- a/proto/store/store/task.proto
+++ b/proto/store/store/task.proto
@@ -10,11 +10,17 @@ message Task {
enum Type {
TASK_TYPE_UNSPECIFIED = 0;
DATABASE_CREATE = 1;
- DATABASE_SCHEMA_UPDATE = 2;
- DATABASE_SCHEMA_UPDATE_GHOST = 3;
- DATABASE_DATA_UPDATE = 4;
+ DATABASE_MIGRATE = 2;
DATABASE_EXPORT = 5;
- DATABASE_SCHEMA_UPDATE_SDL = 6;
+ DATABASE_SDL = 6;
+ }
+
+ // MigrateType is the database migration type.
+ enum MigrateType {
+ MIGRATE_TYPE_UNSPECIFIED = 0;
+ DDL = 1;
+ DML = 2;
+ GHOST = 3;
}
// common fields
@@ -36,6 +42,7 @@ message Task {
// ghost flags.
map<string, string> flags = 12;
TaskReleaseSource task_release_source = 13;
+ MigrateType migrate_type = 16;
// Export data fields.
string password = 14;
diff --git a/proto/v1/v1/common.proto b/proto/v1/v1/common.proto
index 8de7c82253..b57aef0146 100644
--- a/proto/v1/v1/common.proto
+++ b/proto/v1/v1/common.proto
@@ -72,12 +72,19 @@ message Range {
// DatabaseChangeType is the database change type.
enum DatabaseChangeType {
DATABASE_CHANGE_TYPE_UNSPECIFIED = 0;
- // Used for DDL changes including CREATE DATABASE.
+ // Used for imperative schema migration including CREATE DATABASE.
MIGRATE = 2;
- // Used for schema changes via state-based schema migration including CREATE DATABASE.
- MIGRATE_SDL = 3;
+ // Used for state-based declarative schema migration including CREATE DATABASE.
+ SDL = 3;
+}
+
+// MigrationType is the type for imperative schema migration.
+enum MigrationType {
+ MIGRATION_TYPE_UNSPECIFIED = 0;
+ // Used for DDL changes.
+ DDL = 1;
+ // Used for DML changes.
+ DML = 2;
// Used for DDL changes using gh-ost.
- MIGRATE_GHOST = 4;
- // Used for DML change.
- DATA = 6;
+ GHOST = 3;
}
diff --git a/proto/v1/v1/plan_service.proto b/proto/v1/v1/plan_service.proto
index d0ac8d05f7..92d91a24dc 100644
--- a/proto/v1/v1/plan_service.proto
+++ b/proto/v1/v1/plan_service.proto
@@ -315,6 +315,10 @@ message Plan {
// Type is the database change type.
DatabaseChangeType type = 3;
+ // migration_type is the migration type for imperative schema migration.
+ // It is only set when type is MIGRATE.
+ MigrationType migration_type = 11;
+
map<string, string> ghost_flags = 7;
// If set, a backup of the modified data will be created automatically before any changes are applied.
diff --git a/proto/v1/v1/rollout_service.proto b/proto/v1/v1/rollout_service.proto
index b0fca0669e..20d45bf6aa 100644
--- a/proto/v1/v1/rollout_service.proto
+++ b/proto/v1/v1/rollout_service.proto
@@ -211,8 +211,8 @@ message ListRolloutsRequest {
//
// For example:
// creator == "users/[email protected]" && update_time >= "2025-01-02T15:04:05Z07:00"
- // task_type == "DATABASE_SCHEMA_UPDATE"
- // task_type in ["DATABASE_SCHEMA_UPDATE", "DATABASE_DATA_UPDATE"]
+ // task_type == "DATABASE_MIGRATE"
+ // task_type in ["DATABASE_MIGRATE", "DATABASE_EXPORT"]
string filter = 4;
}
@@ -404,15 +404,11 @@ message Task {
// use payload DatabaseCreate
DATABASE_CREATE = 2;
// use payload DatabaseUpdate
- DATABASE_SCHEMA_UPDATE = 4;
+ DATABASE_MIGRATE = 3;
// use payload DatabaseUpdate
- DATABASE_SCHEMA_UPDATE_SDL = 5;
- // use payload DatabaseUpdate
- DATABASE_SCHEMA_UPDATE_GHOST = 9;
- // use payload DatabaseUpdate
- DATABASE_DATA_UPDATE = 8;
+ DATABASE_SDL = 6;
// use payload DatabaseDataExport
- DATABASE_EXPORT = 12;
+ DATABASE_EXPORT = 5;
}
Type type = 6;
@@ -453,6 +449,9 @@ message Task {
// Format: projects/{project}/sheets/{sheet}
string sheet = 1;
string schema_version = 2;
+ DatabaseChangeType database_change_type = 3;
+ // migration_type is only set when database_change_type is MIGRATE.
+ MigrationType migration_type = 4;
}
message DatabaseDataExport {