update appstc set
  appstc_deleted = true
where appstc_id = 1002; -- Lagerverwaltung

delete from appstc
where appstc_id = 1002;

insert into appgroupxstc (
  appgroupxstc_creator,
  appgroupxstc_author,
  appgroupxstc_appgroup_id,
  appgroupxstc_appstc_id
) select
  'migration 4.4.pre',
  'migration 4.4.pre',
  appgroup_id,
  1001
from appgroup
where coalesce(appgroup_zoperole, appgroup_name) not in ('Authenticated', 'Anonymous', 'Manager');

insert into whlocxappstc (
    whlocxappstc_author,
    whlocxappstc_creator,
    whlocxappstc_whloc_id,
    whlocxappstc_appstc_id
)   select
    'migration 4.4.pre',
    'migration 4.4.pre',
    whloc_id,
    1001
    from whloc;

insert into whobjxappstc (
    whobjxappstc_author,
    whobjxappstc_creator,
    whobjxappstc_whobj_id,
    whobjxappstc_appstc_id
)   select
    'migration 4.4.pre',
    'migration 4.4.pre',
    whobj_id,
    1001
    from whobj;

insert into mtartxappstc (
    mtartxappstc_author,
    mtartxappstc_creator,
    mtartxappstc_mtart_id,
    mtartxappstc_appstc_id
)   select
    'migration 4.4.pre',
    'migration 4.4.pre',
    mtart_id,
    1001
    from mtart




