first version of db model

This commit is contained in:
2025-04-14 17:07:12 +02:00
parent 0564489b95
commit 2b1e2f76c6
4 changed files with 137 additions and 75 deletions

View File

@@ -1,7 +1,28 @@
package models
type Taxonomy struct {
ID uint `gorm:"primaryKey" json:"id"`
Type string `gorm:"not null;index" json:"type"` // e.g., "unit", "color", etc.
Name string `gorm:"not null;index" json:"name"` // e.g., "kg", "lb"
}
type _Taxonomy struct {
ID uint `gorm:"primaryKey" json:"id"`
Name string `gorm:"not null;index" json:"name"` // e.g., "kg", "lb"
}
type Unit struct{ _Taxonomy }
type Visibility struct{ _Taxonomy }
type SeedingTechnique struct{ _Taxonomy }
type SeedingCondition struct{ _Taxonomy }
type Worker struct{ _Taxonomy }
type Crop struct{ _Taxonomy }
type Seller struct{ _Taxonomy }
type Customer struct{ _Taxonomy }
type SeedType struct {
_Taxonomy
CropID uint `gorm:"not null"`
Crop Crop `gorm:"not null; constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
}
type Ingredient struct {
_Taxonomy
UnitID uint `gorm:"not null"`
Unit Unit `gorm:"not null"`
}
type FertilizerType struct{ _Taxonomy }
type PesticideType struct{ _Taxonomy }
type ProductType struct{ _Taxonomy }