This commit is contained in:
@@ -3,6 +3,7 @@ package database
|
||||
import (
|
||||
"time"
|
||||
|
||||
"git.eeqj.de/sneak/feta/instance"
|
||||
"github.com/google/uuid"
|
||||
"github.com/jinzhu/gorm"
|
||||
|
||||
@@ -12,12 +13,12 @@ import (
|
||||
// NB that when you add a model below you must add it to this list!
|
||||
|
||||
func (m *Manager) doMigrations() {
|
||||
m.db.AutoMigrate(&instance{})
|
||||
m.db.AutoMigrate(&apinstance{})
|
||||
}
|
||||
|
||||
type instance struct {
|
||||
type apinstance struct {
|
||||
gorm.Model
|
||||
Identifier uuid.UUID
|
||||
ID uuid.UUID `gorm:"type:uuid;primary_key;"`
|
||||
ErrorCount uint
|
||||
SuccessCount uint
|
||||
HighestID int
|
||||
@@ -32,6 +33,9 @@ type instance struct {
|
||||
ServerImplementationString string
|
||||
}
|
||||
|
||||
func (m *Manager) ListInstances() {
|
||||
func (m *Manager) ListInstances() ([]*instance.Instance, error) {
|
||||
output := make([]*instance.Instance, 0)
|
||||
// FIXME have this produce a list of Instance
|
||||
|
||||
return output, nil
|
||||
}
|
||||
|
||||
@@ -23,6 +23,10 @@ func New() *Manager {
|
||||
}
|
||||
|
||||
func (m *Manager) init() {
|
||||
m.db.LogMode(false)
|
||||
if viper.GetBool("Debug") {
|
||||
m.db.LogMode(true)
|
||||
}
|
||||
m.open()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user