 
 create table if not exists transaction_history (
     id integer references transaction(id) on delete restrict,
-    change bigint references change(id) on delete restrict,
+    change bigint references change(id) on delete cascade,
     primary key(id, change),
     -- valid can be set to false at any time
     valid bool not null default true,


create table if not exists creditor_share_history (
    id integer references creditor_share(id) on delete restrict,
    change bigint references change(id) on delete restrict,
    primary key(id, change),
    -- valid can be set to false at any time, but the transaction may
    -- become impossible to evaluate (making commiting impossible).


create table if not exists purchase_item_history (
    id integer references purchase_item(id) on delete restrict,
    change bigint references change(id) on delete cascade,
    primary key(id, change),
    -- valid can be set to false at any time.
    valid bool not null default true,
