Skip to content

Commit

Permalink
改进升级方式
Browse files Browse the repository at this point in the history
  • Loading branch information
0xxb committed Aug 17, 2022
1 parent c46207c commit 62809f5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
8 changes: 2 additions & 6 deletions app/Services/UpgradeService.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,9 @@ public function upgrade(): bool
$version = $this->getVersions()->first()['name'];
Config::query()->where('name', ConfigKey::AppVersion)->update(['value' => $version]);
// 执行数据库迁移
Artisan::call('migrate');
// 清除配置缓存
Cache::forget('configs');
Artisan::call('migrate', ['--seed' => true]);
// 清除缓存
Artisan::call('route:clear');
Artisan::call('cache:clear');
Artisan::call('view:clear');
Artisan::call('optimize:clear');
Artisan::call('package:discover');
} catch (\Throwable $e) {
Utils::e($e, '升级失败');
Expand Down
2 changes: 1 addition & 1 deletion config/convention.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
return [
'app' => [
ConfigKey::AppName => 'Lsky Pro',
ConfigKey::AppVersion => 'V 2.0.5',
ConfigKey::AppVersion => 'V 2.1',
ConfigKey::SiteKeywords => 'Lsky Pro,lsky,兰空图床',
ConfigKey::SiteDescription => 'Lsky Pro, Your photo album on the cloud.',
ConfigKey::SiteNotice => '',
Expand Down
7 changes: 6 additions & 1 deletion database/seeders/DatabaseSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Database\Seeders;

use App\Models\Config;
use Illuminate\Database\Seeder;

class DatabaseSeeder extends Seeder
Expand All @@ -13,6 +14,10 @@ class DatabaseSeeder extends Seeder
*/
public function run()
{
// $this->call([]);
// 初始化系统默认配置
foreach (config('convention.app') as $key => $value) {
$content = is_array($value) ? json_encode($value, JSON_UNESCAPED_UNICODE) : $value;
Config::query()->firstOrCreate(['name' => $key], ['value' => $content]);
}
}
}

0 comments on commit 62809f5

Please sign in to comment.