fix not adding fk constraints
This commit is contained in:
parent
4b4398d851
commit
c3408ef7c8
|
@ -70,7 +70,8 @@ func createSchema(db *pg.DB) error {
|
|||
|
||||
for _, model := range models {
|
||||
err := tx.Model(model).CreateTable(&orm.CreateTableOptions{
|
||||
IfNotExists: true,
|
||||
IfNotExists: true,
|
||||
FKConstraints: true,
|
||||
})
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "createSchema")
|
||||
|
|
|
@ -38,8 +38,10 @@ func (q *Qualification) BeforeUpdate(ctx context.Context) (context.Context, erro
|
|||
}
|
||||
|
||||
type QualificationToProfession struct {
|
||||
QualificationID int `pg:"on_delete:CASCADE" json:"qualificationID" xml:"qualificationID" gqlgen:"qualificationID"`
|
||||
ProfessionID int `pg:"on_delete:CASCADE" json:"professionID" xml:"professionID" gqlgen:"professionID"`
|
||||
QualificationID int `pg:"on_delete:CASCADE" json:"qualificationID" xml:"qualificationID" gqlgen:"qualificationID"`
|
||||
Qualification *Qualification `pg:"rel:has-one" json:"qualification" xml:"qualification" gqlgen:"qualification"`
|
||||
ProfessionID int `pg:"on_delete:CASCADE" json:"professionID" xml:"professionID" gqlgen:"professionID"`
|
||||
Profession *Qualification `pg:"rel:has-one" json:"profession" xml:"profession" gqlgen:"profession"`
|
||||
}
|
||||
|
||||
type QualificationInput struct {
|
||||
|
|
Reference in New Issue