.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.16) .\" .\" 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" '' '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 turned on, 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. .ie \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} .el \{\ . de IX .. .\} .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "Jifty::Script::Schema 3pm" .TH Jifty::Script::Schema 3pm "2011-02-10" "perl v5.14.2" "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" Jifty::Script::Schema \- Create SQL to update or create your Jifty application's tables .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& jifty schema \-\-setup Creates or updates your application\*(Aqs database tables \& \& Options: \& \-\-print Print SQL, rather than executing commands \& \& \-\-setup Upgrade or install the database, creating it if need be \& \-\-create\-database Only creates the database \& \-\-drop\-database Drops the database \& \-\-ignore\-reserved\-words Ignore any SQL reserved words in schema definition \& \-\-no\-bootstrap don\*(Aqt run bootstrap \& \& \-\-help brief help message \& \-\-man full documentation .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" Manages your database. .SS "options" .IX Subsection "options" .IP "\fB\-\-print\fR" 8 .IX Item "--print" Rather than actually running the database create/update/drop commands, Prints the commands to standard output .IP "\fB\-\-create\-database\fR" 8 .IX Item "--create-database" Send a \s-1CREATE\s0 \s-1DATABASE\s0 command. Note that \fB\-\-setup\fR, below, will automatically send a \s-1CREATE\s0 \s-1DATABASE\s0 if it needs one. This option is useful if you wish to create the database without creating any tables in it. .IP "\fB\-\-drop\-database\fR" 8 .IX Item "--drop-database" Send a \s-1DROP\s0 \s-1DATABASE\s0 command. Use this in conjunction with \fB\-\-setup\fR to wipe and re-install the database. .IP "\fB\-\-setup\fR" 8 .IX Item "--setup" Actually set up your app's tables. This creates the database if need be, and runs any commands needed to bring the tables up to date; these may include \s-1CREATE\s0 \s-1TABLE\s0 or \s-1ALTER\s0 \s-1TABLE\s0 commands. This option is assumed if the database does not exist, or the database version is not the same as the application's version. .IP "\fB\-\-ignore\-reserved\-words\fR" 8 .IX Item "--ignore-reserved-words" Ignore any \s-1SQL\s0 reserved words used in table or column definitions, if this option is not used and a reserved word is found it will cause an error. .IP "\fB\-\-no\-bootstrap\fR" 8 .IX Item "--no-bootstrap" don't run Bootstrap, mostly to get rid of creating initial data .IP "\fB\-\-help\fR" 8 .IX Item "--help" Print a brief help message and exits. .IP "\fB\-\-man\fR" 8 .IX Item "--man" Prints the manual page and exits. .SH "DESCRIPTION" .IX Header "DESCRIPTION" Looks for all model classes of your Jifty application and generates \&\s-1SQL\s0 statements to create or update database tables for all of the models. It either prints the \s-1SQL\s0 to standard output (\fB\-\-print\fR) or actually issues the \f(CW\*(C`CREATE TABLE\*(C'\fR or \f(CW\*(C`ALTER TABLE\*(C'\fR statements on Jifty's database. .PP (Note that even if you are just displaying the \s-1SQL\s0, you need to have correctly configured your Jifty database in \&\fIProjectRoot\fR\f(CW\*(C`/etc/config.yml\*(C'\fR, because the \s-1SQL\s0 generated may depend on the database type.) .PP By default checks for \s-1SQL\s0 reserved words in your table names and column definitions, throwing an error if any are found. .PP If you want to permanently turn this behaviour off you can set CheckSchema to 0 in the database section of your applications config file. .SH "BUGS" .IX Header "BUGS" Due to limitations of DBIx::DBSchema, this probably only works with PostgreSQL, MySQL and SQLite. .PP It is possible that some of this functionality should be rolled into Jifty::DBI::SchemaGenerator .SH "METHODS" .IX Header "METHODS" .SS "run" .IX Subsection "run" Prints a help message if the users want it. If not, goes about its business. .PP Sets up the environment, checks current database state, creates or deletes a database as necessary and then creates or updates your models' schema. .SS "run_upgrades" .IX Subsection "run_upgrades" Take the actions we need in order to bring an existing database up to current. .SS "setup_environment" .IX Subsection "setup_environment" Sets up a minimal Jifty environment. .SS "schema" .IX Subsection "schema" Returns a Jifty::Schema object. .SS "probe_database_existence" .IX Subsection "probe_database_existence" Probes our database to see if it exists and is up to date. .SS "create_all_tables" .IX Subsection "create_all_tables" Create all tables for this application's models. Generally, this happens on installation. .SS "create_tables_for_models TABLEs" .IX Subsection "create_tables_for_models TABLEs" Given a list of items that are the scalar names of subclasses of Jifty::Record, either prints \s-1SQL\s0 or creates all those models in your database. .SS "upgrade_jifty_tables" .IX Subsection "upgrade_jifty_tables" Upgrade Jifty's internal tables. .SS "upgrade_application_tables" .IX Subsection "upgrade_application_tables" Upgrade the application's tables. .SS "upgrade_plugin_tables" .IX Subsection "upgrade_plugin_tables" Upgrade the tables for each plugin. .SS "upgrade_tables \s-1BASECLASS\s0, \s-1FROM\s0, \s-1TO\s0, [\s-1UPGRADECLASS\s0]" .IX Subsection "upgrade_tables BASECLASS, FROM, TO, [UPGRADECLASS]" Given a \f(CW\*(C`BASECLASS\*(C'\fR to upgrade, and two version objects, \f(CW\*(C`FROM\*(C'\fR and \f(CW\*(C`TO\*(C'\fR, performs the needed transforms to the database. \&\f(CW\*(C`UPGRADECLASS\*(C'\fR, if not specified, defaults to \f(CW\*(C`BASECLASS\*(C'\fR::Upgrade .SS "manage_database_existence" .IX Subsection "manage_database_existence" If the user wants the database created, creates the database. If the user wants the old database deleted, does that too. Exits with a return value of 1 if the database drop or create fails.