[Catalyst] Best Practices - an application.
Matt S Trout
dbix-class at trout.me.uk
Sun Sep 17 19:31:06 CEST 2006
Mojo Nichols wrote:
> Next I create the database, essentially I have a systems table and users
> as below. This could probably be modeled better and comments are
> welcome. The systems contains the type of database to allow for
> different databases management schemes. The database name to keep track
> of multiple databases on one server and the server name as in hostname.
> User_roles for the system, so we can have custom routines for specific
> roles (but I'm not sure this is the right place for this). This may be
> better placed in the users table.
>
> The important fields in the users table are: user_role,
> db_server,db_name, username. The relation between users and systems is
> many to many. One system has many user, and one user can have access to
> many systems.
>
> I have not had experience in doing slick many to many with dbix, so
> input on this would be great. I can add system to users relationship to
> formalize the many to many, but have not yet. Do people have opinions on
> mulitpart keys, to they work with DBIx.. etc. Comments would be
> welcome, and other ideas or models would be considered.
http://search.cpan.org/dist/DBIx-Class/lib/DBIx/Class/Relationship.pm#many_to_many
so if your $system has a many-many called users you can use add_to_users to
add an entry or set_users(\@users) to set the full list at once.
DBIx::Class was designed to support composite primary, foreign and unique keys
from the start, so you'll find they work fine.
--
Matt S Trout Offering custom development, consultancy and support
Technical Director contracts for Catalyst, DBIx::Class and BAST. Contact
Shadowcat Systems Ltd. mst (at) shadowcatsystems.co.uk for more information
+ Help us build a better perl ORM: http://dbix-class.shadowcatsystems.co.uk/ +
More information about the Catalyst
mailing list