23 lines
721 B
Go
23 lines
721 B
Go
package plant
|
|
|
|
import (
|
|
"wagfarm-api/assets/base"
|
|
"wagfarm-api/assets/land"
|
|
"wagfarm-api/database"
|
|
"wagfarm-api/taxonomy/crop"
|
|
)
|
|
|
|
type Plant struct {
|
|
base.Asset
|
|
LandId uint `gorm:"not null"`
|
|
Land land.Land `gorm:"not null; constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
|
|
CropID uint `gorm:"not null"`
|
|
Crop crop.Crop `gorm:"not null; constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
|
|
CoverCropID uint `gorm:"not null"`
|
|
CoverCrop crop.Crop `gorm:"not null; constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
|
|
Year uint `gorm:"not null"`
|
|
AreaPercentage float64 `gorm:"not null"`
|
|
}
|
|
|
|
func RegisterModels() { database.RegisterModel(&Plant{}) }
|