migrate on appservice boot

This commit is contained in:
Andras Bacsai 2023-05-03 10:06:15 +02:00
parent 8bfdcdbf44
commit 1ad7d885b3
2 changed files with 5 additions and 11 deletions

View File

@ -10,7 +10,6 @@ class ForceUpgrade extends Component
{ {
public function upgrade() public function upgrade()
{ {
//if (env('APP_ENV') === 'local') {
if (config('app.env') === 'local') { if (config('app.env') === 'local') {
$server = Server::where('ip', 'coolify-testing-host')->first(); $server = Server::where('ip', 'coolify-testing-host')->first();
if (!$server) { if (!$server) {

View File

@ -7,6 +7,7 @@
use Illuminate\Support\Facades\Process; use Illuminate\Support\Facades\Process;
use Illuminate\Support\Facades\Queue; use Illuminate\Support\Facades\Queue;
use Illuminate\Support\ServiceProvider; use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Str;
class AppServiceProvider extends ServiceProvider class AppServiceProvider extends ServiceProvider
{ {
@ -15,14 +16,9 @@ class AppServiceProvider extends ServiceProvider
*/ */
public function register(): void public function register(): void
{ {
// @TODO: Is this the best place to run the seeder? if (config('app.env') === 'production' && Str::contains(config('coolify.version'), ['nightly'])) {
// if (env('APP_ENV') === 'production') { Process::run('php artisan migrate:fresh --force --seed --seeder=ProductionSeeder');
// dump('Seed default data.'); }
// Process::run('php artisan db:seed --class=ProductionSeeder --force');
// } else {
// dump('Not in production environment.');
// }
//
} }
/** /**
@ -33,7 +29,6 @@ public function boot(): void
Queue::after(function (JobProcessed $event) { Queue::after(function (JobProcessed $event) {
// @TODO: Remove `coolify-builder` container after the remoteProcess job is finishged and remoteProcess->type == `deployment`. // @TODO: Remove `coolify-builder` container after the remoteProcess job is finishged and remoteProcess->type == `deployment`.
if ($event->job->resolveName() === CoolifyTask::class) { if ($event->job->resolveName() === CoolifyTask::class) {
} }
}); });
} }