_initializeSchema() protected method

This function is only called after fetching the schema out of the database. If you wish to provide your own schema to this table without touching the database, you can override schema() or inject the definitions though that method. ### Example: protected function _initializeSchema(\Cake\Database\Schema\Table $table) { $table->columnType('preferences', 'json'); return $table; }
protected _initializeSchema ( Cake\Database\Schema\Table $table ) : Cake\Database\Schema\Table
$table Cake\Database\Schema\Table The table definition fetched from database.
return Cake\Database\Schema\Table the altered schema
 /**
  * @param \Cake\Database\Schema\Table $table Table schema
  * @return \Cake\Database\Schema\Table
  */
 protected function _initializeSchema(Schema $table)
 {
     $table->columnType('payload', 'serialize');
     $table->columnType('options', 'serialize');
     $table->columnType('history', 'json');
     return parent::_initializeSchema($table);
 }
Example #2
0
 protected function _initializeSchema(Schema $table)
 {
     $table->columnType('ip', 'ip');
     return parent::_initializeSchema($table);
 }