.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Catalyst::Helper::Model::DBIC::Schema 3pm" .TH Catalyst::Helper::Model::DBIC::Schema 3pm "2023-10-26" "perl v5.36.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Catalyst::Helper::Model::DBIC::Schema \- Helper for DBIC Schema Models .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 4 \& script/create.pl model CatalystModelName DBIC::Schema MyApp::SchemaClass \e \& [ create=dynamic | create=static ] [ traits=trait1,trait2... ] \e \& [ Schema::Loader opts ] [ dsn user pass ] \e \& [ other connect_info args ] .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" Helper for the \s-1DBIC\s0 Schema Models. .SS "Arguments:" .IX Subsection "Arguments:" \&\f(CW\*(C`CatalystModelName\*(C'\fR is the short name for the Catalyst Model class being generated (i.e. callable with \f(CW\*(C`$c\->model(\*(AqCatalystModelName\*(Aq)\*(C'\fR). .PP \&\f(CW\*(C`MyApp::SchemaClass\*(C'\fR is the fully qualified classname of your Schema, which might or might not yet exist. Note that you should have a good reason to create this under a new global namespace, otherwise use an existing top level namespace for your schema class. .PP \&\f(CW\*(C`create=dynamic\*(C'\fR instructs this Helper to generate the named Schema class for you, basing it on DBIx::Class::Schema::Loader (which means the table information will always be dynamically loaded at runtime from the database). .PP \&\f(CW\*(C`create=static\*(C'\fR instructs this Helper to generate the named Schema class for you, using DBIx::Class::Schema::Loader in \*(L"one shot\*(R" mode to create a standard, manually-defined DBIx::Class::Schema setup, based on what the Loader sees in your database at this moment. A Schema/Model pair generated this way will not require DBIx::Class::Schema::Loader at runtime, and will not automatically adapt itself to changes in your database structure. You can edit the generated classes by hand to refine them. .PP \&\f(CW\*(C`traits\*(C'\fR is the list of traits to apply to the model, see Catalyst::Model::DBIC::Schema for details. .PP \&\f(CW\*(C`Schema::Loader opts\*(C'\fR are documented in DBIx::Class::Schema::Loader::Base and some examples are given in \*(L"\s-1TYPICAL EXAMPLES\*(R"\s0 below. .PP \&\f(CW\*(C`connect_info\*(C'\fR arguments are the same as what \*(L"connect\*(R" in DBIx::Class::Schema expects, and are storage_type\-specific. They are documented in \&\*(L"connect_info\*(R" in DBIx::Class::Storage::DBI. For DBI-based storage, these arguments are the dsn, username, password, and connect options, respectively. These are optional for existing Schemas, but required if you use either of the \&\f(CW\*(C`create=\*(C'\fR options. .PP username and password can be omitted for \f(CW\*(C`SQLite\*(C'\fR dsns. .PP Use of either of the \f(CW\*(C`create=\*(C'\fR options requires DBIx::Class::Schema::Loader. .SH "TYPICAL EXAMPLES" .IX Header "TYPICAL EXAMPLES" Use DBIx::Class::Schema::Loader to create a static DBIx::Class::Schema, and a Model which references it: .PP .Vb 2 \& script/myapp_create.pl model CatalystModelName DBIC::Schema \e \& MyApp::SchemaClass create=static dbi:mysql:foodb myuname mypass .Ve .PP Same, with extra connect_info args user and pass can be omitted for sqlite, since they are always empty .PP .Vb 4 \& script/myapp_create.pl model CatalystModelName DBIC::Schema \e \& MyApp::SchemaClass create=static dbi:SQLite:foo.db \e \& AutoCommit=1 cursor_class=DBIx::Class::Cursor::Cached \e \& on_connect_do=\*(Aq["select 1", "select 2"]\*(Aq quote_names=1 .Ve .PP \&\fB\s-1ON WINDOWS COMMAND LINES QUOTING RULES ARE DIFFERENT\s0\fR .PP In \f(CW\*(C`cmd.exe\*(C'\fR the above example would be: .PP .Vb 4 \& script/myapp_create.pl model CatalystModelName DBIC::Schema \e \& MyApp::SchemaClass create=static dbi:SQLite:foo.db \e \& AutoCommit=1 cursor_class=DBIx::Class::Cursor::Cached \e \& on_connect_do="[\e"select 1\e", \e"select 2\e"]" quote_names=1 .Ve .PP Same, but with extra Schema::Loader args (separate multiple values by commas): .PP .Vb 4 \& script/myapp_create.pl model CatalystModelName DBIC::Schema \e \& MyApp::SchemaClass create=static db_schema=foodb components=Foo,Bar \e \& exclude=\*(Aq^(wibble|wobble)$\*(Aq moniker_map=\*(Aq{ foo => "FOO" }\*(Aq \e \& dbi:Pg:dbname=foodb myuname mypass .Ve .PP Coderefs are also supported: .PP .Vb 5 \& script/myapp_create.pl model CatalystModelName DBIC::Schema \e \& MyApp::SchemaClass create=static \e \& inflect_singular=\*(Aqsub { $_[0] =~ /\eA(.+?)(_id)?\ez/; $1 }\*(Aq \e \& moniker_map=\*(Aqsub { join(q{}, map ucfirst, split(/[\eW_]+/, lc $_[0])); }\*(Aq \e \& dbi:mysql:foodb myuname mypass .Ve .PP See DBIx::Class::Schema::Loader::Base for a list of options .PP Create a dynamic DBIx::Class::Schema::Loader\-based Schema, and a Model which references it (\fB\s-1DEPRECATED\s0\fR): .PP .Vb 2 \& script/myapp_create.pl model CatalystModelName DBIC::Schema \e \& MyApp::SchemaClass create=dynamic dbi:mysql:foodb myuname mypass .Ve .PP Reference an existing Schema of any kind, and provide some connection information for \->config: .PP .Vb 2 \& script/myapp_create.pl model CatalystModelName DBIC::Schema \e \& MyApp::SchemaClass dbi:mysql:foodb myuname mypass .Ve .PP Same, but don't supply connect information yet (you'll need to do this in your app config, or [not recommended] in the schema itself). .PP .Vb 1 \& script/myapp_create.pl model ModelName DBIC::Schema My::SchemaClass .Ve .SH "METHODS" .IX Header "METHODS" .SS "mk_compclass" .IX Subsection "mk_compclass" This is called by Catalyst::Helper with the commandline args to generate the files. .SS "run" .IX Subsection "run" Can be called on an instance to generate the files. .SH "SEE ALSO" .IX Header "SEE ALSO" General Catalyst Stuff: .PP Catalyst::Manual, Catalyst::Test, Catalyst::Request, Catalyst::Response, Catalyst::Helper, Catalyst, .PP Stuff related to \s-1DBIC\s0 and this Model style: .PP DBIx::Class, DBIx::Class::Schema, DBIx::Class::Schema::Loader, Catalyst::Model::DBIC::Schema .SH "AUTHOR" .IX Header "AUTHOR" See \*(L"\s-1AUTHOR\*(R"\s0 in Catalyst::Model::DBIC::Schema and \&\*(L"\s-1CONTRIBUTORS\*(R"\s0 in Catalyst::Model::DBIC::Schema. .SH "COPYRIGHT" .IX Header "COPYRIGHT" See \*(L"\s-1COPYRIGHT\*(R"\s0 in Catalyst::Model::DBIC::Schema. .SH "LICENSE" .IX Header "LICENSE" This library is free software, you can redistribute it and/or modify it under the same terms as Perl itself.