Welcome to ModelRight Database Design Tool - Database Modeling Done Right Sign in | Join | Help
in

Compound key

Last post 11-04-2009, 10:12 AM by mcscreech. 3 replies.
Sort Posts: Previous Next
  •  11-03-2009, 5:44 PM 1363

    Compound key

    Hello,

    How does one make a compound (composite?) key in MR such as done with the sql command 'PRIMARY KEY(id, classId)'? Also, can I do so with a non-PRIMARY key?

    Thanks, DaveT.

  •  11-03-2009, 5:49 PM 1364 in reply to 1363

    Re: Compound key

    Sorry, too durn quick on clicking the post button.

    I should have also mentioned that I am trying to use the compound key as a foreign key to other tables where a more accurate example would be 'KEY('other_table_name', 'other_table_index')'.

    Thanks again, DaveT.

  •  11-03-2009, 6:03 PM 1365 in reply to 1364

    Re: Compound key

    Not sure I follow.  If you select a Key, you can add any key-worthy columns that you like using the Key/Members page.  You can also select a unique key to migrate using the Relation/Migrate/Migrate Key control.
    Scott Reynolds
    Technical Support Engineer
    ModelRight, Inc.
    www.modelright.com
    p: (609) 423-9296
    f: (866) 812-3742
  •  11-04-2009, 10:12 AM 1367 in reply to 1365

    Re: Compound key

    OK, I can see that. I guess I have not described the situation properly.

    I work with cakePHP and include access control in my app as described in 'Auth and ACL an end to end tutorial' (part 1 and part 2). I was trying to model this situation for the tables 'aros_acos', 'aros', 'acos', 'groups', and 'users' as a learning exercise in MR.

    So, I can see now that I am not looking at a PK - FK relationship linkage defined in sql, the program code is handling the selection of the appropriate tables to assign access to controllers (ACOs) by users and groups (AROs).

    I appologize for my confused request and thank you for your time.