From a1d3d0dc39eb15afcb93fb6cd4dc8517e82cbbaf Mon Sep 17 00:00:00 2001 From: Vijay Joshi Date: Mon, 20 Nov 2023 13:25:27 +0530 Subject: [PATCH] TP-49039 : Schema changes to remove rca_input_links from rca table (#289) --- db/migration/000006_add_rca_schema.up.sql | 1 - model/rca/entity.go | 13 ++++++------- service/rca/rca_service_test.go | 11 +++++------ 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/db/migration/000006_add_rca_schema.up.sql b/db/migration/000006_add_rca_schema.up.sql index 53a6595..6bda203 100644 --- a/db/migration/000006_add_rca_schema.up.sql +++ b/db/migration/000006_add_rca_schema.up.sql @@ -2,7 +2,6 @@ CREATE TABLE IF NOT EXISTS rca ( id SERIAL PRIMARY KEY, incident_id integer NOT NULL REFERENCES incident(id), rca_link text, - rca_input_links text[], status text NOT NULL, created_at timestamp without time zone NOT NULL DEFAULT CURRENT_TIMESTAMP, updated_at timestamp without time zone NOT NULL DEFAULT CURRENT_TIMESTAMP diff --git a/model/rca/entity.go b/model/rca/entity.go index 9d76a9b..ea6a5aa 100644 --- a/model/rca/entity.go +++ b/model/rca/entity.go @@ -5,13 +5,12 @@ import ( ) type RcaEntity struct { - ID uint `gorm:"primaryKey"` - IncidentID uint `gorm:"index"` - RcaLink string `gorm:"type:text"` - RcaInputLinks []string `gorm:"type:text[]"` - Status string `gorm:"type:text"` - CreatedAt time.Time `gorm:"autoCreateTime"` - UpdatedAt time.Time `gorm:"autoUpdateTime"` + ID uint `gorm:"primaryKey"` + IncidentID uint `gorm:"index"` + RcaLink string `gorm:"type:text"` + Status string `gorm:"type:text"` + CreatedAt time.Time `gorm:"autoCreateTime"` + UpdatedAt time.Time `gorm:"autoUpdateTime"` } func (RcaEntity) TableName() string { diff --git a/service/rca/rca_service_test.go b/service/rca/rca_service_test.go index 40c229a..cbb5cae 100644 --- a/service/rca/rca_service_test.go +++ b/service/rca/rca_service_test.go @@ -219,11 +219,10 @@ func GetMockIncident() *incident.IncidentEntity { func getMockRCA() *rca.RcaEntity { return &rca.RcaEntity{ - ID: 1, - IncidentID: 1, - RcaLink: "", - RcaInputLinks: nil, - CreatedAt: time.Time{}, - UpdatedAt: time.Time{}, + ID: 1, + IncidentID: 1, + RcaLink: "", + CreatedAt: time.Time{}, + UpdatedAt: time.Time{}, } }