package insurance_patient_data import ( "time" "gorm.io/gorm" "wucher/internal/domain/federal_state" "wucher/internal/domain/health_insurance_companies" "wucher/internal/shared/pkg/uuidv7" ) type InsurancePatientData struct { ID []byte `gorm:"type:binary(16);primaryKey;column:id"` HealthInsuranceCompaniesId []byte `gorm:"type:binary(16);index;column:health_insurance_companies_id"` FederalStateId []byte `gorm:"type:binary(16);index;column:federal_state_id"` HealthInsuranceCompanies *health_insurance_companies.HealthInsuranceCompany `gorm:"foreignKey:HealthInsuranceCompaniesId;references:ID;constraint:OnUpdate:CASCADE,OnDelete:SET NULL"` FederalState *federal_state.FederalState `gorm:"foreignKey:FederalStateId;references:ID;constraint:OnUpdate:CASCADE,OnDelete:SET NULL"` CreatedAt time.Time `gorm:"column:created_at"` CreatedBy []byte `gorm:"type:binary(16);column:created_by"` UpdatedAt time.Time `gorm:"column:updated_at"` UpdatedBy []byte `gorm:"type:binary(16);column:updated_by"` DeletedAt *time.Time `gorm:"column:deleted_at"` DeletedBy []byte `gorm:"type:binary(16);column:deleted_by"` } func (InsurancePatientData) TableName() string { return "insurance_patient_data" } func (i *InsurancePatientData) BeforeCreate(tx *gorm.DB) error { if len(i.ID) == 0 { i.ID = uuidv7.MustBytes() } return nil }