1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00

Handle migrations run before setup

This commit is contained in:
Hillel Coren 2018-01-25 13:12:50 +02:00
parent 52911841ff
commit 840283a0ce
2 changed files with 14 additions and 11 deletions

View File

@ -122,22 +122,24 @@ class AppController extends BaseController
fwrite($fp, $config);
fclose($fp);
if (Utils::isDatabaseSetup()) {
return Redirect::to('/login');
if (! Utils::isDatabaseSetup()) {
// == DB Migrate & Seed == //
$sqlFile = base_path() . '/database/setup.sql';
DB::unprepared(file_get_contents($sqlFile));
}
// == DB Migrate & Seed == //
$sqlFile = base_path() . '/database/setup.sql';
DB::unprepared(file_get_contents($sqlFile));
Cache::flush();
Artisan::call('db:seed', ['--force' => true, '--class' => 'UpdateSeeder']);
Artisan::call('optimize', ['--force' => true]);
$firstName = trim(Input::get('first_name'));
$lastName = trim(Input::get('last_name'));
$email = trim(strtolower(Input::get('email')));
$password = trim(Input::get('password'));
$account = $this->accountRepo->create($firstName, $lastName, $email, $password);
$user = $account->users()->first();
if (! Account::count()) {
$firstName = trim(Input::get('first_name'));
$lastName = trim(Input::get('last_name'));
$email = trim(strtolower(Input::get('email')));
$password = trim(Input::get('password'));
$account = $this->accountRepo->create($firstName, $lastName, $email, $password);
$user = $account->users()->first();
}
return Redirect::to('/login');
}

View File

@ -2658,6 +2658,7 @@ $LANG = array(
'auto' => 'Auto',
'tax_amount' => 'Tax Amount',
'tax_paid' => 'Tax Paid',
'none' => 'None',
);