=head1 NAME DBIx::DataModel::Doc::Delta_v2 - Differences introduced in version 2.0 =head1 DESCRIPTION The architecture and Application Programming Interface (API) of C were deeply refactored in version 2.0. This document enumerates the main differences introduced in that version. For older changes, see also L. =head1 NEW META LAYER All information about the schema is stored within meta-objects; such objects can be queried for retrieving the list of tables, the list of associations, etc. =head1 SCHEMA MODES The C<$dbh> database connection, and various parameters about SQL generation, are no longer stored within the Schema B; instead, they are stored in B of L. By default, there is only one such instance, and the class has a C method for reaching it : this is called I, which is compatible with previous versions of C, and is also the most economical way to work with the database. Even in single-schema mode, it is possible to switch between several C<$dbh>, through methods L and L. However, there is of course only one connected C<$dbh> at any point in time. If the application needs to communicate with several C<$dbh> at the same time, then it is necessary to enter I mode, simply by explicitly calling the L method on the schema subclass : my $schema1 = My::DB->new(dbh => $dbh1); my $schema2 = My::DB->new(dbh => $dbh2); As soon as the C method is called, the system knows that it should work in multi-schema mode, and the C method becomes prohibited. As a consequence, calls to C or C can no longer be invoked on a class name: the schema needs to be specified # this does NOT work in multi-schema mode my $rows = My::DB::SomeTable->select(...) # but this does work my $rows = $schema1->table('SomeTable')->select(...) Another consequence of multi-schema mode is that every data row will contain a reference to its schema, under name C<__schema>. This is necessary if we want to be able to follow paths from that row : my $other_row = $row->some_associated_table(); Therefore there is a small penalty for multi-schema mode, because the C<__schema> in every row needs some memory and some bookkeeping. =head1 API CHANGES =head2 Deprecation of camelCase methods All methods and parameters previously written in "camelCase" notation (à la Java, i.e "someMethodNameWithManyWords") are now written with underscores (à la Perl, i.e. "some_method_name_with_many_words"). =head2 SQL::Abstract::More Code that used to be with C, for extending the L API, and tuning SQL generation, is now moved to a separate distribution called L. =head2 Introduction of Params::Validate Arguments to methods are now systematically checked through L. This is in accordance with the principle of "defensive programming", and helps to discover errors sooner. =head2 Extended usage for C and C It is now possible to perform bulk updates or deletes, just like in straigt SQL : My::DB::SomeTable->update(-set => {foo => 123} -where => {bar => {"<" => 456}}); My::DB::SomeTable->delete(-where => {col => {-like => "foobar%"}); =head2 Table inheritance If your database supports table inheritance (like for example PostgreSQL), you might define a corresponding inheritance structure between the Perl table classes. =head2 Reorganization of data sources The former class C is deprecated; it is now treated exactly like a C. A new L class has been introduced (together with its meta L) : this gives a cleaner structure for the specific needs of database joins. =head1 DEPRECATED FEATURES =head2 Autoload Autoload is deprecated. Reading or setting a column value is done through the usual Perl operations for working with hashrefs.