Private
Public Access
Fix GORM foreign keys and column types in models
This commit is contained in:
1 parent
fce21846bc
commit
8d5e191d7d
21 files changed
+48
-39
No files matched your search
@@ -4,7 +4,7 @@ import "gorm.io/gorm"
|
||||
|
||||
type AsientoContable struct {
|
||||
gorm.Model
|
||||
ComprobanteTipo string `gorm:"type:varchar(20),not null"`
|
||||
ComprobanteTipo string `gorm:"type:varchar(20);not null"`
|
||||
ComprobanteID uint
|
||||
Movimientos []MovimientoContable `gorm:"foreignKey:movimientoID"`
|
||||
Movimientos []MovimientoContable `gorm:"foreignKey:AsientoID"`
|
||||
}
|
||||
@@ -4,7 +4,7 @@ import "gorm.io/gorm"
|
||||
|
||||
type CuentaContable struct {
|
||||
gorm.Model
|
||||
Nombre string `gorm:"type:varchar(30),not null"`
|
||||
Tipo string `gorm:"type:varchar(12),not null"`
|
||||
Movimientos []MovimientoContable `gorm:"foreignKey:movimientoID"`
|
||||
Nombre string `gorm:"type:varchar(30);not null"`
|
||||
Tipo string `gorm:"type:varchar(12);not null"`
|
||||
Movimientos []MovimientoContable `gorm:"foreignKey:CuentaID"`
|
||||
}
|
||||
@@ -5,9 +5,9 @@ import "gorm.io/gorm"
|
||||
type MovimientoContable struct {
|
||||
gorm.Model
|
||||
AsientoID uint `gorm:"column:asientoID"`
|
||||
Asiento AsientoContable `gorm:"foreignKey:asientoID"`
|
||||
Asiento AsientoContable `gorm:"foreignKey:AsientoID"`
|
||||
CuentaID uint `gorm:"column:cuentaID"`
|
||||
Cuenta CuentaContable `gorm:"foreignKey:cuentaID"`
|
||||
Cuenta CuentaContable `gorm:"foreignKey:CuentaID"`
|
||||
Debe float64 `gorm:"type:decimal(10,2)"`
|
||||
Haber float64 `gorm:"type:decimal(10,2)"`
|
||||
Descripcion string `gorm:"type:varchar(50)"`
|
||||
|
||||
Reference in new issue
Block a user