public function alterTables($form)
{
if (isset($this->config['info']['vendor'])) {
$vendor = Str::lower($this->config['info']['vendor']);
} else {
$vendor = '';
}
$alter_sql = "ALTER TABLE mdl_{$vendor}_{$form['table']} ";
$add_columns = array();
$previous_field = 'id';
foreach ($form['fields'] as $field) {
if (!Schema::hasColumn("mdl_{$vendor}_{$form['table']}", $field)) {
$add_columns[] = "ADD COLUMN `{$field}` text COLLATE utf8_unicode_ci NULL AFTER `{$previous_field}`";
}
$previous_field = $field;
}
$alter_sql .= implode(', ', $add_columns) . ';';
DB::unprepared($alter_sql);
}