-
-
Notifications
You must be signed in to change notification settings - Fork 707
[management] add flag to disable auto-migration #3840
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a skipMigration
flag to disable automatic database migrations when initializing stores.
- Extended
NewStore
and all SQL store constructors to acceptskipMigration
and propagate it. - Wrapped existing migration steps in a conditional to skip or log migrations based on the new flag.
- Updated callers (including the main command and test helpers) to pass a default
false
ortrue
for testing/migration contexts.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
management/server/store/store.go | Added skipMigration parameter to NewStore and propagated it. |
management/server/store/sql_store.go | Updated SQL store constructors & guarded migration logic. |
management/cmd/management.go | Passed default false for skipMigration when creating the store. |
Comments suppressed due to low confidence (3)
management/server/store/store.go:245
- [nitpick] Update this doc comment to include the new
skipMigration
parameter and describe how it affects auto-migration behavior.
// NewStore creates a new store based on the provided engine type, data directory, and telemetry metrics
management/server/store/sql_store.go:91
- There are no tests verifying that migrations are correctly skipped or applied when
skipMigration
is toggled. Consider adding unit tests around both branches of this conditional.
if !skipMigration {
management/server/store/sql_store.go:1022
- [nitpick] The doc comment for
NewSqliteStore
should be updated to mention theskipMigration
parameter and explain its effect on automatic migrations.
// NewSqliteStore creates a new SQLite store.
// NewSqlStore creates a new SqlStore instance. | ||
func NewSqlStore(ctx context.Context, db *gorm.DB, storeEngine types.Engine, metrics telemetry.AppMetrics) (*SqlStore, error) { | ||
func NewSqlStore(ctx context.Context, db *gorm.DB, storeEngine types.Engine, metrics telemetry.AppMetrics, skipMigration bool) (*SqlStore, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Consider replacing the boolean skipMigration
flag with a functional options pattern or named configuration struct to improve readability at call sites (e.g., NewSqlStore(..., false)
can be unclear).
Copilot uses AI. Check for mistakes.
|
Describe your changes
Issue ticket number and link
Stack
Checklist