Reverse-engineering a database into a model