[Shapes] Improve "DATABASE" mode preserving ER cardinalities