diff --git a/db/structs.go b/db/structs.go index 075cd5210..3df472a2b 100644 --- a/db/structs.go +++ b/db/structs.go @@ -958,7 +958,7 @@ const ( ) type Tickets struct { - UUID uuid.UUID `gorm:"primaryKey;type:uuid;default:gen_random_uuid()"` + UUID uuid.UUID `gorm:"primaryKey;type:uuid"` FeatureUUID string `gorm:"type:uuid;index:composite_index" json:"feature_uuid"` Features WorkspaceFeatures `gorm:"foreignKey:FeatureUUID;references:Uuid"` PhaseUUID string `gorm:"type:uuid;index:phase_index" json:"phase_uuid"` diff --git a/db/tickets.go b/db/tickets.go index f826dc511..f0cbfaca3 100644 --- a/db/tickets.go +++ b/db/tickets.go @@ -32,6 +32,8 @@ func (db database) CreateOrEditTicket(ticket *Tickets) (Tickets, error) { ticket.Status = DraftTicket } + ticket.UUID = uuid.New() + if err := db.db.Create(&ticket).Error; err != nil { return Tickets{}, fmt.Errorf("failed to create ticket: %w", err) }