<commit_before><?php
namespace SlimApi\Phinx\Database;

use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Output\NullOutput;
use SlimApi\Interfaces\GeneratorServiceInterface;
use SlimApi\Migration\MigrationInterface;

class PhinxService implements MigrationInterface, GeneratorServiceInterface
{
    public $commands = [];
    private $application;
    private $types = ['string', 'text', 'integer', 'biginteger', 'float', 'decimal', 'datetime', 'timestamp', 'time', 'date', 'binary', 'boolean'];

    public function __construct($phinxApp)
    {
        $this->application = $phinxApp;
    }

    public function init($directory)
    {
        $this->run('init', ['path' => $directory]);
    }

    public function processCommand($type, ...$arguments)
    {
        switch ($type) {
            case 'create':
                $this->createTable(strtolower($arguments[0]));
                break;
            case 'addColumn':
                $arguments = array_pad($arguments, 5, null);
                $this->addColumn(...$arguments);
                break;
            case 'finalise':
                $this->finalise();
                break;
            default:
                throw new \Exception('Invalid migration command.');
                break;
        }
    }

    public function create($name)
    {
        PhinxMigration::$commands = $this->commands;
        $this->run('create', ['command' => 'create', 'name' => $name, '--class' => 'SlimApi\Phinx\Database\PhinxMigration']);
    }

    public function targetLocation($name)
    {
        return '';
    }

    private function createTable($name)
    {<commit_msg>Add timestamp columns<commit_after><?php
namespace SlimApi\Phinx\Database;

use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Output\NullOutput;
use SlimApi\Interfaces\GeneratorServiceInterface;
use SlimApi\Migration\MigrationInterface;

class PhinxService implements MigrationInterface, GeneratorServiceInterface
{
    public $commands = [];
    private $application;
    private $types = ['string', 'text', 'integer', 'biginteger', 'float', 'decimal', 'datetime', 'timestamp', 'time', 'date', 'binary', 'boolean'];

    public function __construct($phinxApp)
    {
        $this->application = $phinxApp;
    }

    public function init($directory)
    {
        $this->run('init', ['path' => $directory]);
    }

    public function processCommand($type, ...$arguments)
    {
        switch ($type) {
            case 'create':
                $this->createTable(strtolower($arguments[0]));
                break;
            case 'addColumn':
                $arguments = array_pad($arguments, 5, null);
                $this->addColumn(...$arguments);
                break;
            case 'finalise':
                $this->finalise();
                break;
            default:
                throw new \Exception('Invalid migration command.');
                break;
        }
    }

    public function create($name)
    {
        // need to add updated_at, created_at columns manually
        $this->processCommand('addColumn', 'updated_at', 'timestamp');
        $this->processCommand('addColumn', 'created_at', 'timestamp');

        PhinxMigration::$commands = $this->commands;

        $this->run('create', ['command' => 'create', 'name' => $name, '--class' => 'SlimApi\Phinx\Database\PhinxMigration']);
    }

    public function targetLocation($name)
    {
        return '';
    }

    private function createTable($name)
    {
{'fraction_non_alphanumeric': 0.1422109132032796, 'fraction_numerical': 0.0011309018942606728, 'mean_word_length': 2.465230166503428, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2859934', 'n_tokens_mistral': 964, 'n_tokens_neox': 941, 'n_words': 201}