Improve on_connect_do docs
[dbsrgits/DBIx-Class-Historic.git] / lib / DBIx / Class / Storage / DBI.pm
index 029e216..dfbb492 100644 (file)
@@ -319,7 +319,10 @@ C<limit_dialect>, C<quote_char>, and C<name_sep>.  Examples:
 
 =head2 on_connect_do
 
-Executes the sql statements given as a listref on every db connect.
+  $schema->storage->on_connect_do(['PRAGMA synchronous = OFF']);
+
+Call this after C<< $schema->connect >> to have the sql statements
+given executed on every db connect.
 
 This option can also be set via L</connect_info>.
 
@@ -914,6 +917,8 @@ L<DBIx::Class::Schema/deploy>.
 
 sub deployment_statements {
   my ($self, $schema, $type, $version, $dir, $sqltargs) = @_;
+  # Need to be connected to get the correct sqlt_type
+  $self->ensure_connected() unless $type;
   $type ||= $self->sqlt_type;
   $version ||= $schema->VERSION || '1.x';
   $dir ||= './';