DB Migrations #67
|
@ -1,3 +1,4 @@
|
|||
- id: 1
|
||||
task_id: 1
|
||||
label_id: 4
|
||||
label_id: 4
|
||||
created: 0
|
|
@ -1,12 +1,20 @@
|
|||
- id: 1
|
||||
title: 'Label #1'
|
||||
created_by_id: 1
|
||||
updated: 0
|
||||
created: 0
|
||||
- id: 2
|
||||
title: 'Label #2'
|
||||
created_by_id: 1
|
||||
updated: 0
|
||||
created: 0
|
||||
- id: 3
|
||||
title: 'Label #3 - other user'
|
||||
created_by_id: 2
|
||||
updated: 0
|
||||
created: 0
|
||||
- id: 4
|
||||
title: 'Label #4 - visible via other task'
|
||||
created_by_id: 2
|
||||
created_by_id: 2
|
||||
updated: 0
|
||||
created: 0
|
|
@ -4,27 +4,37 @@
|
|||
description: Lorem Ipsum
|
||||
owner_id: 1
|
||||
namespace_id: 1
|
||||
updated: 0
|
||||
created: 0
|
||||
-
|
||||
id: 2
|
||||
title: Test2
|
||||
description: Lorem Ipsum
|
||||
owner_id: 3
|
||||
namespace_id: 1
|
||||
updated: 0
|
||||
created: 0
|
||||
-
|
||||
id: 3
|
||||
title: Test3
|
||||
description: Lorem Ipsum
|
||||
owner_id: 3
|
||||
namespace_id: 2
|
||||
updated: 0
|
||||
created: 0
|
||||
-
|
||||
id: 4
|
||||
title: Test4
|
||||
description: Lorem Ipsum
|
||||
owner_id: 3
|
||||
namespace_id: 3
|
||||
updated: 0
|
||||
created: 0
|
||||
-
|
||||
id: 5
|
||||
title: Test5
|
||||
description: Lorem Ipsum
|
||||
owner_id: 5
|
||||
namespace_id: 5
|
||||
namespace_id: 5
|
||||
updated: 0
|
||||
created: 0
|
||||
|
|
|
@ -3,13 +3,19 @@
|
|||
name: testnamespace
|
||||
description: Lorem Ipsum
|
||||
owner_id: 1
|
||||
updated: 0
|
||||
created: 0
|
||||
-
|
||||
id: 2
|
||||
name: testnamespace2
|
||||
description: Lorem Ipsum
|
||||
owner_id: 2
|
||||
updated: 0
|
||||
created: 0
|
||||
-
|
||||
id: 3
|
||||
name: testnamespace3
|
||||
description: Lorem Ipsum
|
||||
owner_id: 3
|
||||
owner_id: 3
|
||||
updated: 0
|
||||
created: 0
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
- id: 1
|
||||
team_id: 1
|
||||
list_id: 3
|
||||
updated: 0
|
||||
created: 0
|
||||
- id: 2
|
||||
team_id: 2
|
||||
list_id: 3
|
||||
updated: 0
|
||||
created: 0
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
team_id: 1
|
||||
user_id: 1
|
||||
admin: true
|
||||
created: 0
|
||||
-
|
||||
team_id: 1
|
||||
user_id: 2
|
||||
created: 0
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
- id: 1
|
||||
team_id: 1
|
||||
namespace_id: 3
|
||||
updated: 0
|
||||
created: 0
|
||||
- id: 2
|
||||
team_id: 2
|
||||
namespace_id: 3
|
||||
updated: 0
|
||||
created: 0
|
||||
|
|
|
@ -3,26 +3,36 @@
|
|||
username: 'user1'
|
||||
password: '1234'
|
||||
email: 'user1@example.com'
|
||||
updated: 0
|
||||
created: 0
|
||||
-
|
||||
id: 2
|
||||
username: 'user2'
|
||||
password: '1234'
|
||||
email: 'user2@example.com'
|
||||
updated: 0
|
||||
created: 0
|
||||
-
|
||||
id: 3
|
||||
username: 'user3'
|
||||
password: '1234'
|
||||
email: 'user3@example.com'
|
||||
updated: 0
|
||||
created: 0
|
||||
-
|
||||
id: 4
|
||||
username: 'user4'
|
||||
password: '1234'
|
||||
email: 'user4@example.com'
|
||||
email_confirm_token: tiepiQueed8ahc7zeeFe1eveiy4Ein8osooxegiephauph2Ael
|
||||
updated: 0
|
||||
created: 0
|
||||
-
|
||||
id: 5
|
||||
username: 'user5'
|
||||
password: '1234'
|
||||
email: 'user4@example.com'
|
||||
email_confirm_token: tiepiQueed8ahc7zeeFe1eveiy4Ein8osooxegiephauph2Ael
|
||||
is_active: false
|
||||
is_active: false
|
||||
updated: 0
|
||||
created: 0
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
- id: 1
|
||||
user_id: 1
|
||||
list_id: 3
|
||||
updated: 0
|
||||
created: 0
|
||||
- id: 2
|
||||
user_id: 2
|
||||
list_id: 3
|
||||
updated: 0
|
||||
created: 0
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
- id: 1
|
||||
user_id: 1
|
||||
namespace_id: 3
|
||||
updated: 0
|
||||
created: 0
|
||||
- id: 2
|
||||
user_id: 2
|
||||
namespace_id: 3
|
||||
updated: 0
|
||||
created: 0
|
||||
|
|
|
@ -17,13 +17,13 @@
|
|||
package models
|
||||
|
||||
import (
|
||||
"code.vikunja.io/api/pkg/config"
|
||||
_ "code.vikunja.io/api/pkg/config" // To trigger its init() which initializes the config
|
||||
"code.vikunja.io/api/pkg/log"
|
||||
"code.vikunja.io/api/pkg/mail"
|
||||
"fmt"
|
||||
"github.com/go-xorm/core"
|
||||
"github.com/go-xorm/xorm"
|
||||
"github.com/spf13/viper"
|
||||
"gopkg.in/testfixtures.v2"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
@ -51,12 +51,16 @@ func MainTest(m *testing.M, pathToRoot string) {
|
|||
|
||||
func createTestEngine(fixturesDir string) error {
|
||||
var err error
|
||||
var fixturesHelper testfixtures.Helper
|
||||
// If set, use the config we provided instead of normal
|
||||
if os.Getenv("VIKUNJA_TESTS_USE_CONFIG") == "1" {
|
||||
config.InitConfig()
|
||||
err = SetEngine()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
fixturesHelper = &testfixtures.MySQL{}
|
||||
} else {
|
||||
x, err = xorm.NewEngine("sqlite3", "file::memory:?cache=shared")
|
||||
if err != nil {
|
||||
|
@ -66,7 +70,7 @@ func createTestEngine(fixturesDir string) error {
|
|||
x.SetMapper(core.GonicMapper{})
|
||||
|
||||
// Sync dat shit
|
||||
if err := x.StoreEngine("InnoDB").Sync2(GetTables()...); err != nil {
|
||||
if err := x.Sync2(GetTables()...); err != nil {
|
||||
return fmt.Errorf("sync database struct error: %v", err)
|
||||
}
|
||||
|
||||
|
@ -74,12 +78,7 @@ func createTestEngine(fixturesDir string) error {
|
|||
if os.Getenv("UNIT_TESTS_VERBOSE") == "1" {
|
||||
x.ShowSQL(true)
|
||||
}
|
||||
}
|
||||
|
||||
var fixturesHelper testfixtures.Helper
|
||||
if viper.GetString("database.type") == "mysql" {
|
||||
fixturesHelper = &testfixtures.MySQL{}
|
||||
} else {
|
||||
fixturesHelper = &testfixtures.SQLite{}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue