diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2013-06-08 15:07:11 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2013-06-08 15:08:58 +0200 |
commit | 9c822ec823fb8a11745f09b5e45e43b405432ae0 (patch) | |
tree | eabf878860a245712247f7e62e0f8e557451812d /odb | |
parent | 3e8b52bb3815a343d59e66babd48e13840345d80 (diff) |
Propagate custom column name to polymorphic id refs
Diffstat (limited to 'odb')
-rw-r--r-- | odb/relational/processor.cxx | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/odb/relational/processor.cxx b/odb/relational/processor.cxx index c9f2179..5ac97f5 100644 --- a/odb/relational/processor.cxx +++ b/odb/relational/processor.cxx @@ -208,6 +208,16 @@ namespace relational if (m.count ("polymorphic-ref")) { + // Copy the column name from the root's id member, if specified. + // + { + semantics::class_& r (*object_pointer (t)); + semantics::data_member& id (*id_member (r)); + + if (id.count ("column")) + m.set ("column", id.get<table_column> ("column")); + } + m.set ("not-null", true); m.set ("deferred", false); m.set ("on-delete", sema_rel::foreign_key::cascade); |