Method: Sequel::Database#on_delete_clause
- Defined in:
- lib/sequel/database/schema_sql.rb
#on_delete_clause(action) ⇒ Object
SQL DDL ON DELETE fragment to use, based on the given action. The following actions are recognized:
-
:cascade - Delete rows referencing this row.
-
:no_action (default) - Raise an error if other rows reference this row, allow deferring of the integrity check.
-
:restrict - Raise an error if other rows reference this row, but do not allow deferring the integrity check.
-
:set_default - Set columns referencing this row to their default value.
-
:set_null - Set columns referencing this row to NULL.
178 179 180 181 182 183 184 185 186 187 188 189 190 191 |
# File 'lib/sequel/database/schema_sql.rb', line 178 def on_delete_clause(action) case action when :restrict RESTRICT when :cascade CASCADE when :set_null SET_NULL when :set_default SET_DEFAULT else NO_ACTION end end |