1Catalyst::Helper::ModelU:s:eDrBICCo:n:tSrcihbeumtae(d3C)PaetrallyDsotc:u:mHeenltpaetri:o:nModel::DBIC::Schema(3)
2
3
4
6 Catalyst::Helper::Model::DBIC::Schema - Helper for DBIC Schema Models
7
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
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 described in "TYPICAL EXAMPLES" below.
44
45 "connect_info" arguments are the same as what
46 DBIx::Class::Schema::connect expects, and are storage_type-specific.
47 For DBI-based storage, these arguments are the dsn, username, password,
48 and connect options, respectively. These are optional for existing
49 Schemas, but required if you use either of the "create=" options.
50
51 username and password can be omitted for "SQLite" dsns.
52
53 Use of either of the "create=" options requires
54 DBIx::Class::Schema::Loader.
55
57 Use DBIx::Class::Schema::Loader to create a static DBIx::Class::Schema,
58 and a Model which references it:
59
60 script/myapp_create.pl model CatalystModelName DBIC::Schema \
61 MyApp::SchemaClass create=static dbi:mysql:foodb myuname mypass
62
63 Same, with extra connect_info args user and pass can be omitted for
64 sqlite, since they are always empty
65
66 script/myapp_create.pl model CatalystModelName DBIC::Schema \
67 MyApp::SchemaClass create=static dbi:SQLite:foo.db \
68 AutoCommit=1 cursor_class=DBIx::Class::Cursor::Cached \
69 on_connect_do='["select 1", "select 2"]' quote_char='"'
70
71 If using a 2 character quote_char:
72
73 script/myapp_create.pl ... quote_char='[]'
74
75 ON WINDOWS COMMAND LINES QUOTING RULES ARE DIFFERENT
76
77 In "cmd.exe" the above example would be:
78
79 script/myapp_create.pl model CatalystModelName DBIC::Schema \
80 MyApp::SchemaClass create=static dbi:SQLite:foo.db \
81 AutoCommit=1 cursor_class=DBIx::Class::Cursor::Cached \
82 on_connect_do="[\"select 1\", \"select 2\"]" quote_char="\""
83
84 Same, but with extra Schema::Loader args (separate multiple values by
85 commas):
86
87 script/myapp_create.pl model CatalystModelName DBIC::Schema \
88 MyApp::SchemaClass create=static db_schema=foodb components=Foo,Bar \
89 exclude='^(wibble|wobble)$' moniker_map='{ foo => "FOO" }' \
90 dbi:Pg:dbname=foodb myuname mypass
91
92 Coderefs are also supported:
93
94 script/myapp_create.pl model CatalystModelName DBIC::Schema \
95 MyApp::SchemaClass create=static \
96 inflect_singular='sub { $_[0] =~ /\A(.+?)(_id)?\z/; $1 }' \
97 moniker_map='sub { join(q{}, map ucfirst, split(/[\W_]+/, lc $_[0])); }' \
98 dbi:mysql:foodb myuname mypass
99
100 See DBIx::Class::Schema::Loader::Base for a list of options
101
102 Create a dynamic DBIx::Class::Schema::Loader-based Schema, and a Model
103 which references it (DEPRECATED):
104
105 script/myapp_create.pl model CatalystModelName DBIC::Schema \
106 MyApp::SchemaClass create=dynamic dbi:mysql:foodb myuname mypass
107
108 Reference an existing Schema of any kind, and provide some connection
109 information for ->config:
110
111 script/myapp_create.pl model CatalystModelName DBIC::Schema \
112 MyApp::SchemaClass dbi:mysql:foodb myuname mypass
113
114 Same, but don't supply connect information yet (you'll need to do this
115 in your app config, or [not recommended] in the schema itself).
116
117 script/myapp_create.pl model ModelName DBIC::Schema My::SchemaClass
118
120 mk_compclass
121 This is called by Catalyst::Helper with the commandline args to
122 generate the files.
123
124 run
125 Can be called on an instance to generate the files.
126
128 General Catalyst Stuff:
129
130 Catalyst::Manual, Catalyst::Test, Catalyst::Request,
131 Catalyst::Response, Catalyst::Helper, Catalyst,
132
133 Stuff related to DBIC and this Model style:
134
135 DBIx::Class, DBIx::Class::Schema, DBIx::Class::Schema::Loader,
136 Catalyst::Model::DBIC::Schema
137
139 See "AUTHOR" in Catalyst::Model::DBIC::Schema and "CONTRIBUTORS" in
140 Catalyst::Model::DBIC::Schema.
141
143 See "COPYRIGHT" in Catalyst::Model::DBIC::Schema.
144
146 This library is free software, you can redistribute it and/or modify it
147 under the same terms as Perl itself.
148
149
150
151perl v5.12.0 2010-C0a2t-a0l4yst::Helper::Model::DBIC::Schema(3)