Since automatic migration failed due to PostgreSQL password issues, here's how to do it manually:
# Try one of these:
psql -U postgres
# OR
sudo -u postgres psql
# OR
psql postgresql://postgres@localhost:5432/postgresCREATE DATABASE myapp;
\c myapp -- Connect to databaseCopy and paste the SQL from sql/create-ab-testing-tables.sql into psql.
Or run it from file:
# If connected as postgres user
psql -d myapp -f sql/create-ab-testing-tables.sql
# Or from within psql
\i sql/create-ab-testing-tables.sql-- Check tables were created
SELECT table_name
FROM information_schema.tables
WHERE table_schema = 'public'
AND table_name IN ('experiments', 'experiment_conversions', 'experiment_assignments', 'feature_flags');
-- Check feature flags
SELECT key, enabled, rollout_pct, target_cohort FROM feature_flags;If you forgot the PostgreSQL password:
# Stop PostgreSQL
sudo systemctl stop postgresql
# Edit pg_hba.conf to allow trust authentication
sudo nano /etc/postgresql/*/main/pg_hba.conf
# Change "md5" to "trust" for local connections
# Restart PostgreSQL
sudo systemctl start postgresql
# Connect without password
psql -U postgres
# Reset password
ALTER USER postgres WITH PASSWORD 'newpassword';
# Restore pg_hba.conf and restartIf you just want to test the A/B testing logic without database:
- Comment out TypeORM decorators in entities (temporarily)
- Use mock repositories in tests
- The service logic works even without database tables
The implementation is complete. Once you get PostgreSQL working, run the migration and the service will be fully operational.