-
-
Notifications
You must be signed in to change notification settings - Fork 384
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
Move sqlite to woodpecker #438
Conversation
Signed-off-by: jolheiser <john.olheiser@gmail.com>
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.
Note: This PR has to be merged before #431
return datastore.New( | ||
c.String("driver"), | ||
c.String("datasource"), | ||
) | ||
} | ||
|
||
// TODO Remove this once we are sure users aren't attempting to migrate from Drone to Woodpecker (possibly never) | ||
func checkSqliteFile() error { | ||
_, err := os.Stat("drone.sqlite") |
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.
This works only for binary installations. For docker installations the path set via WOODPECKER_DATABASE_DATASOURCE
would be /var/lib/drone/woodpecker.sqlite
. Maybe something like the suggestion in combination with removing if !c.IsSet("datasource") {
would work. 🤔
_, err := os.Stat("drone.sqlite") | |
_, err := os.Stat(fmt.Sprintf("%s/drone.sqlite", filepath.Dir(c.String("datasource")))) |
} | ||
return err | ||
} | ||
return os.Rename("drone.sqlite", "woodpecker.sqlite") |
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.
Would probably need absolute paths version as well.
@anbraten I'm not sure about the docker paths, because they use env variables. imo this should only migrate if the user had made no other effort to change from default (that is, no env variable and no flag set) |
@jolheiser We currently have |
@anbraten I understand that it's the default, but only because we had it set that way. The current migration is a single check and then no-op after. I can change it, but it seems (imo) to be a slightly different case than an unused flag. |
Superseded by #494 |
Moves the sqlite file to woodpecker and attempts to migrate legacy drone sqlite files.
Note that if the CLI explicitly sets the datasource to
drone.sqlite
the migration will not run, as it is assumed the user has explicitly set it for a reason.