Skip to content

Commit f12562e

Browse files
committed
Fixes #7
1 parent 5395a47 commit f12562e

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/Mouf/Database/Patcher/Controllers/DatabasePatchController.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public function defaultAction($name, $patchInstanceName = null, $selfedit = 'fal
100100
}
101101
$this->status = 'skipped';
102102

103-
$this->content->addFile(__DIR__'/../../../../views/editPatch.php', $this);
103+
$this->content->addFile(__DIR__.'/../../../../views/editPatch.php', $this);
104104
$this->template->toHtml();
105105
}
106106

src/Mouf/Database/Patcher/DatabasePatch.php

+7-2
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ private function saveDbSchema()
300300
*
301301
* @return array
302302
*/
303-
public static function generateUpAndDonwSqlPatches()
303+
public static function generateUpAndDownSqlPatches()
304304
{
305305
$result = array();
306306
$fileName = __DIR__.'/../../../../generated/schema';
@@ -327,7 +327,12 @@ public static function generateUpAndDonwSqlPatches()
327327
*/
328328
public static function validateClass()
329329
{
330-
$result = self::generateUpAndDonwSqlPatches();
330+
$fileName = __DIR__.'/../../../../generated/schema';
331+
if (!file_exists($fileName)) {
332+
return new MoufValidatorResult(MoufValidatorResult::SUCCESS, "<strong>Database Patcher</strong>: You haven't generated yet a patch on the database model from this computer");
333+
}
334+
335+
$result = self::generateUpAndDownSqlPatches();
331336
if ($result['upPatch']) {
332337
return new MoufValidatorResult(MoufValidatorResult::WARN, '<strong>Database Patcher</strong>: Your database model has been modified, <a href="'.ROOT_URL.'vendor/mouf/mouf/dbpatch/?name=patchService" class="btn btn-large btn-success patch-run-all"><i class="icon-arrow-right icon-white"></i>please register a new patch.</a>');
333338
} else {

0 commit comments

Comments
 (0)