Skip to content

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

chore: change schema version to 2.0 (#5887)

Danny Xu414cacf3ac56
diff --git a/backend/migrator/migration/prod/1.18/0000##add_sheet_source_bytebase_artifact.sql b/backend/migrator/migration/prod/2.0/0000##add_sheet_source_bytebase_artifact.sql
similarity index 100%
rename from backend/migrator/migration/prod/1.18/0000##add_sheet_source_bytebase_artifact.sql
rename to backend/migrator/migration/prod/2.0/0000##add_sheet_source_bytebase_artifact.sql
diff --git a/backend/migrator/migration/prod/1.18/0001##migrate_task_payload_statement_to_sheet.sql b/backend/migrator/migration/prod/2.0/0001##migrate_task_payload_statement_to_sheet.sql
similarity index 100%
rename from backend/migrator/migration/prod/1.18/0001##migrate_task_payload_statement_to_sheet.sql
rename to backend/migrator/migration/prod/2.0/0001##migrate_task_payload_statement_to_sheet.sql
diff --git a/backend/migrator/migration/prod/1.18/0002##update_project_member_index.sql b/backend/migrator/migration/prod/2.0/0002##update_project_member_index.sql
similarity index 100%
rename from backend/migrator/migration/prod/1.18/0002##update_project_member_index.sql
rename to backend/migrator/migration/prod/2.0/0002##update_project_member_index.sql
diff --git a/backend/migrator/migrator.go b/backend/migrator/migrator.go
index 0d68a1b694..f0177d7077 100644
--- a/backend/migrator/migrator.go
+++ b/backend/migrator/migrator.go
@@ -26,29 +26,6 @@ import (
"github.com/bytebase/bytebase/backend/utils"
)
-const (
- // The schema version consists of major version and minor version.
- // Backward compatible schema change increases the minor version, while backward non-compatible schema change increase the major version.
- // majorSchemaVersion and majorSchemaVersion defines the schema version this version of code can handle.
- // We reserve 4 least significant digits for minor version.
- // e.g.
- // 10001 -> Major version 1, minor version 1
- // 11001 -> Major version 1, minor version 1001
- // 20001 -> Major version 2, minor version 1
- //
- // The migration file follows the name pattern of {{version_number}}##{{description}}.
- //
- // Though minor version is backward compatible, we require the schema version must match both the MAJOR and MINOR version,
- // otherwise, Bytebase will fail to start. We choose this because otherwise failed minor migration changes like adding an
- // index is hard to detect.
- //
- // If the new release requires a higher MAJOR version then the schema file, then the code will abort immediately. We
- // will require a separate process to upgrade the schema.
- // If the new release requires a higher MINOR version than the schema file, then it will apply the migration upon
- // startup.
- majorSchemaVersion = 1
-)
-
//go:embed migration
var migrationFS embed.FS
@@ -542,10 +519,6 @@ const (
func migrate(ctx context.Context, storeInstance *store.Store, metadataDriver dbdriver.Driver, cutoffSchemaVersion, curVer semver.Version, mode common.ReleaseMode, serverVersion, databaseName string) error {
log.Info("Apply database migration if needed...")
log.Info(fmt.Sprintf("Current schema version before migration: %s", curVer))
- major := curVer.Major
- if major != majorSchemaVersion {
- return errors.Errorf("current major schema version %d is different from the major schema version %d this release %s expects", major, majorSchemaVersion, serverVersion)
- }
var histories []*store.InstanceChangeHistoryMessage
// Because dev migrations don't use semantic versioning, we have to look at all migration history to
diff --git a/backend/migrator/migrator_test.go b/backend/migrator/migrator_test.go
index e01a551edb..4c14c0038b 100644
--- a/backend/migrator/migrator_test.go
+++ b/backend/migrator/migrator_test.go
@@ -241,5 +241,5 @@ func TestMigrationCompatibility(t *testing.T) {
func TestGetCutoffVersion(t *testing.T) {
releaseVersion, err := getProdCutoffVersion()
require.NoError(t, err)
- require.Equal(t, semver.MustParse("1.18.2"), releaseVersion)
+ require.Equal(t, semver.MustParse("2.0.2"), releaseVersion)
}