This method, overridden by the Null and NotNull Key mixins, tells if a column is allowed to be null with respect to the SQL schema.
This method, overridden by the Null and NotNull Key mixins, tells if a column is allowed to be null with respect to the SQL schema. Using the stackable trait pattern it's easier for the end DSL users to mentally map a Scala schema to an SQL schema with 0 effort and inversely, go from SQL to Morpheus DSL code.
A Boolean value.
The default ForeignKey constraint with respect to the MySQL documentation is NoAction and we enforce that here.
The default ForeignKey constraint with respect to the MySQL documentation is NoAction and we enforce that here. If the constraint defined on either update or delete is NoAction, then there will be no serialisation output as MySQL doesn't need it.
The ForeignKey Constraint to execute on update.
This is actually irrelevant at any further point, since the query builder of ForeignKey will not account for it's SQL type.
This is actually irrelevant at any further point, since the query builder of ForeignKey will not account for it's SQL type. We do however need to satisfy the context bound of an SQL primitive and we do so easily but using a random predefined type.
The SQL type of the column, ignored in the current context.
A dangerous mix indeed, since it will all go to hell if the user defines a ForeignKey constraint to no column.
A dangerous mix indeed, since it will all go to hell if the user defines a ForeignKey constraint to no column. The above root cause of evil for the below line is not valid SQL syntax, but we should likely upgrade to a more sensible error. TODO (flavian): Idiotic line, upgrade the preconditions.
Same story as above, these are placeholders to satisfy the structure we've defined for our DSL.
Same story as above, these are placeholders to satisfy the structure we've defined for our DSL. It is likely proof we could have decoupled certain things to prevent the need for impromptu definitions like this, but we didn't so far.
The value to convert to an SQL value.
This is the implementation of a ForeignKey column. This is not a value column, therefore the
apply
method is overridden to throw an exception. It is used at reflection time and schema generation time to correctly create the schema for a given table and serialise a ForeignKey accordingly.The peculiar type signature is very simple really. It's using the all known and loved shapeless type inequality constraint, essentially forcing DSL users to specify 2 different owning tables for the origin and reference of a FOREIGN_KEY. It's a way of making FOREIGN_KEY indexes impossible between a table and itself and it's also nicely confining all columns to belong to the same reference table, effectively enforcing the SQL constraint that a ForeignKey cannot reference columns from more than one table.
The second type constraint enforced via the ev2 implicit parameter is requesting that the columns referenced in a ForeignKey are not an Index or ForeignKey themselves, as this is invalid with respect to SQL syntax.
By default the action performed is DefaultForeignKeyConstraints.NoAction, with respect to the SQL standard.
The type of the owner table.
The type of the record.