Commit | Line | Data |
392cebac |
1 | package SQL::Translator::Parser::DBIx::Class; |
b02b20b5 |
2 | |
3 | # AUTHOR: Jess Robinson |
4 | |
1d996af5 |
5 | # Some mistakes the fault of Matt S Trout |
6 | |
c385ecea |
7 | # Others the fault of Ash Berlin |
8 | |
b02b20b5 |
9 | use strict; |
10 | use warnings; |
f9cc85ce |
11 | our ($DEBUG, $VERSION, @EXPORT_OK); |
4a9f6cdc |
12 | $VERSION = '1.10'; |
b02b20b5 |
13 | $DEBUG = 0 unless defined $DEBUG; |
ebed3aaf |
14 | |
b02b20b5 |
15 | use Exporter; |
b02b20b5 |
16 | use SQL::Translator::Utils qw(debug normalize_name); |
70c28808 |
17 | use DBIx::Class::Carp qw/^SQL::Translator|^DBIx::Class|^Try::Tiny/; |
18 | use DBIx::Class::Exception; |
7536c92b |
19 | use Scalar::Util 'blessed'; |
9780718f |
20 | use Try::Tiny; |
fd323bf1 |
21 | use namespace::clean; |
b02b20b5 |
22 | |
23 | use base qw(Exporter); |
24 | |
25 | @EXPORT_OK = qw(parse); |
26 | |
27 | # ------------------------------------------------------------------- |
28 | # parse($tr, $data) |
29 | # |
0e2c6809 |
30 | # setting parser_args => { add_fk_index => 0 } will prevent |
31 | # the auto-generation of an index for each FK. |
32 | # |
880a1a0c |
33 | # Note that $data, in the case of this parser, is not useful. |
b02b20b5 |
34 | # We're working with DBIx::Class Schemas, not data streams. |
35 | # ------------------------------------------------------------------- |
36 | sub parse { |
499adf63 |
37 | my ($tr, $data) = @_; |
38 | my $args = $tr->parser_args; |
a07ae2aa |
39 | |
40 | my $dbicschema = $data || $args->{dbic_schema}; |
41 | |
42 | for (qw(DBIx::Class::Schema DBIx::Schema package)) { |
43 | if (defined (my $s = delete $args->{$_} )) { |
44 | carp_unique("Supplying a schema via ... parser_args => { '$_' => \$schema } is deprecated. Please use parser_args => { dbic_schema => \$schema } instead"); |
45 | |
46 | # move it from the deprecated to the proper $args slot |
47 | unless ($dbicschema) { |
48 | $args->{dbic_schema} = $dbicschema = $s; |
49 | } |
50 | } |
51 | } |
48850f9a |
52 | |
70c28808 |
53 | DBIx::Class::Exception->throw('No DBIx::Class::Schema') unless ($dbicschema); |
a07ae2aa |
54 | |
b7e303a8 |
55 | if (!ref $dbicschema) { |
5b9ecfcc |
56 | eval "require $dbicschema" |
70c28808 |
57 | or DBIx::Class::Exception->throw("Can't load $dbicschema: $@"); |
b02b20b5 |
58 | } |
59 | |
60 | my $schema = $tr->schema; |
61 | my $table_no = 0; |
62 | |
b1f9d92e |
63 | $schema->name( ref($dbicschema) . " v" . ($dbicschema->schema_version || '1.x')) |
b7e303a8 |
64 | unless ($schema->name); |
38e48163 |
65 | |
b7e303a8 |
66 | my @monikers = sort $dbicschema->sources; |
a07ae2aa |
67 | if (my $limit_sources = $args->{'sources'}) { |
499adf63 |
68 | my $ref = ref $limit_sources || ''; |
eb0bc670 |
69 | $dbicschema->throw_exception ("'sources' parameter must be an array or hash ref") |
70 | unless( $ref eq 'ARRAY' || ref eq 'HASH' ); |
499adf63 |
71 | |
fd323bf1 |
72 | # limit monikers to those specified in |
499adf63 |
73 | my $sources; |
74 | if ($ref eq 'ARRAY') { |
75 | $sources->{$_} = 1 for (@$limit_sources); |
76 | } else { |
77 | $sources = $limit_sources; |
78 | } |
79 | @monikers = grep { $sources->{$_} } @monikers; |
80 | } |
81 | |
82 | |
a7f4b74c |
83 | my(%table_monikers, %view_monikers); |
1d521afd |
84 | for my $moniker (@monikers){ |
85 | my $source = $dbicschema->source($moniker); |
5f5e87cf |
86 | if ( $source->isa('DBIx::Class::ResultSource::Table') ) { |
a7f4b74c |
87 | $table_monikers{$moniker}++; |
5f5e87cf |
88 | } elsif( $source->isa('DBIx::Class::ResultSource::View') ){ |
bccd177f |
89 | next if $source->is_virtual; |
a7f4b74c |
90 | $view_monikers{$moniker}++; |
1d521afd |
91 | } |
92 | } |
499adf63 |
93 | |
48850f9a |
94 | my %tables; |
a7f4b74c |
95 | foreach my $moniker (sort keys %table_monikers) |
b02b20b5 |
96 | { |
b7e303a8 |
97 | my $source = $dbicschema->source($moniker); |
48850f9a |
98 | my $table_name = $source->name; |
39be4120 |
99 | |
4678e9da |
100 | # FIXME - this isn't the right way to do it, but sqlt does not |
101 | # support quoting properly to be signaled about this |
a8fcfb9f |
102 | $table_name = $$table_name if ref $table_name eq 'SCALAR'; |
b02b20b5 |
103 | |
e3d5a547 |
104 | # It's possible to have multiple DBIC sources using the same table |
48850f9a |
105 | next if $tables{$table_name}; |
38e48163 |
106 | |
48850f9a |
107 | $tables{$table_name}{source} = $source; |
108 | my $table = $tables{$table_name}{object} = SQL::Translator::Schema::Table->new( |
109 | name => $table_name, |
b02b20b5 |
110 | type => 'TABLE', |
48850f9a |
111 | ); |
b02b20b5 |
112 | foreach my $col ($source->columns) |
113 | { |
d6c79cb3 |
114 | # assuming column_info in dbic is the same as DBI (?) |
b02b20b5 |
115 | # data_type is a number, column_type is text? |
116 | my %colinfo = ( |
117 | name => $col, |
b02b20b5 |
118 | size => 0, |
119 | is_auto_increment => 0, |
120 | is_foreign_key => 0, |
121 | is_nullable => 0, |
122 | %{$source->column_info($col)} |
123 | ); |
0009fa49 |
124 | if ($colinfo{is_nullable}) { |
125 | $colinfo{default} = '' unless exists $colinfo{default}; |
126 | } |
eb0bc670 |
127 | my $f = $table->add_field(%colinfo) |
128 | || $dbicschema->throw_exception ($table->error); |
b02b20b5 |
129 | } |
b02b20b5 |
130 | |
7b90bb13 |
131 | my @primary = $source->primary_columns; |
36e9e24f |
132 | |
133 | $table->primary_key(@primary) if @primary; |
134 | |
7b90bb13 |
135 | my %unique_constraints = $source->unique_constraints; |
b7e303a8 |
136 | foreach my $uniq (sort keys %unique_constraints) { |
6d0ee587 |
137 | if (!$source->_compare_relationship_keys($unique_constraints{$uniq}, \@primary)) { |
7b90bb13 |
138 | $table->add_constraint( |
139 | type => 'unique', |
a7e65bb5 |
140 | name => $uniq, |
7b90bb13 |
141 | fields => $unique_constraints{$uniq} |
142 | ); |
143 | } |
144 | } |
145 | |
b02b20b5 |
146 | my @rels = $source->relationships(); |
499adf63 |
147 | |
148 | my %created_FK_rels; |
48850f9a |
149 | |
2581038c |
150 | # global add_fk_index set in parser_args |
a7f4b74c |
151 | my $add_fk_index = (exists $args->{add_fk_index} && ! $args->{add_fk_index}) ? 0 : 1; |
499adf63 |
152 | |
454a5a42 |
153 | foreach my $rel (sort @rels) |
b02b20b5 |
154 | { |
a7f4b74c |
155 | |
b02b20b5 |
156 | my $rel_info = $source->relationship_info($rel); |
637ca936 |
157 | |
637ca936 |
158 | # Ignore any rel cond that isn't a straight hash |
159 | next unless ref $rel_info->{cond} eq 'HASH'; |
160 | |
5b9ecfcc |
161 | my $relsource = try { $source->related_source($rel) }; |
162 | unless ($relsource) { |
2ad0cbfb |
163 | carp "Ignoring relationship '$rel' - related resultsource '$rel_info->{class}' is not registered with this schema\n"; |
5b9ecfcc |
164 | next; |
165 | }; |
a7f4b74c |
166 | |
167 | # related sources might be excluded via a {sources} filter or might be views |
168 | next unless exists $table_monikers{$relsource->source_name}; |
169 | |
170 | my $rel_table = $relsource->name; |
4678e9da |
171 | |
172 | # FIXME - this isn't the right way to do it, but sqlt does not |
173 | # support quoting properly to be signaled about this |
174 | $rel_table = $$rel_table if ref $rel_table eq 'SCALAR'; |
de60a93d |
175 | |
e377d723 |
176 | my $reverse_rels = $source->reverse_relationship_info($rel); |
177 | my ($otherrelname, $otherrelationship) = each %{$reverse_rels}; |
178 | |
d1b264d3 |
179 | # Force the order of @cond to match the order of ->add_columns |
180 | my $idx; |
a7f4b74c |
181 | my %other_columns_idx = map {'foreign.'.$_ => ++$idx } $relsource->columns; |
fd323bf1 |
182 | my @cond = sort { $other_columns_idx{$a} cmp $other_columns_idx{$b} } keys(%{$rel_info->{cond}}); |
48850f9a |
183 | |
637ca936 |
184 | # Get the key information, mapping off the foreign/self markers |
637ca936 |
185 | my @refkeys = map {/^\w+\.(\w+)$/} @cond; |
186 | my @keys = map {$rel_info->{cond}->{$_} =~ /^\w+\.(\w+)$/} @cond; |
187 | |
e377d723 |
188 | # determine if this relationship is a self.fk => foreign.pk (i.e. belongs_to) |
189 | my $fk_constraint; |
de60a93d |
190 | |
e377d723 |
191 | #first it can be specified explicitly |
192 | if ( exists $rel_info->{attrs}{is_foreign_key_constraint} ) { |
193 | $fk_constraint = $rel_info->{attrs}{is_foreign_key_constraint}; |
194 | } |
195 | # it can not be multi |
069e49b6 |
196 | elsif ( $rel_info->{attrs}{accessor} |
197 | && $rel_info->{attrs}{accessor} eq 'multi' ) { |
e377d723 |
198 | $fk_constraint = 0; |
199 | } |
200 | # if indeed single, check if all self.columns are our primary keys. |
201 | # this is supposed to indicate a has_one/might_have... |
202 | # where's the introspection!!?? :) |
203 | else { |
6d0ee587 |
204 | $fk_constraint = not $source->_compare_relationship_keys(\@keys, \@primary); |
e377d723 |
205 | } |
de60a93d |
206 | |
e377d723 |
207 | my $cascade; |
208 | for my $c (qw/delete update/) { |
209 | if (exists $rel_info->{attrs}{"on_$c"}) { |
210 | if ($fk_constraint) { |
211 | $cascade->{$c} = $rel_info->{attrs}{"on_$c"}; |
212 | } |
db79c254 |
213 | elsif ( $rel_info->{attrs}{"on_$c"} ) { |
48850f9a |
214 | carp "SQLT attribute 'on_$c' was supplied for relationship '$moniker/$rel', which does not appear to be a foreign constraint. " |
e377d723 |
215 | . "If you are sure that SQLT must generate a constraint for this relationship, add 'is_foreign_key_constraint => 1' to the attributes.\n"; |
216 | } |
217 | } |
218 | elsif (defined $otherrelationship and $otherrelationship->{attrs}{$c eq 'update' ? 'cascade_copy' : 'cascade_delete'}) { |
219 | $cascade->{$c} = 'CASCADE'; |
de60a93d |
220 | } |
e377d723 |
221 | } |
222 | |
cae467a7 |
223 | if($rel_table) { |
e377d723 |
224 | # Constraints are added only if applicable |
225 | next unless $fk_constraint; |
226 | |
227 | # Make sure we dont create the same foreign key constraint twice |
e3d5a547 |
228 | my $key_test = join("\x00", sort @keys); |
e377d723 |
229 | next if $created_FK_rels{$rel_table}->{$key_test}; |
de60a93d |
230 | |
48850f9a |
231 | if (scalar(@keys)) { |
48850f9a |
232 | $created_FK_rels{$rel_table}->{$key_test} = 1; |
13de943d |
233 | |
48850f9a |
234 | my $is_deferrable = $rel_info->{attrs}{is_deferrable}; |
235 | |
a7f4b74c |
236 | # calculate dependencies: do not consider deferrable constraints and |
237 | # self-references for dependency calculations |
48850f9a |
238 | if (! $is_deferrable and $rel_table ne $table_name) { |
239 | $tables{$table_name}{foreign_table_deps}{$rel_table}++; |
240 | } |
7b5d0b84 |
241 | |
7b5d0b84 |
242 | $table->add_constraint( |
cae467a7 |
243 | type => 'foreign_key', |
244 | name => join('_', $table_name, 'fk', @keys), |
245 | fields => \@keys, |
246 | reference_fields => \@refkeys, |
247 | reference_table => $rel_table, |
248 | on_delete => uc ($cascade->{delete} || ''), |
249 | on_update => uc ($cascade->{update} || ''), |
250 | (defined $is_deferrable ? ( deferrable => $is_deferrable ) : ()), |
7b5d0b84 |
251 | ); |
48850f9a |
252 | |
253 | # global parser_args add_fk_index param can be overridden on the rel def |
254 | my $add_fk_index_rel = (exists $rel_info->{attrs}{add_fk_index}) ? $rel_info->{attrs}{add_fk_index} : $add_fk_index; |
255 | |
c49ff507 |
256 | # Check that we do not create an index identical to the PK index |
257 | # (some RDBMS croak on this, and it generally doesn't make much sense) |
258 | # NOTE: we do not sort the key columns because the order of |
5930bfc2 |
259 | # columns is important for indexes and two indexes with the |
260 | # same cols but different order are allowed and sometimes |
261 | # needed |
c49ff507 |
262 | next if join("\x00", @keys) eq join("\x00", @primary); |
48850f9a |
263 | |
2581038c |
264 | if ($add_fk_index_rel) { |
0e2c6809 |
265 | my $index = $table->add_index( |
5930bfc2 |
266 | name => join('_', $table_name, 'idx', @keys), |
267 | fields => \@keys, |
268 | type => 'NORMAL', |
269 | ); |
0e2c6809 |
270 | } |
271 | } |
b02b20b5 |
272 | } |
273 | } |
48850f9a |
274 | |
b02b20b5 |
275 | } |
d6c79cb3 |
276 | |
48850f9a |
277 | # attach the tables to the schema in dependency order |
278 | my $dependencies = { |
279 | map { $_ => _resolve_deps ($_, \%tables) } (keys %tables) |
280 | }; |
9485509b |
281 | |
48850f9a |
282 | for my $table (sort |
283 | { |
284 | keys %{$dependencies->{$a} || {} } <=> keys %{ $dependencies->{$b} || {} } |
285 | || |
286 | $a cmp $b |
287 | } |
288 | (keys %tables) |
289 | ) { |
290 | $schema->add_table ($tables{$table}{object}); |
291 | $tables{$table}{source} -> _invoke_sqlt_deploy_hook( $tables{$table}{object} ); |
48850f9a |
292 | |
7adc2091 |
293 | # the hook might have already removed the table |
294 | if ($schema->get_table($table) && $table =~ /^ \s* \( \s* SELECT \s+/ix) { |
5b9ecfcc |
295 | carp <<'EOW'; |
a8fcfb9f |
296 | |
7adc2091 |
297 | Custom SQL through ->name(\'( SELECT ...') is DEPRECATED, for more details see |
298 | "Arbitrary SQL through a custom ResultSource" in DBIx::Class::Manual::Cookbook |
299 | or http://search.cpan.org/dist/DBIx-Class/lib/DBIx/Class/Manual/Cookbook.pod |
39be4120 |
300 | |
7adc2091 |
301 | EOW |
39be4120 |
302 | |
7adc2091 |
303 | # remove the table as there is no way someone might want to |
304 | # actually deploy this |
305 | $schema->drop_table ($table); |
39be4120 |
306 | } |
307 | } |
48850f9a |
308 | |
309 | my %views; |
51b31bbe |
310 | my @views = map { $dbicschema->source($_) } keys %view_monikers; |
9485509b |
311 | |
c418c5cc |
312 | my $view_dependencies = { |
313 | map { |
a8cbaf38 |
314 | $_ => _resolve_deps( $dbicschema->source($_), \%view_monikers ) |
c418c5cc |
315 | } ( keys %view_monikers ) |
316 | }; |
51b31bbe |
317 | |
318 | my @view_sources = |
319 | sort { |
c418c5cc |
320 | keys %{ $view_dependencies->{ $a->source_name } || {} } <=> |
321 | keys %{ $view_dependencies->{ $b->source_name } || {} } |
51b31bbe |
322 | || $a->source_name cmp $b->source_name |
323 | } |
324 | map { $dbicschema->source($_) } |
325 | keys %view_monikers; |
1999a918 |
326 | |
943538a0 |
327 | foreach my $source (@view_sources) |
1d521afd |
328 | { |
48850f9a |
329 | my $view_name = $source->name; |
4678e9da |
330 | |
331 | # FIXME - this isn't the right way to do it, but sqlt does not |
332 | # support quoting properly to be signaled about this |
333 | $view_name = $$view_name if ref $view_name eq 'SCALAR'; |
48850f9a |
334 | |
1d521afd |
335 | # Skip custom query sources |
48850f9a |
336 | next if ref $view_name; |
1d521afd |
337 | |
338 | # Its possible to have multiple DBIC source using same table |
48850f9a |
339 | next if $views{$view_name}++; |
1d521afd |
340 | |
ab7e74aa |
341 | $dbicschema->throw_exception ("view $view_name is missing a view_definition") |
342 | unless $source->view_definition; |
8f1617e2 |
343 | |
48850f9a |
344 | my $view = $schema->add_view ( |
345 | name => $view_name, |
1d521afd |
346 | fields => [ $source->columns ], |
f534e33b |
347 | $source->view_definition ? ( 'sql' => $source->view_definition ) : () |
eb0bc670 |
348 | ) || $dbicschema->throw_exception ($schema->error); |
a99b214b |
349 | |
350 | $source->_invoke_sqlt_deploy_hook($view); |
1d521afd |
351 | } |
352 | |
48850f9a |
353 | |
b7e303a8 |
354 | if ($dbicschema->can('sqlt_deploy_hook')) { |
355 | $dbicschema->sqlt_deploy_hook($schema); |
d6c79cb3 |
356 | } |
357 | |
637ca936 |
358 | return 1; |
75d07914 |
359 | } |
b02b20b5 |
360 | |
48850f9a |
361 | # |
362 | # Quick and dirty dependency graph calculator |
363 | # |
364 | sub _resolve_deps { |
a8cbaf38 |
365 | my ( $question, $answers, $seen ) = @_; |
c418c5cc |
366 | my $ret = {}; |
51b31bbe |
367 | $seen ||= {}; |
a8cbaf38 |
368 | my @deps; |
51b31bbe |
369 | |
370 | # copy and bump all deps by one (so we can reconstruct the chain) |
371 | my %seen = map { $_ => $seen->{$_} + 1 } ( keys %$seen ); |
6c97a902 |
372 | if ( blessed($question) |
373 | && $question->isa('DBIx::Class::ResultSource::View') ) |
374 | { |
a8cbaf38 |
375 | $seen{ $question->result_class } = 1; |
376 | @deps = keys %{ $question->{deploy_depends_on} }; |
377 | } |
378 | else { |
379 | $seen{$question} = 1; |
380 | @deps = keys %{ $answers->{$question}{foreign_table_deps} }; |
381 | } |
382 | |
383 | for my $dep (@deps) { |
51b31bbe |
384 | if ( $seen->{$dep} ) { |
385 | return {}; |
386 | } |
a8cbaf38 |
387 | my $next_dep; |
51b31bbe |
388 | |
6c97a902 |
389 | if ( blessed($question) |
390 | && $question->isa('DBIx::Class::ResultSource::View') ) |
391 | { |
392 | no warnings 'uninitialized'; |
a8cbaf38 |
393 | my ($next_dep_source_name) = |
6c97a902 |
394 | grep { |
395 | $question->schema->source($_)->result_class eq $dep |
396 | && !( $question->schema->source($_) |
397 | ->isa('DBIx::Class::ResultSource::Table') ) |
398 | } @{ [ $question->schema->sources ] }; |
399 | return {} unless $next_dep_source_name; |
a8cbaf38 |
400 | $next_dep = $question->schema->source($next_dep_source_name); |
401 | } |
402 | else { |
403 | $next_dep = $dep; |
404 | } |
405 | my $subdeps = _resolve_deps( $next_dep, $answers, \%seen ); |
406 | $ret->{$_} += $subdeps->{$_} for ( keys %$subdeps ); |
51b31bbe |
407 | ++$ret->{$dep}; |
408 | } |
409 | return $ret; |
410 | } |
411 | |
0da8b7da |
412 | 1; |
7232ce07 |
413 | |
414 | =head1 NAME |
415 | |
416 | SQL::Translator::Parser::DBIx::Class - Create a SQL::Translator schema |
417 | from a DBIx::Class::Schema instance |
418 | |
419 | =head1 SYNOPSIS |
420 | |
f26d4b95 |
421 | ## Via DBIx::Class |
422 | use MyApp::Schema; |
423 | my $schema = MyApp::Schema->connect("dbi:SQLite:something.db"); |
424 | $schema->create_ddl_dir(); |
425 | ## or |
426 | $schema->deploy(); |
427 | |
428 | ## Standalone |
7232ce07 |
429 | use MyApp::Schema; |
430 | use SQL::Translator; |
d4daee7b |
431 | |
7232ce07 |
432 | my $schema = MyApp::Schema->connect; |
433 | my $trans = SQL::Translator->new ( |
434 | parser => 'SQL::Translator::Parser::DBIx::Class', |
37cb0de1 |
435 | parser_args => { |
a07ae2aa |
436 | dbic_schema => $schema, |
cae467a7 |
437 | add_fk_index => 0, |
37cb0de1 |
438 | sources => [qw/ |
439 | Artist |
440 | CD |
441 | /], |
442 | }, |
7232ce07 |
443 | producer => 'SQLite', |
444 | ) or die SQL::Translator->error; |
445 | my $out = $trans->translate() or die $trans->error; |
446 | |
447 | =head1 DESCRIPTION |
448 | |
f26d4b95 |
449 | This class requires L<SQL::Translator> installed to work. |
450 | |
7232ce07 |
451 | C<SQL::Translator::Parser::DBIx::Class> reads a DBIx::Class schema, |
452 | interrogates the columns, and stuffs it all in an $sqlt_schema object. |
453 | |
faaba25f |
454 | Its primary use is in deploying database layouts described as a set |
db2b2eb6 |
455 | of L<DBIx::Class> classes, to a database. To do this, see |
456 | L<DBIx::Class::Schema/deploy>. |
f26d4b95 |
457 | |
458 | This can also be achieved by having DBIx::Class export the schema as a |
459 | set of SQL files ready for import into your database, or passed to |
460 | other machines that need to have your application installed but don't |
db2b2eb6 |
461 | have SQL::Translator installed. To do this see |
462 | L<DBIx::Class::Schema/create_ddl_dir>. |
f26d4b95 |
463 | |
cae467a7 |
464 | =head1 PARSER OPTIONS |
465 | |
a07ae2aa |
466 | =head2 dbic_schema |
467 | |
468 | The DBIx::Class schema (either an instance or a class name) to be parsed. |
469 | This argument is in fact optional - instead one can supply it later at |
470 | translation time as an argument to L<SQL::Translator/translate>. In |
471 | other words both of the following invocations are valid and will produce |
472 | conceptually identical output: |
473 | |
474 | my $yaml = SQL::Translator->new( |
475 | parser => 'SQL::Translator::Parser::DBIx::Class', |
476 | parser_args => { |
477 | dbic_schema => $schema, |
478 | }, |
479 | producer => 'SQL::Translator::Producer::YAML', |
480 | )->translate; |
481 | |
482 | my $yaml = SQL::Translator->new( |
483 | parser => 'SQL::Translator::Parser::DBIx::Class', |
484 | producer => 'SQL::Translator::Producer::YAML', |
485 | )->translate(data => $schema); |
486 | |
cae467a7 |
487 | =head2 add_fk_index |
488 | |
489 | Create an index for each foreign key. |
ad91ed74 |
490 | Enabled by default, as having indexed foreign key columns is normally the |
491 | sensible thing to do. |
cae467a7 |
492 | |
493 | =head2 sources |
494 | |
495 | =over 4 |
496 | |
f0ac764e |
497 | =item Arguments: \@class_names |
cae467a7 |
498 | |
499 | =back |
ad91ed74 |
500 | |
501 | Limit the amount of parsed sources by supplying an explicit list of source names. |
cae467a7 |
502 | |
7232ce07 |
503 | =head1 SEE ALSO |
504 | |
f26d4b95 |
505 | L<SQL::Translator>, L<DBIx::Class::Schema> |
7232ce07 |
506 | |
17621379 |
507 | =head1 AUTHORS |
7232ce07 |
508 | |
17621379 |
509 | See L<DBIx::Class/CONTRIBUTORS>. |
7232ce07 |
510 | |
827a808f |
511 | =head1 LICENSE |
7232ce07 |
512 | |
827a808f |
513 | You may distribute this code under the same terms as Perl itself. |
7232ce07 |
514 | |
827a808f |
515 | =cut |