we're going to have charcoal colored shirts.
i asked for sparkles for color, but might not happen.
i said i would improve on SQL by eliminating NULLS
(that's the URL Jay is referencing)
we just started the podcast, so time to say naughty things!
object: is a group of columns, (a table), that has indexes
BEER is our example: beer has many distributors, with a brewer, and a name!
can add indexes add_unique_indexes()
belongs_to is the opposite end of has_many
has_one, might_have means that, and many_to_many is pretty complicated
create $schema from the Beer::Schema, and then ->connect($dsn) just like Class:
BI
err. Class:\
BI
"Chained Result Sets are what DBIC Great"
the code was bigger
create_ddl_dir() creates table statements
$schema->deploy() - creates database for you!
the big thing to understand going from Class:
BI to DBIx::Class
is that everything from DBIx::Class is a Result Set!
in the top level Schema - lots of ppl put in an init_schema() function to parse YAML, set things up, etc.
this results in much shorter tests! (testing with SQLite, instead of DB Brand X)
showing some code examples using beer from YAPC Asia
DBIx::Class will create the foreign key refs automatically
there were some weird things -- i think the more interesting case is what
cheeseinspector did at PDXPUG
where you're taking an ORM and modeling a DB that already exists. i think that's much harder.
DBIx::Class::QueryLog::Analyzer - useful for debugging!
caching q: example of an attribute held in the object, versus pulling from the DB - you can force a recall at any point.
jay recommends doing everything in a transaction.
$schema->txn_do( blah blah );
(that's how to do a transaction)
DBIx::Class::Schema::Loader
perl -MDBIx::Class::Schema::Loader=make_schema_at,dump_to_dir:./lib \
-e 'make_schema_at("My::Schema", { debug => 1 }, [ "dbi
g:dbname=foo","postgres" ])'
try Carp::REPL - read-eval-print-loop on die and or warn