drone/drone — pull request #83 by fudanchii (2014-02-16 02:01:17+00:00)
Title: Migration system for sqlite

Hey @bradrydzewski
I tried to integrate you migrate package and write some sqlite specific helper, it turns out quite nice in my opinion. ;)

It has nice wrapper for the migration step, so for most of the time we don't have to write raw sql on our own, [for example](https://github.com/fudanchii/drone/blob/4ef0f1b437d3ddc09e59c5d5f9c4a4eefdf258cf/pkg/database/migrate/201402200603_rename_privelege_to_privilege.go)

some minor caveats:
It still lacks index operation support but it's rather easy to add, I believe.
Also it doesn't have any parameter sanitization, but I'm sure we're not going to write our migration script from the web, so I'll leave it at that for now.

The [migration driver](https://github.com/fudanchii/drone/blob/4ef0f1b437d3ddc09e59c5d5f9c4a4eefdf258cf/pkg/database/migrate/sqlite.go#L12) implements `Operation` interface, which is accessible from within migration script. And it's possible to create more drivers for another database just by implementing `Operation` interface and tell the main program [to use that driver](https://github.com/fudanchii/drone/blob/4ef0f1b437d3ddc09e59c5d5f9c4a4eefdf258cf/cmd/droned/drone.go#L61).

Anyway, I'm not sure if this is already being worked on, or if it's not being planned to be something like this. So it's okay if you reject this PR just in case. :)

Thanks!