Add missing bounce_type to v2 migration.

This commit is contained in:
Kailash Nadh 2021-09-17 20:18:53 +05:30
parent 9302dfbd56
commit fd8f5a96c9
2 changed files with 12 additions and 1 deletions

View file

@ -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,