a lot of work on database schema and migration setup, postgres now works, every integration test passes for all database types, only token table left to do

This commit is contained in:
Torkel Ödegaard committed 2015-01-20 14:15:48 +01:00
1 parent 8bb9126b77
commit afb847acc8
20 files changed
+246 -175

No files matched your search

+8 -8
View File
@@ -9,7 +9,7 @@ import (
"github.com/torkelo/grafana-pro/pkg/bus"
"github.com/torkelo/grafana-pro/pkg/log"
m "github.com/torkelo/grafana-pro/pkg/models"
"github.com/torkelo/grafana-pro/pkg/services/sqlstore/migrations"
"github.com/torkelo/grafana-pro/pkg/services/sqlstore/migrator"
"github.com/torkelo/grafana-pro/pkg/setting"
"github.com/torkelo/grafana-pro/pkg/util"
@@ -20,8 +20,9 @@ import (
)
var (
x *xorm.Engine
tables []interface{}
x *xorm.Engine
dialect migrator.Dialect
tables []interface{}
HasEngine bool
@@ -34,9 +35,7 @@ var (
func init() {
tables = make([]interface{}, 0)
tables = append(tables, new(m.DataSource), new(DashboardTag),
new(m.Token))
tables = append(tables, new(m.Token))
}
func EnsureAdminUser() {
@@ -76,9 +75,10 @@ func NewEngine() {
func SetEngine(engine *xorm.Engine, enableLog bool) (err error) {
x = engine
dialect = migrator.NewDialect(x.DriverName())
migrator := migrations.NewMigrator(x)
migrations.AddMigrations(migrator)
migrator := migrator.NewMigrator(x)
addMigrations(migrator)
if err := migrator.Start(); err != nil {
return fmt.Errorf("Sqlstore::Migration failed err: %v\n", err)