Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我们如何在 lift 的 mapper 中创建一个唯一的约束?
您可以通过在 MetaMapper 对象中添加以下内容来做到这一点
override def dbIndexes=UniqueIndex(<name-of-the-field>)::super.dbIndexes
也可以提供逗号分隔的字段列表
例如 -UniqueIndex(name,dob)
UniqueIndex(name,dob)