Pdo::alterAddColumn
ALTER TABLE … ADD COLUMNのクエリを組み立てます
説明
public self Pdo::alterAddColumn( string $table, array $field )
Alter Table "table" ADD COLUMN ...を組み立てます。
引数
| 名前 | データ型 | デフォルト | 備考 |
|---|---|---|---|
| $table | string | テーブル名 | |
| $field | array | カラムの定義。createTableにあるキーをすべて指定します |
例
Controller
$db = new \Fegg\Database\Pdo();
// Alter Table "sample" ADD COLUMN note TEXT
$db->alterAddColumn('sample', array(
'name' => 'note',
'type' => 'TEXT',
'notnull' => false,
'dflt_value' => null,
'pk' => false,
'ai' => false,
))->execute();