__PACKAGE__->mk_group_accessors('simple' => qw/_ordered_columns
_columns _primaries _unique_constraints name resultset_attributes
- schema from _relationships column_info_from_storage source_name/);
+ schema from _relationships column_info_from_storage source_name
+ source_info/);
__PACKAGE__->mk_group_accessors('component_class' => qw/resultset_class
result_class/);
=pod
+=head2 source_info
+
+Stores a hashref of per-source metadata. No specific key names
+have yet been standardized, the examples below are purely hypothetical
+and don't actually accomplish anything on their own:
+
+ __PACKAGE__->source_info({
+ "_tablespace" => 'fast_disk_array_3',
+ "_engine" => 'InnoDB',
+ });
+
=head2 add_columns
$table->add_columns(qw/col1 col2 col3/);
sub resultset_class { shift->result_source_instance->resultset_class(@_) }
sub result_class { shift->result_source_instance->result_class(@_) }
sub source_name { shift->result_source_instance->source_name(@_) }
+sub source_info { shift->result_source_instance->source_info(@_) }
sub resultset_attributes {
shift->result_source_instance->resultset_attributes(@_);
my $schema = DBICTest->init_schema();
-plan tests => 63;
+plan tests => 64;
# figure out if we've got a version of sqlite that is older than 3.2.6, in
# which case COUNT(DISTINCT()) doesn't work
ok($schema->source("Artist")->{_columns_info_loaded} == 1, 'Columns info flag set');
}
+# test source_info
+{
+ my $expected = {
+ "source_info_key_A" => "source_info_value_A",
+ "source_info_key_B" => "source_info_value_B",
+ "source_info_key_C" => "source_info_value_C",
+ };
+
+ my $sinfo = $schema->source("Artist")->source_info;
+
+ is_deeply($sinfo, $expected, 'source_info data works');
+}
+
# test remove_columns
{
is_deeply([$schema->source('CD')->columns], [qw/cdid artist title year/]);
use base 'DBIx::Class::Core';
__PACKAGE__->table('artist');
+__PACKAGE__->source_info({
+ "source_info_key_A" => "source_info_value_A",
+ "source_info_key_B" => "source_info_value_B",
+ "source_info_key_C" => "source_info_value_C",
+});
__PACKAGE__->add_columns(
'artistid' => {
data_type => 'integer',