<commit_before><?php defined('SYSPATH') OR die('No direct script access.');

/**
 * Dump the current database structure to a file (migrations/schema.sql by default)
 *
 * options:
 *
 *  - database: the id of the database to dump from the config/database.php file, 'default' by default, configurable from config
 *  - file: file override the schema.sql file location to dump to another file
 */
class Task_DB_Structure_Dump extends Minion_Database {

	protected $_options = array(
		'database' => 'default',
		'file' => FALSE,
	);

    protected function __construct()
    {
        $this->_options['database'] = Kohana::$config->load("migrations.database");
        parent::__construct();
    }

    protected function _execute(array $options)
	{
		$db = $this->db_params($options['database']);

		$file = $options['file'] ? $options['file'] : Kohana::$config->load("migrations.path").DIRECTORY_SEPARATOR.'schema.sql';
		
		$command = strtr("mysqldump -u:username :password -h :hostname --skip-comments --add-drop-database --add-drop-table --no-data :database | sed 's/AUTO_INCREMENT=[0-9]*\b//' > :file ", array(
			':username' => $db['username'],
			':password' => $db['password'] ? <PASSWORD>'.$db['password'] : '',
			':database' => $db['database'],
			':hostname' => $db['hostname'],
			':file'     => $file
		));

		Minion_CLI::write(Minion_CLI::color('Saving structure of database "'.$db['database'].'" to '.Debug::path($file), 'green'));

		system($command);
	}

}
<commit_msg>Fix unnecessary double space after each 'create table' in schema.sql when ./minion db:structure:dump is executed.<commit_after><?php defined('SYSPATH') OR die('No direct script access.');

/**
 * Dump the current database structure to a file (migrations/schema.sql by default)
 *
 * options:
 *
 *  - database: the id of the database to dump from the config/database.php file, 'default' by default, configurable from config
 *  - file: file override the schema.sql file location to dump to another file
 */
class Task_DB_Structure_Dump extends Minion_Database {

	protected $_options = array(
		'database' => 'default',
		'file' => FALSE,
	);

    protected function __construct()
    {
        $this->_options['database'] = Kohana::$config->load("migrations.database");
        parent::__construct();
    }

    protected function _execute(array $options)
	{
		$db = $this->db_params($options['database']);

		$file = $options['file'] ? $options['file'] : Kohana::$config->load("migrations.path").DIRECTORY_SEPARATOR.'schema.sql';
		
		$command = strtr("mysqldump -u:username :password -h :hostname --skip-comments --add-drop-database --add-drop-table --no-data :database | sed 's/ AUTO_INCREMENT=[0-9]*\b//' > :file ", array(
			':username' => $db['username'],
			':password' => $db['password'] ? <PASSWORD>['password'] : '',
			':database' => $db['database'],
			':hostname' => $db['hostname'],
			':file'     => $file
		));

		Minion_CLI::write(Minion_CLI::color('Saving structure of database "'.$db['database'].'" to '.Debug::path($file), 'green'));

		system($command);
	}

}

{'fraction_non_alphanumeric': 0.1835071707953064, 'fraction_numerical': 0.001303780964797914, 'mean_word_length': 4.228279386712096, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 29, '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': '1667070', 'n_tokens_mistral': 992, 'n_tokens_neox': 959, 'n_words': 237}