Lots of changes

This commit is contained in:
2025-07-14 13:53:50 -04:00
parent e09d399c98
commit 7c13b1f209
16 changed files with 135 additions and 122 deletions
+4 -1
View File
@@ -6,7 +6,10 @@ import (
type Benchmark struct {
gorm.Model
Name string
Name string
ScoringType string
Description string
// many-to-many test
Tests[] Test `gorm:"many2many:tests_benchmarks;"`
}
+5 -3
View File
@@ -6,8 +6,10 @@ import (
type Hardware struct {
gorm.Model
Name string
Type string
SerialNumber string
Name string
Type string
Description string
// has many tests
Tests[] Test
}
+1 -1
View File
@@ -21,6 +21,6 @@ func Open() {
}
// Migrate the schema
DB.AutoMigrate(&Project{}, &Hardware{}, &Benchmark{})
DB.AutoMigrate(&Test{}, &Hardware{}, &Benchmark{})
log.Println("Database migrations complete.")
}
-11
View File
@@ -1,11 +0,0 @@
package models
import (
"gorm.io/gorm"
)
type Project struct {
gorm.Model
Name string
Description string
}
+17
View File
@@ -0,0 +1,17 @@
package models
import (
"gorm.io/gorm"
)
type Test struct {
gorm.Model
DateTag string
// belongs to hardware
HardwareID int
Hardware Hardware
// many-to-many benchmarks
Benchmarks[] Benchmark `gorm:"many2many:tests_benchmarks;"`
}