force migration

added maintenance mode
This commit is contained in:
Peter Papp
2020-08-26 07:51:16 +02:00
parent 0d272bc9b7
commit ab6ff5dbfd
4 changed files with 32 additions and 4 deletions

View File

@@ -212,7 +212,7 @@ Follow this steps:
- Restore your `.env` config file on your server.
## Update from 1.7.8 to 1.7.9
After uploaded new files, log in as admin to the app and go to `your-domain.com/upgrade-database`. This will upgrade your database on the background.
After uploaded new files, log in as admin to the app and go to `your-domain.com/service/upgrade-database`. This will upgrade your database on the background.
After that, **update path to your project in command below** and add the following **Cron** entry to your server:
```

View File

@@ -125,6 +125,28 @@ class UpgradeAppController extends Controller
return response('Done', 200);
}
/**
* Start maintenance mode
*/
public function up() {
$command = Artisan::call('up');
if ($command === 0) {
echo 'System is in production mode';
}
}
/**
* End maintenance mode
*/
public function down() {
$command = Artisan::call('down');
if ($command === 0) {
echo 'System is in maintenance mode';
}
}
/**
* Upgrade database
*/
@@ -137,7 +159,9 @@ class UpgradeAppController extends Controller
*/
if (! Schema::hasColumn('shares', 'expire_in')) {
$command = Artisan::call('migrate');
$command = Artisan::call('migrate', [
'--force' => true
]);
if ($command === 0) {
echo 'Operation was successful.';

View File

@@ -12,6 +12,8 @@ class CheckForMaintenanceMode extends Middleware
* @var array
*/
protected $except = [
//
'/service/upgrade-database',
'/service/down',
'/service/up',
];
}

View File

@@ -38,8 +38,10 @@ Route::group(['middleware' => ['auth:api', 'auth.master', 'scope:master']], func
});
// Admin system tools
Route::group(['middleware' => ['auth:api', 'auth.master', 'auth.admin', 'scope:master']], function () {
Route::group(['middleware' => ['auth:api', 'auth.master', 'auth.admin', 'scope:master'], 'prefix' => 'service'], function () {
Route::get('/upgrade-database', 'General\UpgradeAppController@upgrade_database');
Route::get('/down', 'General\UpgradeAppController@down');
Route::get('/up', 'General\UpgradeAppController@up');
});
// Get og site for web crawlers