
with ops (name,value) as (
  values ('guidtype','uuid')
    ,('max_constraint','30')
    ,('droprename','_dropped_')
    ,('settype_names_jsonb','jsonvalue,jsonbvalue,jsonschema')
    ,('default_schema:hub','core')
    ,('default_schema:hub_link','core')
 --,('default_schema:colour','core')
--- ,('default_schema:mastertype','core') --Master type must not be set for pgifas
    ,('default_schema:workflowitem','core')
    ,('exclude:public','suppinvoice,suppinvoiceitem,project,generalledger,supporder,subaccount,customerinvoice,custcreditnoteitem,custinvoiceitem,cashbookdetail,supporderitem,bankstatement,journaldetail,custcreditnote,custcreditnoteitem,autoreconstring,Suppcreditnote,suppcreditnoteitem')
--    ,('default_schema:fiscalyear','core')
--     ,('default_schema:autoreconstring','core')
--     ,('default_schema:postalcode','core')
--     ,('default_schema:cashbookdetail','core')
--     ,('default_schema:supporderitem','core')
--     ,('default_schema:accounttype','core')
--     ,('default_schema:bankstatement','core')
--     ,('default_schema:journaldetail','core')
--     ,('default_schema:cashbook','core')
--     ,('default_schema:custcreditnote','core')
--     ,('default_schema:custcreditnoteitem','core')
--     ,('default_schema:custinvoiceitem','core')
--     ,('default_schema:customerinvoice','core')
--     ,('default_schema:generalledger','core')
--     ,('default_schema:journal','core')
--     ,('default_schema:suppcreditnote','core')
--     ,('default_schema:suppcreditnoteitem','core')
--     ,('default_schema:suppinvoice','core')
--     ,('default_schema:suppinvoiceitem','core')
--     ,('default_schema:supporder','core')
--     ,('default_schema:subaccount','core')
--     ,('default_schema:project','core')
--     ,('default_schema:period','core')
), upd as (
  update meta.migration_option o
  set value = ops.value
  from ops
  where o.name = ops.name
  returning  *
)
insert into meta.migration_option(name,value)
select ops.name,ops.value from ops
where not exists (
  select *
  from meta.migration_option o
  where o.name = ops.name
);

delete from meta.migration_option o
where o.name in ('default_schema:mastertype','default_schema:colour')
;