GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Catalyst::Plugin::AutoCRUD::Manual::DBICTips(3) User Contributed Perl Documentation Catalyst::Plugin::AutoCRUD::Manual::DBICTips(3)

Catalyst::Plugin::AutoCRUD::Manual::DBICTips - Tips for DBIx::Class Users

If you created your "DBIx::Class" Schema some time ago, perhaps using an older version of "DBIx::Class::Schema::Loader", then it might well be lacking some configuration which is required to get the best results from this plugin.

Common omissions in column configurations include "is_foreign_key", "join_type", "is_nullable", and "is_auto_increment". Of course it's also good practice to have your "DBIx::Class" Schema closely reflect the database schema anyway.

To automatically bring things up to date, download the latest version of DBIx::Class::Schema::Loader from CPAN, and use the output from that.

Any column in your result classes which contains the primary key of another table should have the "is_foreign_key => 1" option added to its configuration.

If using "DBIx::Class::Schema::Loader" to generate your Schema, use at least version 0.05 or the most recent release from CPAN to have this automatically configured for you.

Whenver you use "belongs_to()" in a result class, it must come after any calls to "add_column()" which affect the foreign key. A situation where this may not be the case is if you add additional column options in a second call to "add_column()", after the "DO NOT MODIFY THIS OR ANYTHING ABOVE" line.

If you do not follow this guideline, then you won't see any related data in the views generated by this plugin. Furthermore, you'll be losing much of the advantage of "DBIx::Class".

A better solution is to re-generate your result class using a recent version of "DBIx::Class::Schema::Loader" from the CPAN (which may be 0.05 or later).

If you have any "belongs_to" type relations where the column containing the foreign key can be NULL, it's strongly recommended that you add a "join_type" parameter to the end of the relevant options to "add_columns()", like so:

 # in a Book class, the book optionally has an Owner
 __PACKAGE__->belongs_to(
     'my_owner',                      # accessor name
     'My::DBIC::Schema::Owner',       # related class
     'owner_id',                      # our FK column (or join condition)
     { join_type => 'LEFT OUTER' }    # attributes
 );

If you don't do this, some database records will be missing! The technical reason for this, if you are interested, is that "DBIx::Class" defaults to an INNER join for the "belongs_to()" relation, but if the column can be null (that is, "is_nullable") then you most likely want a LEFT OUTER join.

If using "DBIx::Class::Schema::Loader" to generate your Schema, use at least version 0.05 or the most recent release from CPAN to have this automatically configured for you.

For those columns where your database uses an auto-incremented value, add the "is_auto_increment => 1" parameter to the options list in "add_columns()". This will let the plugin know you don't need to supply a value for new or updated records. The interface will look much better as a result.

If using "DBIx::Class::Schema::Loader" to generate your Schema, use at least version 0.05 or the most recent release from CPAN to have this automatically configured for you.

2014-07-12 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.