This commit is contained in:
Lizandro Guarnizo
2026-04-25 14:47:20 -05:00
parent c56cd218fa
commit bbf34d08d0
8 changed files with 645 additions and 0 deletions
@@ -0,0 +1,41 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\DB;
return new class extends Migration
{
public function up(): void
{
// Inserta las claves de configuración del correo en la tabla existente
$keys = [
['config_key' => 'correo_imap_host', 'config_value' => '', 'description' => 'Servidor IMAP (ej: imap.gmail.com)'],
['config_key' => 'correo_imap_port', 'config_value' => '993', 'description' => 'Puerto IMAP (993=SSL, 143=sin SSL)'],
['config_key' => 'correo_imap_ssl', 'config_value' => '1', 'description' => 'Usar SSL/TLS (1=sí, 0=no)'],
['config_key' => 'correo_imap_user', 'config_value' => '', 'description' => 'Usuario/email de la cuenta'],
['config_key' => 'correo_imap_password', 'config_value' => '', 'description' => 'Contraseña o App Password'],
['config_key' => 'correo_imap_folder', 'config_value' => 'INBOX', 'description' => 'Carpeta a leer'],
['config_key' => 'correo_imap_enabled', 'config_value' => '0', 'description' => 'Habilitar lectura de correos (1/0)'],
];
foreach ($keys as $key) {
DB::table('whatsapp_system_config')->insertOrIgnore([
...$key,
'created_at' => now(),
'updated_at' => now(),
]);
}
}
public function down(): void
{
DB::table('whatsapp_system_config')
->whereIn('config_key', [
'correo_imap_host', 'correo_imap_port', 'correo_imap_ssl',
'correo_imap_user', 'correo_imap_password', 'correo_imap_folder',
'correo_imap_enabled',
])->delete();
}
};