mirror of
https://github.com/renee-png/acmcc.git
synced 2026-06-21 09:50:01 +00:00
183fe0a93c
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
15 lines
576 B
SQL
15 lines
576 B
SQL
|
|
-- Step 1: Add account_number column to units (rename from buildium_account_number)
|
|
ALTER TABLE public.units RENAME COLUMN buildium_account_number TO account_number;
|
|
|
|
-- Step 2: Migrate any account_number data from owners to their linked units (if unit doesn't already have one)
|
|
UPDATE public.units u
|
|
SET account_number = o.account_number
|
|
FROM public.owners o
|
|
WHERE o.unit_id = u.id
|
|
AND o.account_number IS NOT NULL
|
|
AND (u.account_number IS NULL OR u.account_number = '');
|
|
|
|
-- Step 3: Drop account_number from owners
|
|
ALTER TABLE public.owners DROP COLUMN account_number;
|