diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2013-04-08 11:13:51 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2013-04-10 18:46:44 +0200 |
commit | a4f25daf17392c9c4b90de60b9d777290706f667 (patch) | |
tree | e3b4903ac35eb2ec4c44cfc7ce630f5d964c7b3d /odb/relational/model.hxx | |
parent | 2fa6a4d00945866e62d980270d5807f3abca75ab (diff) |
Generate add/drop foreign key migration statements
Also add the --fkeys-deferrable-mode option. General schemas generation
rework.
Diffstat (limited to 'odb/relational/model.hxx')
-rw-r--r-- | odb/relational/model.hxx | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/odb/relational/model.hxx b/odb/relational/model.hxx index 4c4bba6..44f01c9 100644 --- a/odb/relational/model.hxx +++ b/odb/relational/model.hxx @@ -228,14 +228,16 @@ namespace relational string id (id_prefix_ + (key_prefix_.empty () ? m.name () : key_prefix_)); - bool deferred (m.get<bool> ("deferred", true)); + deferrable def ( + m.get<deferrable> ("deferrable", + options.fkeys_deferrable_mode ()[db])); + foreign_key::action_type on_delete ( m.get<foreign_key::action_type> ( "on-delete", foreign_key::no_action)); foreign_key& fk ( - model_.new_node<foreign_key> ( - id, table_name (c), deferred, on_delete)); + model_.new_node<foreign_key> (id, table_name (c), def, on_delete)); fk.set ("cxx-location", m.location ()); @@ -522,7 +524,7 @@ namespace relational model_.new_node<sema_rel::foreign_key> ( id + ".id", table_name (*context::top_object), - false, // immediate + sema_rel::deferrable::not_deferrable, sema_rel::foreign_key::cascade)); fk.set ("cxx-location", m.location ()); model_.new_edge<sema_rel::unames> ( |