メインコンテンツまでスキップ
Version: Fegg 5.x

Pdo::alterAddColumn

ALTER TABLE … ADD COLUMNのクエリを組み立てます

説明​

public self Pdo::alterAddColumn( string $table, array $field )

Alter Table "table" ADD COLUMN ...を組み立てます。

引数​

名前データ型デフォルト備考
$tablestringテーブル名
$fieldarrayカラムの定義。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();