Skip to content
This repository has been archived by the owner on Jan 22, 2018. It is now read-only.

Commit

Permalink
Merge pull request #15 from OpenBuildings/spaces-in-generated-migrations
Browse files Browse the repository at this point in the history
Use spaces instead of tabs in the generated migrations
  • Loading branch information
hkdobrev committed Oct 1, 2015
2 parents 095ca8b + 5d48241 commit 1ea3904
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions classes/Migration.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public function execute($sql, $params = NULL, $display = NULL)
if ($display === NULL)
{
$display = str_replace("\n", '', $sql);
$display = preg_replace("/[\s\t]+/", " ", $display);
$display = preg_replace("/[\s]+/", " ", $display);
$display = "execute( ".Text::limit_chars($display, 80)." )";
}
return $this->run_driver($display, __FUNCTION__, $args);
Expand All @@ -99,7 +99,7 @@ public function query($sql, $params = NULL)
{
$args = func_get_args();
$display = str_replace("\n", '', $sql);
$display = preg_replace("/[\s\t]+/", " ", $display);
$display = preg_replace("/[\s]+/", " ", $display);
$display = Text::limit_chars($display, 60);
return $this->run_driver("query( $display )", __FUNCTION__, $args, TRUE);
}
Expand Down
4 changes: 2 additions & 2 deletions classes/Migration/Actions.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,15 @@ public function drop_table($tables)

foreach ($table->columns as $name => $field_params)
{
$fields[] = "\n\t\t\t'$name' => ".self::field_params_to_string($field_params);
$fields[] = "\n '$name' => ".self::field_params_to_string($field_params);
}

foreach($table->options as $name => $option)
{
$options[] = "'$name' => '$option'";
}

$this->down[] = "\$this->create_table('{$table->name()}', array( ".join(',', $fields)." \n\t\t), array( ".join(',', $options)." )); ";
$this->down[] = "\$this->create_table('{$table->name()}', array( ".join(',', $fields)." \n ), array( ".join(',', $options)." )); ";
}
catch (Migration_Exception $e)
{
Expand Down
2 changes: 1 addition & 1 deletion classes/Migrations.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public function generate_new_migration_file($name, $actions_template = NULL)

static function indent($action)
{
return "\t\t$action";
return " $action";
}

/**
Expand Down
18 changes: 9 additions & 9 deletions templates/migration.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
* add_index($table_name, $index_name, $columns, $index_type = 'normal')
* remove_index($table_name, $index_name)
*/
class {class_name} extends Migration {
public function up()
{
class {class_name} extends Migration
{
public function up()
{
{up}
}
public function down()
{
}

public function down()
{
{down}
}
}
}

0 comments on commit 1ea3904

Please sign in to comment.