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.
PHP coolifydatabasesdeploymentdockerdocker-composeinertiajslaravelmariadbmysqlnextjsnodejsphppostgresredisself-hostedself-hostingserverstatic-sitesveltesvelte5
fix: only encrypt instance email settings if there are any
peaklabs-dev0a851ec3f2de
diff --git a/database/migrations/2024_12_10_122142_encrypt_instance_settings_email_columns.php b/database/migrations/2024_12_10_122142_encrypt_instance_settings_email_columns.phpindex b17e53ddf3..83540ca3ce 100644--- a/database/migrations/2024_12_10_122142_encrypt_instance_settings_email_columns.php+++ b/database/migrations/2024_12_10_122142_encrypt_instance_settings_email_columns.php@@ -21,18 +21,20 @@ return new class extends Migration$table->text('smtp_username')->nullable()->change();});- $settings = DB::table('instance_settings')->get();- foreach ($settings as $setting) {- try {- DB::table('instance_settings')->where('id', $setting->id)->update([- 'smtp_from_address' => $setting->smtp_from_address ? Crypt::encryptString($setting->smtp_from_address) : null,- 'smtp_from_name' => $setting->smtp_from_name ? Crypt::encryptString($setting->smtp_from_name) : null,- 'smtp_recipients' => $setting->smtp_recipients ? Crypt::encryptString($setting->smtp_recipients) : null,- 'smtp_host' => $setting->smtp_host ? Crypt::encryptString($setting->smtp_host) : null,- 'smtp_username' => $setting->smtp_username ? Crypt::encryptString($setting->smtp_username) : null,- ]);- } catch (Exception $e) {- \Log::error('Error encrypting instance settings email columns: '.$e->getMessage());+ if (DB::table('instance_settings')->exists()) {+ $settings = DB::table('instance_settings')->get();+ foreach ($settings as $setting) {+ try {+ DB::table('instance_settings')->where('id', $setting->id)->update([+ 'smtp_from_address' => $setting->smtp_from_address ? Crypt::encryptString($setting->smtp_from_address) : null,+ 'smtp_from_name' => $setting->smtp_from_name ? Crypt::encryptString($setting->smtp_from_name) : null,+ 'smtp_recipients' => $setting->smtp_recipients ? Crypt::encryptString($setting->smtp_recipients) : null,+ 'smtp_host' => $setting->smtp_host ? Crypt::encryptString($setting->smtp_host) : null,+ 'smtp_username' => $setting->smtp_username ? Crypt::encryptString($setting->smtp_username) : null,+ ]);+ } catch (Exception $e) {+ \Log::error('Error encrypting instance settings email columns: '.$e->getMessage());+ }}}}@@ -43,11 +45,11 @@ return new class extends Migrationpublic function down(): void{Schema::table('instance_settings', function (Blueprint $table) {- $table->text('smtp_from_address')->nullable()->change();- $table->text('smtp_from_name')->nullable()->change();- $table->text('smtp_recipients')->nullable()->change();- $table->text('smtp_host')->nullable()->change();- $table->text('smtp_username')->nullable()->change();+ $table->string('smtp_from_address')->nullable()->change();+ $table->string('smtp_from_name')->nullable()->change();+ $table->string('smtp_recipients')->nullable()->change();+ $table->string('smtp_host')->nullable()->change();+ $table->string('smtp_username')->nullable()->change();});if (DB::table('instance_settings')->exists()) {