Skip to content
Snippets Groups Projects
Commit 7f9414ca authored by Jonas Leder's avatar Jonas Leder
Browse files

define tables for value types and value

parent 06285f76
No related branches found
No related tags found
1 merge request!1WIP: write values to a database
Pipeline #54564 failed
...@@ -50,7 +50,7 @@ func Init() { ...@@ -50,7 +50,7 @@ func Init() {
if os.Getenv("OUTPUT_DATABASE_EXECUTE_MIGRATIONS") != "false" { if os.Getenv("OUTPUT_DATABASE_EXECUTE_MIGRATIONS") != "false" {
log.Log.Info("Executing database migrations") log.Log.Info("Executing database migrations")
Db.AutoMigrate(&tables.Instance{}) Db.AutoMigrate(&tables.Instance{}, &tables.ValueType{}, &tables.Value{})
} }
} }
......
package tables
type ValueType struct {
ID uint `gorm:"primaryKey"`
Name string
Description string
}
package tables
import "time"
type Value struct {
ID uint `gorm:"primaryKey"`
Date time.Time
InstanceID int
Instance Instance
ValueTypeID int
ValueType ValueType
Value string
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment