Issue
The domains table doesn't exist in the production database, so no domains are showing on the Services page.
Solution
1. Run the Migration on Production Database
Connect to your production database and run the migration:
psql postgresql://YOUR_DB_USER:YOUR_DB_PASSWORD@YOUR_DB_HOST:5432/YOUR_DB_NAME -f rmm-psa-database/2026_02_add_domains.sql
Or if you have access to the production server:
cd /path/to/rmm-psa-database
psql -U YOUR_DB_USER -d YOUR_DB_NAME -f 2026_02_add_domains.sql
2. Verify Table Exists
SELECT EXISTS (
SELECT FROM information_schema.tables
WHERE table_name = 'domains'
);
3. Start the Domain Sync Worker
Once the table exists, start the domain sync worker to fetch domains from Cloudflare:
cd /path/to/rmm-psa-backend
pm2 start domainSyncWorker.js --name "domain-sync"
pm2 save
4. Manually Trigger First Sync
Or trigger a manual sync via the API (as root tenant):
curl -X POST https://your-api-url.com/api/domains/sync \
-H "Authorization: Bearer YOUR_ROOT_TOKEN"
5. Add Test Domain (Optional)
If you want to add a test domain manually:
INSERT INTO domains (
tenant_id,
domain_name,
registrar,
status,
registration_date,
expiration_date,
auto_renew,
whois_privacy
) VALUES (
(SELECT tenant_id FROM tenants WHERE subdomain = 'everydaytech' LIMIT 1),
'example.com',
'cloudflare',
'active',
NOW(),
NOW() + INTERVAL '1 year',
true,
true
);
What the Migration Creates
The migration creates:
- domains table - stores domain information
- domain_renewals table - tracks renewal history
- Indexes for performance
- Tenant isolation with tenant_id foreign key
Troubleshooting
Table doesn't appear after migration:
- Check for SQL errors in migration output
- Verify you're connected to the correct database
- Check table exists: \dt domains
Domains still not showing:
- Check browser console for API errors
- Verify tenant_id matches your logged-in user's tenant
- Root tenant (is_msp=true) should see all domains
- Regular tenants only see their own domains
Sync worker not finding domains:
- Ensure domains have ‘registrar = 'cloudflare’
- Check registrar_domain_id (zone_id) is set
- Verify CLOUDFLARE_API_TOKEN has permissions
- Check worker logs: pm2 logs domain-sync`