die("Error: The version option must be either a timestamp (e.g. 101129_185401)\nor the full name of a migration (e.g. m101129_185401_create_user_table).\n");
thrownewException("The version option must be either a timestamp (e.g. 101129_185401)\nor the full name of a migration (e.g. m101129_185401_create_user_table).");
}
}
// try migrate up
// try migrate up
...
@@ -258,7 +293,7 @@ class MigrateController extends Controller
...
@@ -258,7 +293,7 @@ class MigrateController extends Controller
}
}
}
}
die("Error: Unable to find the version '$originalVersion'.\n");
thrownewException("Unable to find the version '$originalVersion'.");
}
}
publicfunctionactionMark($args)
publicfunctionactionMark($args)
...
@@ -266,13 +301,13 @@ class MigrateController extends Controller
...
@@ -266,13 +301,13 @@ class MigrateController extends Controller
if(isset($args[0])){
if(isset($args[0])){
$version=$args[0];
$version=$args[0];
}else{
}else{
$this->usageError('Please specify which version to mark to.');
thrownewException('Please specify which version to mark to.');
die("Error: The version option must be either a timestamp (e.g. 101129_185401)\nor the full name of a migration (e.g. m101129_185401_create_user_table).\n");
thrownewException("Error: The version option must be either a timestamp (e.g. 101129_185401)\nor the full name of a migration (e.g. m101129_185401_create_user_table).");
}
}
$db=$this->getDb();
$db=$this->getDb();
...
@@ -357,12 +392,17 @@ class MigrateController extends Controller
...
@@ -357,12 +392,17 @@ class MigrateController extends Controller
}
}
}
}
/**
* Creates a new migration.
* @param array $args the name of the new migration.
* @throws Exception if the name of the new migration is not provided
*/
publicfunctionactionCreate($args)
publicfunctionactionCreate($args)
{
{
if(isset($args[0])){
if(isset($args[0])){
$name=$args[0];
$name=$args[0];
}else{
}else{
$this->usageError('Please provide the name of the new migration.');
thrownewException('Please provide the name of the new migration.');
}
}
if(!preg_match('/^\w+$/',$name)){
if(!preg_match('/^\w+$/',$name)){
...
@@ -428,7 +468,7 @@ class MigrateController extends Controller
...
@@ -428,7 +468,7 @@ class MigrateController extends Controller
die("Error: CMigrationCommand.connectionID '{$this->connectionID}' is invalid. Please make sure it refers to the ID of a CDbConnection application component.\n");
thrownewException("Invalid DB connection: {$this->connectionID}.");
}
}
}
}
}
}
...
@@ -505,7 +545,7 @@ class MigrateController extends Controller
...
@@ -505,7 +545,7 @@ class MigrateController extends Controller