Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

do prod migration with custom command

Andras Bacsaia5b48caeb9f9
diff --git a/app/Console/Commands/Migration.php b/app/Console/Commands/Migration.php
new file mode 100644
index 0000000000..58b94fd55f
--- /dev/null
+++ b/app/Console/Commands/Migration.php
@@ -0,0 +1,24 @@
+<?php
+
+namespace App\Console\Commands;
+
+use Illuminate\Console\Command;
+
+class Migration extends Command
+{
+ protected $signature = 'start:migration';
+
+ protected $description = 'Start Migration';
+
+ public function handle()
+ {
+ if (config('constants.migration.is_migration_enabled')) {
+ $this->info('Migration is enabled on this server.');
+ $this->call('migrate --force --isolated');
+ exit(0);
+ } else {
+ $this->info('Migration is disabled on this server.');
+ exit(0);
+ }
+ }
+}
diff --git a/config/constants.php b/config/constants.php
index 4ea4411b60..3054df1f06 100644
--- a/config/constants.php
+++ b/config/constants.php
@@ -33,6 +33,10 @@ return [
'app_key' => env('PUSHER_APP_KEY'),
],
+ 'migration' => [
+ 'is_migration_enabled' => env('MIGRATION_ENABLED', true),
+ ],
+
'horizon' => [
'is_horizon_enabled' => env('HORIZON_ENABLED', true),
'is_scheduler_enabled' => env('SCHEDULER_ENABLED', true),
diff --git a/docker/production/etc/s6-overlay/s6-rc.d/db-migration/up b/docker/production/etc/s6-overlay/s6-rc.d/db-migration/up
index f1a5006f16..c2548d1360 100644
--- a/docker/production/etc/s6-overlay/s6-rc.d/db-migration/up
+++ b/docker/production/etc/s6-overlay/s6-rc.d/db-migration/up
@@ -6,8 +6,6 @@ cd /var/www/html
foreground {
php
artisan
- migrate
- --force
- --isolated
+ start:migration
}