Merge pull request #83 from fudanchii/migration

Migration system for sqlite
This commit is contained in:
Brad Rydzewski
2014-02-17 20:46:13 -08:00
12 changed files with 597 additions and 16 deletions

View File

@@ -15,6 +15,7 @@ import (
"github.com/drone/drone/pkg/channel"
"github.com/drone/drone/pkg/database"
"github.com/drone/drone/pkg/database/migrate"
"github.com/drone/drone/pkg/handler"
)
@@ -55,8 +56,9 @@ func main() {
// setup the database connection and register with the
// global database package.
func setupDatabase() {
// inform meddler we're using sqlite
// inform meddler and migration we're using sqlite
meddler.Default = meddler.SQLite
migrate.Driver = migrate.SQLite
// connect to the SQLite database
db, err := sql.Open(driver, datasource)
@@ -65,6 +67,9 @@ func setupDatabase() {
}
database.Set(db)
migration := migrate.New(db)
migration.All().Migrate()
}
// setup routes for static assets. These assets may