numerus/revert/contact_phone.sql

25 lines
421 B
PL/PgSQL

-- Revert numerus:contact_phone from pg
begin;
set search_path to numerus, 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;