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
Extended by SchemaShell
Package: Cake\Console\Command
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() protected

    Create database from Schema object Should be called via the run method

  • _loadSchema() protected
    Prepares the Schema objects for database operations.
  • _run() protected
    Runs sql from _create() or _update()
  • _update() protected

    Update database with Schema object Should be called via the run method

  • create() public
    Run database create commands. Alias for run create.
  • dump() public

    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.

  • generate() public

    Read database and Write schema object accepts a connection as first arg or path to save as second arg

  • Gets the option parser instance and configures it.
  • startup() public
    Override startup
  • update() public
    Run database create commands. Alias for run create.
  • view() public

    Read 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 $table optional null
The table name.

_loadSchema()source protected

_loadSchema( )

Prepares the Schema objects for database operations.

_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 $table optional null
The table name.

create()source public

create( )

Run database create commands. Alias for run create.

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

string

generate()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

ConsoleOptionParser

startup()source public

startup( )

Override startup

update()source public

update( )

Run database create commands. Alias for run create.

view()source public

view( )

Read and output contents of schema object path to read as second arg

Properties detail

$Schemasource

public CakeSchema

Schema class being used.

$_drysource

protected boolean

is this a dry run?

null

© 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