1Catalyst::Helper::ModelU:s:eDrBICCo:n:tSrcihbeumtae(d3C)PaetrallyDsotc:u:mHeenltpaetri:o:nModel::DBIC::Schema(3)
2
3
4

NAME

6       Catalyst::Helper::Model::DBIC::Schema - Helper for DBIC Schema Models
7

SYNOPSIS

9         script/create.pl model CatalystModelName DBIC::Schema MyApp::SchemaClass \
10           [ create=dynamic | create=static ] [ traits=trait1,trait2... ] \
11           [ Schema::Loader opts ] [ dsn user pass ] \
12           [ other connect_info args ]
13

DESCRIPTION

15       Helper for the DBIC Schema Models.
16
17   Arguments:
18       "CatalystModelName" is the short name for the Catalyst Model class
19       being generated (i.e. callable with "$c->model('CatalystModelName')").
20
21       "MyApp::SchemaClass" is the fully qualified classname of your Schema,
22       which might or might not yet exist.  Note that you should have a good
23       reason to create this under a new global namespace, otherwise use an
24       existing top level namespace for your schema class.
25
26       "create=dynamic" instructs this Helper to generate the named Schema
27       class for you, basing it on DBIx::Class::Schema::Loader (which means
28       the table information will always be dynamically loaded at runtime from
29       the database).
30
31       "create=static" instructs this Helper to generate the named Schema
32       class for you, using DBIx::Class::Schema::Loader in "one shot" mode to
33       create a standard, manually-defined DBIx::Class::Schema setup, based on
34       what the Loader sees in your database at this moment.  A Schema/Model
35       pair generated this way will not require DBIx::Class::Schema::Loader at
36       runtime, and will not automatically adapt itself to changes in your
37       database structure.  You can edit the generated classes by hand to
38       refine them.
39
40       "traits" is the list of traits to apply to the model, see
41       Catalyst::Model::DBIC::Schema for details.
42
43       "Schema::Loader opts" are documented in
44       DBIx::Class::Schema::Loader::Base and some examples are given in
45       "TYPICAL EXAMPLES" below.
46
47       "connect_info" arguments are the same as what "connect" in
48       DBIx::Class::Schema expects, and are storage_type-specific. They are
49       documented in "connect_info" in DBIx::Class::Storage::DBI. For DBI-
50       based storage, these arguments are the dsn, username, password, and
51       connect options, respectively.  These are optional for existing
52       Schemas, but required if you use either of the "create=" options.
53
54       username and password can be omitted for "SQLite" dsns.
55
56       Use of either of the "create=" options requires
57       DBIx::Class::Schema::Loader.
58

TYPICAL EXAMPLES

60       Use DBIx::Class::Schema::Loader to create a static DBIx::Class::Schema,
61       and a Model which references it:
62
63         script/myapp_create.pl model CatalystModelName DBIC::Schema \
64           MyApp::SchemaClass create=static dbi:mysql:foodb myuname mypass
65
66       Same, with extra connect_info args user and pass can be omitted for
67       sqlite, since they are always empty
68
69         script/myapp_create.pl model CatalystModelName DBIC::Schema \
70           MyApp::SchemaClass create=static dbi:SQLite:foo.db \
71           AutoCommit=1 cursor_class=DBIx::Class::Cursor::Cached \
72           on_connect_do='["select 1", "select 2"]' quote_names=1
73
74       ON WINDOWS COMMAND LINES QUOTING RULES ARE DIFFERENT
75
76       In "cmd.exe" the above example would be:
77
78         script/myapp_create.pl model CatalystModelName DBIC::Schema \
79           MyApp::SchemaClass create=static dbi:SQLite:foo.db \
80           AutoCommit=1 cursor_class=DBIx::Class::Cursor::Cached \
81           on_connect_do="[\"select 1\", \"select 2\"]" quote_names=1
82
83       Same, but with extra Schema::Loader args (separate multiple values by
84       commas):
85
86         script/myapp_create.pl model CatalystModelName DBIC::Schema \
87           MyApp::SchemaClass create=static db_schema=foodb components=Foo,Bar \
88           exclude='^(wibble|wobble)$' moniker_map='{ foo => "FOO" }' \
89           dbi:Pg:dbname=foodb myuname mypass
90
91       Coderefs are also supported:
92
93         script/myapp_create.pl model CatalystModelName DBIC::Schema \
94           MyApp::SchemaClass create=static \
95           inflect_singular='sub { $_[0] =~ /\A(.+?)(_id)?\z/; $1 }' \
96           moniker_map='sub { join(q{}, map ucfirst, split(/[\W_]+/, lc $_[0])); }' \
97           dbi:mysql:foodb myuname mypass
98
99       See DBIx::Class::Schema::Loader::Base for a list of options
100
101       Create a dynamic DBIx::Class::Schema::Loader-based Schema, and a Model
102       which references it (DEPRECATED):
103
104         script/myapp_create.pl model CatalystModelName DBIC::Schema \
105           MyApp::SchemaClass create=dynamic dbi:mysql:foodb myuname mypass
106
107       Reference an existing Schema of any kind, and provide some connection
108       information for ->config:
109
110         script/myapp_create.pl model CatalystModelName DBIC::Schema \
111           MyApp::SchemaClass dbi:mysql:foodb myuname mypass
112
113       Same, but don't supply connect information yet (you'll need to do this
114       in your app config, or [not recommended] in the schema itself).
115
116         script/myapp_create.pl model ModelName DBIC::Schema My::SchemaClass
117

METHODS

119   mk_compclass
120       This is called by Catalyst::Helper with the commandline args to
121       generate the files.
122
123   run
124       Can be called on an instance to generate the files.
125

SEE ALSO

127       General Catalyst Stuff:
128
129       Catalyst::Manual, Catalyst::Test, Catalyst::Request,
130       Catalyst::Response, Catalyst::Helper, Catalyst,
131
132       Stuff related to DBIC and this Model style:
133
134       DBIx::Class, DBIx::Class::Schema, DBIx::Class::Schema::Loader,
135       Catalyst::Model::DBIC::Schema
136

AUTHOR

138       See "AUTHOR" in Catalyst::Model::DBIC::Schema and "CONTRIBUTORS" in
139       Catalyst::Model::DBIC::Schema.
140
142       See "COPYRIGHT" in Catalyst::Model::DBIC::Schema.
143

LICENSE

145       This library is free software, you can redistribute it and/or modify it
146       under the same terms as Perl itself.
147
148
149
150perl v5.28.1                      2014-C0a9t-a0l4yst::Helper::Model::DBIC::Schema(3)
Impressum