Niet in staat om Discourse te herstellen/updaten (PG::InvalidTextRepresentation: ERROR: ongeldige invoersyntaxis voor type integer: "[]")

I think you should be able to run SiteSetting.selectable_avatars = "" (from the rails console again), and then be good for a rebuild.