Add missing bounce_type
to v2 migration.
This commit is contained in:
parent
9302dfbd56
commit
fd8f5a96c9
2 changed files with 12 additions and 1 deletions
|
@ -8,6 +8,17 @@ import (
|
|||
|
||||
// V2_0_0 performs the DB migrations for v.1.0.0.
|
||||
func V2_0_0(db *sqlx.DB, fs stuffbin.FileSystem, ko *koanf.Koanf) error {
|
||||
if _, err := db.Exec(`
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (SELECT 1 FROM pg_type WHERE typname = 'bounce_type') THEN
|
||||
CREATE TYPE bounce_type AS ENUM ('soft', 'hard', 'complaint');
|
||||
END IF;
|
||||
END$$;
|
||||
`); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if _, err := db.Exec(`
|
||||
CREATE TABLE IF NOT EXISTS bounces (
|
||||
id SERIAL PRIMARY KEY,
|
||||
|
|
|
@ -102,7 +102,7 @@ CREATE TABLE campaigns (
|
|||
|
||||
DROP TABLE IF EXISTS campaign_lists CASCADE;
|
||||
CREATE TABLE campaign_lists (
|
||||
id BIGSERIAL PRIMARY KEY,
|
||||
id BIGSERIAL PRIMARY KEY,
|
||||
campaign_id INTEGER NOT NULL REFERENCES campaigns(id) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
|
||||
-- Lists may be deleted, so list_id is nullable
|
||||
|
|
Loading…
Reference in a new issue