camper/revert/contact_phone.sql

25 lines
419 B
PL/PgSQL

-- Revert camper:contact_phone from pg
begin;
set search_path to camper, public;
alter table contact
add column phone packed_phone_number default '+34000000000'
;
update contact
set phone = phone.phone
from contact_phone as phone
where phone.contact_id = contact.contact_id
;
alter table contact
alter column phone set not null
, alter column phone drop default
;
drop table if exists contact_phone;
commit;