db->getSchema()->getTableSchema('rescue_space_profile', true); if ($schema === null) { return; } if (!isset($schema->columns['template_key'])) { $this->addColumn('rescue_space_profile', 'template_key', $this->string(64)->defaultValue('rescue_center')->notNull()); } } public function safeDown() { $schema = $this->db->getSchema()->getTableSchema('rescue_space_profile', true); if ($schema !== null && isset($schema->columns['template_key'])) { $this->dropColumn('rescue_space_profile', 'template_key'); } } }