Revision history for Perl extension DBIx::Class::Schema::Loader
+ - added 'qualify_objects' option to prepend db_schema to table names
- fix for negative numeric default values
- sequence is detected for Oracle
- fix for SQLite is_auto_increment detection when table is empty (hobbs)
Firebird/InterBase 'unquoted_ddl' options in favor of it.
- support CamelCase table names and column names (in case-preserving
mode) at the v7 naming level
- - rewrite datetime default functions as \'CURRENT_TIMESTAMP' where
+ - rewrite datetime default functions as \'current_timestamp' where
possible (except for Sybase ASE) to ease cross-deployment
- use column_info instead of select to get Oracle column list (RT#42281)
- match quotes in MySQL parser in more places (RT#42101)
- add hashref form of components to control which components are added to
which classes
- check rel accessors for method conflicts
- - add an option to add extra code to Result classes
+ - add an option to add extra code to Result classes (maybe...)
- redo in-memory schema as an @INC coderef rather than temp files
- add option to filter out views
- support columns with names like "ro'd p/n"
datetime_locale
config_file
loader_class
+ qualify_objects
/);
Currently the drivers for SQLite, mysql, MSSQL and Firebird/InterBase support
setting this option.
+=head1 qualify_objects
+
+Set to true to prepend the L</db_schema> to table names for C<<
+__PACKAGE__->table >> calls, and to some other things like Oracle sequences.
+
=head1 METHODS
None of these methods are intended for direct invocation by regular
$table_name = \ $self->_quote_table_name($table_name);
}
- $self->_dbic_stmt($table_class,'table',$table_name);
+ $self->_dbic_stmt($table_class, 'table', ($self->qualify_objects ? ($self->db_schema . '.') : '') . $table_name);
my $cols = $self->_table_columns($table);
my $col_info = $self->__columns_info_for($table);
$result->{$col_name}{is_auto_increment} = 1;
- if (my ($seq_name) = $trigger_body =~ /"?(\w+)"?\.nextval/i) {
- $seq_name = $self->_lc($seq_name);
+ if (my ($seq_schema, $seq_name) = $trigger_body =~ /(?:\."?(\w+)"?)?"?(\w+)"?\.nextval/i) {
+ $seq_schema = $self->_lc($seq_schema) || $self->db_schema;
+ $seq_name = $self->_lc($seq_name);
- $result->{$col_name}{sequence} = $seq_name;
+ $result->{$col_name}{sequence} = ($self->qualify_objects ? ($seq_schema . '.') : '') . $seq_name;
}
}
$self->next::method($schema);
}
+# A hack so that qualify_objects can be tested on SQLite, SQLite does not
+# actually have schemas.
+{
+ sub _table_as_sql {
+ my $self = shift;
+ local $self->{db_schema};
+ return $self->next::method(@_);
+ }
+
+ sub _table_pk_info {
+ my $self = shift;
+ local $self->{db_schema};
+ return $self->next::method(@_);
+ }
+}
+
sub _columns_info_for {
my $self = shift;
my ($table) = @_;
do_dump_test(
classname => 'DBICTest::DumpMore::1',
+ options => { db_schema => 'foo_schema', qualify_objects => 1, use_namespaces => 1 },
+ warnings => [
+ qr/Dumping manual schema for DBICTest::DumpMore::1 to directory /,
+ qr/Schema dump completed/,
+ ],
+ regexes => {
+ 'Result/Foo' => [
+ qr/^\Q__PACKAGE__->table("foo_schema.foo");\E/m,
+ ],
+ },
+);
+
+rmtree($DUMP_PATH, 1, 1);
+
+do_dump_test(
+ classname => 'DBICTest::DumpMore::1',
options => { use_namespaces => 1 },
warnings => [
qr/Dumping manual schema for DBICTest::DumpMore::1 to directory /,
done_testing;
END { rmtree($DUMP_PATH, 1, 1) unless $ENV{SCHEMA_LOADER_TESTS_NOCLEANUP} }
+# vim:et sts=4 sw=4 tw=0: