Add Constraints To Mapper
from the mailing-list
"You could have a a Constraint trait, which has some method to get the
relevant SQL, as well as an optional function to define the constraint
name.
There would be classes that implement that-Eg: UniqueConstraint,
CheckConstraint, (to be able to do something like CHECK (column > 0)),
NotNullConstraint, PrimaryKeyConstraint, ForeignKeyConstraint (the
last two are already implemented in Mapper in a different Mapper)
Then each Mapped field would have a List[Constraint] of constraints.
In the Schemifier, ensureConstraints would then iterate over each
field (as it does now) and then construct the ALTER TABLE syntax.
The user would of course be able to define their own Application/
Database-specific constraints easily as well. "
"You could have a a Constraint trait, which has some method to get the
relevant SQL, as well as an optional function to define the constraint
name.
There would be classes that implement that-Eg: UniqueConstraint,
CheckConstraint, (to be able to do something like CHECK (column > 0)),
NotNullConstraint, PrimaryKeyConstraint, ForeignKeyConstraint (the
last two are already implemented in Mapper in a different Mapper)
Then each Mapped field would have a List[Constraint] of constraints.
In the Schemifier, ensureConstraints would then iterate over each
field (as it does now) and then construct the ALTER TABLE syntax.
The user would of course be able to define their own Application/
Database-specific constraints easily as well. "
Leave a comment