plugins/hoge/config/sql/schema.php
class HogeSchema extends CakeSchema
{
var $name = 'Hoge';
var $hoges = array(
'id' => array('type' => 'integer', 'length' => 10, 'null' => false, 'key' => 'primary'),
'hogedata' => array('type' => 'string', 'length' => 32, 'null' => false, 'default' => 'hogehoge'),
'created' => array('type' => 'datetime'),
'modified' => array('type' => 'datetime'),
);
}
$ cake schema run create Hoge -path plugins/hoge/config/sql Welcome to CakePHP v1.2.3.8166 Console --------------------------------------------------------------- App : app Path: /www/cake/app --------------------------------------------------------------- Cake Schema Shell --------------------------------------------------------------- The following table(s) will be dropped. hoges Are you sure you want to drop the table(s)? (y/n) [n] > The following table(s) will be created. hoges Are you sure you want to create the table(s)? (y/n) [y] > Creating table(s). hoges updated. End create.
これでDBにhogesテーブルが追加される。
