Ok, I got further, here is a patch for setup.pl:
Not many errors now:
psql:/tmp/ledgersmb/1.2-1.3-upgrade.sql:358: ERROR: new row for relation "entity" violates check constraint "entity_name_check"psql:/tmp/ledgersmb/1.2-1.3-upgrade.sql:364: ERROR: null value in column "entity_id" violates not-null constraint
DETAIL: Failing row contains (389, , 3, 2014-03-23, E-2, 78).psql:/tmp/ledgersmb/1.2-1.3-upgrade.sql:372: ERROR: null value in column "entity_id" violates not-null constraint
DETAIL: Failing row contains (1, null, null, , null, , 2014-03-23).psql:/tmp/ledgersmb/1.2-1.3-upgrade.sql:387: ERROR: null value in column "entity_id" violates not-null constraint
DETAIL: Failing row contains (null, 2011-04-12, null, user, null, t, null, 2, null).