diff --git a/internal/migrations/v2.0.0.go b/internal/migrations/v2.0.0.go index ed60190..8123f14 100644 --- a/internal/migrations/v2.0.0.go +++ b/internal/migrations/v2.0.0.go @@ -39,5 +39,9 @@ func V2_0_0(db *sqlx.DB, fs stuffbin.FileSystem, ko *koanf.Koanf) error { return err } + if _, err := db.Exec(`ALTER TABLE subscribers DROP COLUMN IF EXISTS campaigns; `); err != nil { + return err + } + return nil } diff --git a/models/models.go b/models/models.go index dcf9c89..f8c4f97 100644 --- a/models/models.go +++ b/models/models.go @@ -120,13 +120,12 @@ type User struct { type Subscriber struct { Base - UUID string `db:"uuid" json:"uuid"` - Email string `db:"email" json:"email"` - Name string `db:"name" json:"name"` - Attribs SubscriberAttribs `db:"attribs" json:"attribs"` - Status string `db:"status" json:"status"` - CampaignIDs pq.Int64Array `db:"campaigns" json:"-"` - Lists types.JSONText `db:"lists" json:"lists"` + UUID string `db:"uuid" json:"uuid"` + Email string `db:"email" json:"email"` + Name string `db:"name" json:"name"` + Attribs SubscriberAttribs `db:"attribs" json:"attribs"` + Status string `db:"status" json:"status"` + Lists types.JSONText `db:"lists" json:"lists"` // Pseudofield for getting the total number of subscribers // in searches and queries. diff --git a/schema.sql b/schema.sql index 1b23937..e7ff006 100644 --- a/schema.sql +++ b/schema.sql @@ -16,7 +16,6 @@ CREATE TABLE subscribers ( name TEXT NOT NULL, attribs JSONB NOT NULL DEFAULT '{}', status subscriber_status NOT NULL DEFAULT 'enabled', - campaigns INTEGER[], created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(), updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()