On this page
Class SchemaShell
Schema is a command-line database management utility for automating programmer chores.
Schema is CakePHP's database management utility. This helps you maintain versions of of your database.
- AppShell
- SchemaShell 
Link: https://book.cakephp.org/2.0/en/console-and-shells/schema-management-and-migrations.html
Copyright: Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
License: MIT License
Location: Cake/Console/Command/SchemaShell.php
Properties summary
Method Summary
- 
    _create() protectedCreate database from Schema object Should be called via the run method 
- 
    _loadSchema() protectedPrepares the Schema objects for database operations.
- 
    _run() protectedRuns sql from _create() or _update()
- 
    _update() protectedUpdate database with Schema object Should be called via the run method 
- 
    create() publicRun database create commands. Alias for run create.
- 
    dump() publicDump Schema object to sql file Use the writeparam to enable and control SQL file output location. Simply using -write will write the sql file to the same dir as the schema file. If -write contains a full path name the file will be saved there. If -write only contains no DS, that will be used as the file name, in the same dir as the schema file.
- 
    generate() publicRead database and Write schema object accepts a connection as first arg or path to save as second arg 
- 
    getOptionParser() publicGets the option parser instance and configures it.
- 
    startup() publicOverride startup
- 
    update() publicRun database create commands. Alias for run create.
- 
    view() publicRead and output contents of schema object path to read as second arg 
Method Detail
_create()source protected
_create( CakeSchema $Schema , string $table null )Create database from Schema object Should be called via the run method
Parameters
- CakeSchema- $Schema
- The schema instance to create.
- 
     string $tableoptional null
- The table name.
_run()source protected
_run( array $contents , string $event , CakeSchema $Schema )Runs sql from _create() or _update()
Parameters
- 
     array $contents
- The contents to execute.
- 
     string $event
- The event to fire
- CakeSchema- $Schema
- The schema instance.
_update()source protected
_update( CakeSchema $Schema , string $table null )Update database with Schema object Should be called via the run method
Parameters
- CakeSchema- $Schema
- $Schema The schema instance
- 
     string $tableoptional null
- The table name.
dump()source public
dump( )Dump Schema object to sql file Use the write param to enable and control SQL file output location. Simply using -write will write the sql file to the same dir as the schema file. If -write contains a full path name the file will be saved there. If -write only contains no DS, that will be used as the file name, in the same dir as the schema file.
Returns
stringgenerate()source public
generate( )Read database and Write schema object accepts a connection as first arg or path to save as second arg
getOptionParser()source public
getOptionParser( )Gets the option parser instance and configures it.
Returns
ConsoleOptionParserProperties detail
© 2005–2017 The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
 https://api.cakephp.org/2.10/class-SchemaShell.html