1SQL::Translator::ParserU:s:eDrBICxo:n:tCrliabsust(e3d)PSeQrLl::DTorcaunmselnattaotri:o:nParser::DBIx::Class(3)
2
3
4
6 SQL::Translator::Parser::DBIx::Class - Create a SQL::Translator schema
7 from a DBIx::Class::Schema instance
8
10 ## Via DBIx::Class
11 use MyApp::Schema;
12 my $schema = MyApp::Schema->connect("dbi:SQLite:something.db");
13 $schema->create_ddl_dir();
14 ## or
15 $schema->deploy();
16
17 ## Standalone
18 use MyApp::Schema;
19 use SQL::Translator;
20
21 my $schema = MyApp::Schema->connect;
22 my $trans = SQL::Translator->new (
23 parser => 'SQL::Translator::Parser::DBIx::Class',
24 parser_args => {
25 dbic_schema => $schema,
26 add_fk_index => 0,
27 sources => [qw/
28 Artist
29 CD
30 /],
31 },
32 producer => 'SQLite',
33 ) or die SQL::Translator->error;
34 my $out = $trans->translate() or die $trans->error;
35
37 This class requires SQL::Translator installed to work.
38
39 "SQL::Translator::Parser::DBIx::Class" reads a DBIx::Class schema,
40 interrogates the columns, and stuffs it all in an $sqlt_schema object.
41
42 Its primary use is in deploying database layouts described as a set of
43 DBIx::Class classes, to a database. To do this, see "deploy" in
44 DBIx::Class::Schema.
45
46 This can also be achieved by having DBIx::Class export the schema as a
47 set of SQL files ready for import into your database, or passed to
48 other machines that need to have your application installed but don't
49 have SQL::Translator installed. To do this see "create_ddl_dir" in
50 DBIx::Class::Schema.
51
53 dbic_schema
54 The DBIx::Class schema (either an instance or a class name) to be
55 parsed. This argument is in fact optional - instead one can supply it
56 later at translation time as an argument to "translate" in
57 SQL::Translator. In other words both of the following invocations are
58 valid and will produce conceptually identical output:
59
60 my $yaml = SQL::Translator->new(
61 parser => 'SQL::Translator::Parser::DBIx::Class',
62 parser_args => {
63 dbic_schema => $schema,
64 },
65 producer => 'SQL::Translator::Producer::YAML',
66 )->translate;
67
68 my $yaml = SQL::Translator->new(
69 parser => 'SQL::Translator::Parser::DBIx::Class',
70 producer => 'SQL::Translator::Producer::YAML',
71 )->translate(data => $schema);
72
73 add_fk_index
74 Create an index for each foreign key. Enabled by default, as having
75 indexed foreign key columns is normally the sensible thing to do.
76
77 sources
78 Arguments: \@class_names
79
80 Limit the amount of parsed sources by supplying an explicit list of
81 source names.
82
84 SQL::Translator, DBIx::Class::Schema
85
87 Check the list of additional DBIC resources.
88
90 This module is free software copyright by the DBIx::Class (DBIC)
91 authors. You can redistribute it and/or modify it under the same terms
92 as the DBIx::Class library.
93
94
95
96perl v5.30.1 2020-0S1Q-L2:9:Translator::Parser::DBIx::Class(3)