public function generate_new_migration_file($name, $actions_template = NULL) { $actions = new Migration_Actions($this->driver); if ($actions_template) { $actions->template(getcwd() . DIRECTORY_SEPARATOR . $actions_template); } else { $actions->parse($name); } $template = file_get_contents(Kohana::find_file('templates', 'migration', 'tpl')); $class_name = str_replace(' ', '_', ucwords(str_replace('_', ' ', $name))); $filename = sprintf("%d_{$name}.php", time()); file_put_contents($this->config['path'] . DIRECTORY_SEPARATOR . $filename, strtr($template, array('{up}' => join("\n", array_map('Migrations::indent', $actions->up)), '{down}' => join("\n", array_map('Migrations::indent', $actions->down)), '{class_name}' => $class_name))); return $filename; }