Fix the revert of contact_phone and contact_tax_details
This is mostly to be able to sqitch rebase and restart with the demo data during development, as it is very unlikely that i will need to revert those at this point.
This commit is contained in:
parent
662ba59be3
commit
5b0ca28b97
|
@ -5,7 +5,7 @@ begin;
|
|||
set search_path to numerus, public;
|
||||
|
||||
alter table contact
|
||||
add column phone packed_phone_number
|
||||
add column phone packed_phone_number default '+34000000000'
|
||||
;
|
||||
|
||||
update contact
|
||||
|
@ -16,6 +16,7 @@ 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;
|
||||
|
|
|
@ -6,19 +6,24 @@ set search_path to numerus, public;
|
|||
|
||||
alter table contact
|
||||
drop constraint name_not_empty
|
||||
, add column country_code country_code
|
||||
, add column postal_code text
|
||||
, add column province text
|
||||
, add column city text
|
||||
, add column address text
|
||||
, add column vatin vatin
|
||||
, add column business_name text constraint business_name_not_empty check(length(trim(business_name)) > 1)
|
||||
, add column country_code country_code default 'ES'
|
||||
, add column postal_code text default ''
|
||||
, add column province text default ''
|
||||
, add column city text default ''
|
||||
, add column address text default ''
|
||||
, add column vatin vatin default 'ES40404040D'
|
||||
, add column business_name text default 'ACME' constraint business_name_not_empty check(length(trim(business_name)) > 1)
|
||||
;
|
||||
|
||||
alter table contact
|
||||
rename column name to trade_name
|
||||
;
|
||||
|
||||
update contact
|
||||
set business_name = trade_name
|
||||
where true
|
||||
;
|
||||
|
||||
update contact
|
||||
set business_name = tax.business_name
|
||||
, vatin = tax.vatin
|
||||
|
@ -32,12 +37,20 @@ where tax.contact_id = contact.contact_id
|
|||
;
|
||||
|
||||
alter table contact
|
||||
alter column business_name set not null
|
||||
alter column business_name drop default
|
||||
, alter column business_name set not null
|
||||
, alter column vatin drop default
|
||||
, alter column vatin set not null
|
||||
, alter column vatin set not null
|
||||
, alter column address drop default
|
||||
, alter column address set not null
|
||||
, alter column city drop default
|
||||
, alter column city set not null
|
||||
, alter column province drop default
|
||||
, alter column province set not null
|
||||
, alter column postal_code drop default
|
||||
, alter column postal_code set not null
|
||||
, alter column country_code drop default
|
||||
, alter column country_code set not null
|
||||
;
|
||||
|
||||
|
|
Loading…
Reference in New Issue