On 4/2/07, Jonathan Vanasco <[EMAIL PROTECTED]> wrote:
> I'm adding a new table with 2 unique indexes / keys on it , one of
> which is a multiple column key.  the docs are really unclear on how
> thats done in the setup.

http://search.cpan.org/dist/Rose-DB-Object/lib/Rose/DB/Object/Metadata.pm#unique_keys

unique_keys KEYS

Get or set the list of unique keys for this table. If KEYS is passed,
any existing keys will be deleted and KEYS will be passed to the
add_unique_keys method.

---

http://search.cpan.org/dist/Rose-DB-Object/lib/Rose/DB/Object/Metadata.pm#add_unique_keys

add_unique_keys KEYS

Add new unique keys specified by KEYS. Unique keys can be specified in
KEYS in two ways.

If an argument is a Rose::DB::Object::Metadata::UniqueKey object (or
subclass thereof), then its parent is set to the metadata object
itself, and it is added.

Otherwise, an argument must be a single column name or a reference to
an array of column names that make up a unique key.

---

http://search.cpan.org/dist/Rose-DB-Object/lib/Rose/DB/Object/Metadata.pm#setup

Given a method/arrayref pair:

    METHOD => [ ARG1, ARG2 ]

The arguments will be removed from their array reference and passed to
METHOD like this:

    $meta->METHOD(ARG1, ARG2);

---

Therefore:

    __PACKAGE__->meta->setup
    (
      ...
      unique_keys =>
      [
        [ 'col1' ],         # uk with one column
        [ 'col2', 'col3' ], # uk with two columns
        ...
      ],
      ...
    );

-John

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object

Reply via email to