Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
- Migration 065: backfill user_companies from legacy User.company_id - Auth register: create UserCompany record on registration - Admin assign company: sync user_companies when assigning via admin panel - Fix NordaEvent field names: start_time→time_start, end_time→time_end, max_participants→max_attendees, remove non-existent fields Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
12 lines
455 B
SQL
12 lines
455 B
SQL
-- Migration 065: Sync legacy User.company_id to user_companies table
|
|
-- For all users with company_id set but missing user_companies record
|
|
|
|
INSERT INTO user_companies (user_id, company_id, role, is_primary, created_at, updated_at)
|
|
SELECT u.id, u.company_id, 'MANAGER', true, NOW(), NOW()
|
|
FROM users u
|
|
WHERE u.company_id IS NOT NULL
|
|
AND NOT EXISTS (
|
|
SELECT 1 FROM user_companies uc
|
|
WHERE uc.user_id = u.id AND uc.company_id = u.company_id
|
|
);
|