001package io.ebean.annotation;
002
003/**
004 * Modes for the DbForeignKey onDelete and onUpdate clause of a foreign keys.
005 * <p>
006 * Note that we should never change the <code>onUpdate</code> clause as primary keys
007 * should never change. Instead review the design ensuring the primary keys are immutable.
008 * Always leave the onUpdate mode at it's default of RESTRICT ('No Action').
009 * </p>
010 *
011 * @see DbForeignKey
012 */
013public enum ConstraintMode {
014
015        /**
016         * Restrict - The usual default behavior for foreign constraints (also known as 'No Action').
017         */
018        RESTRICT,
019
020        /**
021         * Set the value to null when a referenced id is deleted.
022         */
023        SET_NULL,
024
025        /**
026         * Set the value to 'default' when a referenced id is deleted.
027         */
028        SET_DEFAULT,
029
030        /**
031         * Cascade - To automatically cascade a delete of a referenced id.
032         */
033        CASCADE
034
035}