[migration] more rename_entity_type fix
* ensure repository caches and system tables are properly cleanup
* delete relations from/to entities deleted through sql
So we don't ends up with a corrupted db...
sql('DROP FUNCTION IF EXISTS _fsopen(bytea)')sql('DROP FUNCTION IF EXISTS fspath(bigint, text, text)')