Add automatic naming of unique constraints
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / ResultSourceProxy.pm
CommitLineData
75d07914 1package # hide from PAUSE
c0e7b4e5 2 DBIx::Class::ResultSourceProxy;
b98e75f6 3
4use strict;
5use warnings;
6
7use base qw/DBIx::Class/;
8
5ac6a044 9sub iterator_class { shift->result_source_instance->resultset_class(@_) }
b98e75f6 10sub resultset_class { shift->result_source_instance->resultset_class(@_) }
bab77431 11sub source_name { shift->result_source_instance->source_name(@_) }
b98e75f6 12
5ac6a044 13sub resultset_attributes {
14 shift->result_source_instance->resultset_attributes(@_);
15}
16
b98e75f6 17sub add_columns {
18 my ($class, @cols) = @_;
1f23a877 19 my $source = $class->result_source_instance;
20 $source->add_columns(@cols);
21 foreach my $c (grep { !ref } @cols) {
22 $class->register_column($c => $source->column_info($c));
23 }
b98e75f6 24}
25
002a359a 26*add_column = \&add_columns;
27
75d07914 28sub has_column {
29 my ($self, $column) = @_;
30 return $self->result_source_instance->has_column($column);
b98e75f6 31}
32
75d07914 33sub column_info {
34 my ($self, $column) = @_;
35 return $self->result_source_instance->column_info($column);
b98e75f6 36}
37
002a359a 38
75d07914 39sub columns {
40 return shift->result_source_instance->columns(@_);
41}
002a359a 42
43sub remove_columns {
44 return shift->result_source_instance->remove_columns(@_);
45}
46
47*remove_column = \&remove_columns;
48
bc0c9800 49sub set_primary_key {
50 shift->result_source_instance->set_primary_key(@_);
51}
52
53sub primary_columns {
54 shift->result_source_instance->primary_columns(@_);
55}
b98e75f6 56
bc0c9800 57sub add_unique_constraint {
58 shift->result_source_instance->add_unique_constraint(@_);
59}
60
61sub unique_constraints {
62 shift->result_source_instance->unique_constraints(@_);
63}
87f0da6a 64
1bc0b925 65sub unique_constraint_names {
66 shift->result_source_instance->unique_constraint_names(@_);
67}
68
69sub unique_constraint_columns {
70 shift->result_source_instance->unique_constraint_columns(@_);
71}
72
8c49f629 73sub add_relationship {
71e65b39 74 my ($class, $rel, @rest) = @_;
75 my $source = $class->result_source_instance;
76 $source->add_relationship($rel => @rest);
77 $class->register_relationship($rel => $source->relationship_info($rel));
8c49f629 78}
79
80sub relationships {
81 shift->result_source_instance->relationships(@_);
82}
83
84sub relationship_info {
85 shift->result_source_instance->relationship_info(@_);
86}
87
b98e75f6 881;