From e80bdee8d3a6dcf246c73645d610de182cfa2cde Mon Sep 17 00:00:00 2001 From: Andrew Date: Fri, 26 Jun 2026 15:14:52 -0400 Subject: [PATCH] refactor(db): replace ENUM types with TEXT columns in migrations Drop the match_prefs, industries, and match_status ENUM types in favor of plain TEXT columns. Also change members.topics from TEXT[] to TEXT. --- db/migration/V0001__Create_members_table.sql | 13 +++---------- db/migration/V0003__Create_matches_table.sql | 12 +----------- 2 files changed, 4 insertions(+), 21 deletions(-) diff --git a/db/migration/V0001__Create_members_table.sql b/db/migration/V0001__Create_members_table.sql index e032b27..a69ad4e 100644 --- a/db/migration/V0001__Create_members_table.sql +++ b/db/migration/V0001__Create_members_table.sql @@ -1,10 +1,3 @@ -CREATE TYPE match_prefs AS ENUM ('mentor', 'mentee', 'both'); -CREATE TYPE industries AS ENUM ( - 'technology', 'finance', 'healthcare', 'education', - 'consulting', 'government', 'nonprofit', 'other' -); - - CREATE TABLE IF NOT EXISTS "members" ( id UUID PRIMARY KEY, full_name TEXT NOT NULL, @@ -13,10 +6,10 @@ CREATE TABLE IF NOT EXISTS "members" ( bio TEXT, referral_source TEXT, active BOOLEAN, - match_pref match_prefs, - industry industries, + match_pref TEXT, + industry TEXT, role TEXT, - topics TEXT[], + topics TEXT, extra_notes TEXT, created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW() diff --git a/db/migration/V0003__Create_matches_table.sql b/db/migration/V0003__Create_matches_table.sql index d6efdfc..ec95ad8 100644 --- a/db/migration/V0003__Create_matches_table.sql +++ b/db/migration/V0003__Create_matches_table.sql @@ -1,13 +1,3 @@ -CREATE TYPE match_status AS ENUM ( - 'pending', - 'accepted', - 'declined', - 'active', - 'paused', - 'completed', - 'cancelled' -); - CREATE TABLE IF NOT EXISTS "matches" ( id UUID PRIMARY KEY, member_a_id UUID NOT NULL, @@ -17,7 +7,7 @@ CREATE TABLE IF NOT EXISTS "matches" ( CONSTRAINT fk_member_b FOREIGN KEY (member_b_id) REFERENCES members(id) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT fk_cycle FOREIGN KEY (cycle_id) REFERENCES match_cycles(id) ON DELETE CASCADE ON UPDATE CASCADE, match_score REAL, - status match_status, + status TEXT, feedback_a INT, feedback_b INT, created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()