17 Feb 2008 15:05
metastorage: how to set an unique one-to-one relation between two classes
Miguel Oliveira <miguel <at> ua.pt>
2008-02-17 14:05:03 GMT
2008-02-17 14:05:03 GMT
Hello,
I've started using metastorage and create my component to generate
the db schema:
<class>
<name>users</name>
....
<variable>
<name>profile_id</name>
<class>profiles</class>
</variable>
</class>
also,
<class>
<name>profile</name>
....
<variable>
<name>user_id</name>
<class>users</class>
</variable>
</class>
Webstorage generate the output schema and manipulation files and
further, metastorage create the db.
My doubt consists in this: When adding a new user record it should
have an associated profile(mandatory). The fields user_id and
profile_id in database are not defined as 'not null' as i think they
suppose to be.
Is in metabase any way to make those fields 'not null'? I've seen
documentation regarding to references, getreference, setreference but
i'm not sure if this should be used or not.
Because i'll need to check user settings and access policy, should i
create functions to get id's in the component?
regards,
miguel
RSS Feed