From a060176cbb2f0d350056f2ffaf4c2bb6fa8b7596 Mon Sep 17 00:00:00 2001 From: Sung Won Cho Date: Fri, 22 May 2020 17:19:10 +1000 Subject: [PATCH] Remove obsolete columns (#470) --- .../20200522170529-remove-billing-columns.sql | 9 +++++++++ pkg/server/database/models.go | 12 +++++------- 2 files changed, 14 insertions(+), 7 deletions(-) create mode 100644 pkg/server/database/migrations/20200522170529-remove-billing-columns.sql diff --git a/pkg/server/database/migrations/20200522170529-remove-billing-columns.sql b/pkg/server/database/migrations/20200522170529-remove-billing-columns.sql new file mode 100644 index 00000000..a814f26b --- /dev/null +++ b/pkg/server/database/migrations/20200522170529-remove-billing-columns.sql @@ -0,0 +1,9 @@ +-- remove-billing-columns.sql drops billing related columns that are now obsolete. + +-- +migrate Up + +ALTER TABLE users DROP COLUMN IF EXISTS stripe_customer_id; +ALTER TABLE users DROP COLUMN IF EXISTS billing_country; + +-- +migrate Down + diff --git a/pkg/server/database/models.go b/pkg/server/database/models.go index 3344efbb..c7905158 100644 --- a/pkg/server/database/models.go +++ b/pkg/server/database/models.go @@ -65,13 +65,11 @@ type Note struct { // User is a model for a user type User struct { Model - UUID string `json:"uuid" gorm:"type:uuid;index;default:uuid_generate_v4()"` - StripeCustomerID string `json:"-"` - BillingCountry string `json:"-"` - Account Account - LastLoginAt *time.Time `json:"-"` - MaxUSN int `json:"-" gorm:"default:0"` - Cloud bool `json:"-" gorm:"default:false"` + UUID string `json:"uuid" gorm:"type:uuid;index;default:uuid_generate_v4()"` + Account Account + LastLoginAt *time.Time `json:"-"` + MaxUSN int `json:"-" gorm:"default:0"` + Cloud bool `json:"-" gorm:"default:false"` } // Account is a model for an account