The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

options

Returns a hash of all the options this script takes. (See the usage message for details)

run

Prints a help message if the users want it. If not, goes about its business.

Sets up the environment, checks current database state, creates or deletes a database as necessary and then creates or updates your models' schema.

setup_environment

If the user has specified an --include flag or a path on the commandline, add it to the application's @INC. After that, get a minimal Jifty environment set up

Prints out help for the package using pod2usage.

If the user specified --help, prints a brief usage message

If the user specified --man, prints out a manpage

prepare_mode_classes

Reads in our application class from the config file, sets up a schema generator and finds all our app's models.

probe_database_existence

Probes our database to see if it exists and is up to date.

create_all_tables

Create all tables for this application's models. Generally, this happens on installation.

upgrade_tables

Upgrade your app's tables to match your current model.

manage_database_existence

If the user wants the database created, creates the database. If the user wants the old database deleted, does that too.

NAME

Jifty::Script::Schema - Create SQL to update or create your Jifty app's tables

SYNOPSIS

  jifty schema --setup      Creates or updates your application's database tables

 Options:
   --print              Print SQL, rather than executing commands

   --create-database  Creates the database, if necessary
   --drop-database    Drops the database before creating, in conjunction with B<--create>

   --include libpath  add libpath to C<@INC> (can be used multiple times)
   -I        libpath
   --help             brief help message
   --man              full documentation

OPTIONS

ProjectRoot defaults to the current directory.

--print

Rather than actually running the database create/update/drop commands, Prints the commands to standard output

--create-database

Send CREATE DATABASE command

--drop-database

Send DROP DATABASE command, if used in conjunction with --create

--setup

Actually set up your app's tables (create or update as needed)

--include libpath, -I libpath

Prepends libpath to Perl's @INC array. (You may want this in order to locate your Jifty framework libraries.) You can specify this as many times as you want:

  schema --print -I ../Jifty/lib -I ~/MyLibs ProjectRoot

Note that ProjectRoot/lib is automatically added to @INC.

--help

Print a brief help message and exits.

--man

Prints the manual page and exits.

DESCRIPTION

Looks in the directory ProjectRoot/lib/ for all model classes and generates SQL statements to create or update database tables for all of the models. It either prints the SQL to standard output (--print) or actually issues the CREATE TABLE or ALTER TABLE statements on Jifty's database.

(Note that even if you are just displaying the SQL, you need to have correctly configured your Jifty database in ProjectRoot/etc/config.yml, because the SQL generated may depend on the database type.)

BUGS

Due to limitations of DBIx::DBSchema, this probably only works with PostgreSQL, MySQL and SQLite.

It is possible that some of this functionality should be rolled into Jifty::DBI::SchemaGenerator