1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-09 20:52:56 +01:00

Prevent seeder from being run twice

This commit is contained in:
Hillel Coren 2015-07-09 17:12:43 +03:00
parent c42dfb8b96
commit 9477c7467d

View File

@ -14,6 +14,7 @@ use Cookie;
use Response; use Response;
use App\Models\User; use App\Models\User;
use App\Models\Account; use App\Models\Account;
use App\Models\Industry;
use App\Ninja\Mailers\Mailer; use App\Ninja\Mailers\Mailer;
use App\Ninja\Repositories\AccountRepository; use App\Ninja\Repositories\AccountRepository;
use Redirect; use Redirect;
@ -97,7 +98,9 @@ class AppController extends BaseController
// == DB Migrate & Seed == // // == DB Migrate & Seed == //
// Artisan::call('migrate:rollback', array('--force' => true)); // Debug Purposes // Artisan::call('migrate:rollback', array('--force' => true)); // Debug Purposes
Artisan::call('migrate', array('--force' => true)); Artisan::call('migrate', array('--force' => true));
Artisan::call('db:seed', array('--force' => true)); if (Industry::count() == 0) {
Artisan::call('db:seed', array('--force' => true));
}
Artisan::call('optimize', array('--force' => true)); Artisan::call('optimize', array('--force' => true));
$firstName = trim(Input::get('first_name')); $firstName = trim(Input::get('first_name'));
@ -159,7 +162,9 @@ class AppController extends BaseController
if (!Utils::isNinja() && !Utils::isDatabaseSetup()) { if (!Utils::isNinja() && !Utils::isDatabaseSetup()) {
try { try {
Artisan::call('migrate', array('--force' => true)); Artisan::call('migrate', array('--force' => true));
Artisan::call('db:seed', array('--force' => true)); if (Industry::count() == 0) {
Artisan::call('db:seed', array('--force' => true));
}
Artisan::call('optimize', array('--force' => true)); Artisan::call('optimize', array('--force' => true));
} catch (Exception $e) { } catch (Exception $e) {
Response::make($e->getMessage(), 500); Response::make($e->getMessage(), 500);