Integrate migrations with drone.

Also add migration to tests.
This commit is contained in:
Nurahmadie
2014-02-16 03:47:30 +07:00
parent da8d4346ee
commit 4ef0f1b437
8 changed files with 54 additions and 9 deletions

View File

@@ -7,6 +7,7 @@ import (
"github.com/drone/drone/pkg/database"
"github.com/drone/drone/pkg/database/encrypt"
"github.com/drone/drone/pkg/database/migrate"
. "github.com/drone/drone/pkg/model"
_ "github.com/mattn/go-sqlite3"
@@ -31,6 +32,7 @@ func init() {
// notify meddler that we are working with sqlite
meddler.Default = meddler.SQLite
migrate.Driver = migrate.SQLite
}
func Setup() {
@@ -40,6 +42,9 @@ func Setup() {
// make sure all the tables and indexes are created
database.Set(db)
migration := migrate.New(db)
migration.All().Migrate()
// create dummy user data
user1 := User{
Password: "$2a$10$b8d63QsTL38vx7lj0HEHfOdbu1PCAg6Gfca74UavkXooIBx9YxopS",