Fix: socket permissions para nginx
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('promociones', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('titulo');
|
||||
$table->text('descripcion')->nullable();
|
||||
$table->string('imagen')->nullable();
|
||||
$table->date('fecha_inicio');
|
||||
$table->date('fecha_fin');
|
||||
$table->enum('status', ['activo', 'inactivo'])->default('activo');
|
||||
$table->foreignId('plantel_id')->constrained('plantels')->cascadeOnDelete();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('promociones');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('alumno_promocion', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('alumno_id')->constrained('alumnos')->cascadeOnDelete();
|
||||
$table->foreignId('promocion_id')->constrained('promociones')->cascadeOnDelete();
|
||||
$table->timestamp('enviado_at')->nullable();
|
||||
$table->enum('status_envio', ['pendiente', 'enviado', 'fallido'])->default('pendiente');
|
||||
$table->string('whatsapp_mensaje_id')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('alumno_promocion');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('whatsapp_logs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('alumno_id')->nullable()->constrained('alumnos')->nullOnDelete();
|
||||
$table->string('telefono', 30);
|
||||
$table->enum('tipo', ['enviado', 'recibido', 'opt_out', 'error']);
|
||||
$table->text('mensaje')->nullable();
|
||||
$table->string('media_type')->nullable();
|
||||
$table->json('payload')->nullable();
|
||||
$table->boolean('leido')->default(false);
|
||||
$table->timestamp('created_at')->useCurrent();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('whatsapp_logs');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('alumnos', function (Blueprint $table) {
|
||||
$table->boolean('opt_out')->default(false)->after('status');
|
||||
$table->timestamp('opt_out_at')->nullable()->after('opt_out');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('alumnos', function (Blueprint $table) {
|
||||
$table->dropColumn(['opt_out', 'opt_out_at']);
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
// Quitar la FK singular antes de modificar la tabla
|
||||
Schema::table('promociones', function (Blueprint $table) {
|
||||
$table->dropForeign(['plantel_id']);
|
||||
$table->dropColumn('plantel_id');
|
||||
});
|
||||
|
||||
Schema::create('plantel_promocion', function (Blueprint $table) {
|
||||
$table->unsignedBigInteger('plantel_id');
|
||||
$table->foreign('plantel_id')->references('id')->on('plantels')->cascadeOnDelete();
|
||||
$table->unsignedBigInteger('promocion_id');
|
||||
$table->foreign('promocion_id')->references('id')->on('promociones')->cascadeOnDelete();
|
||||
$table->primary(['plantel_id', 'promocion_id']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('plantel_promocion');
|
||||
|
||||
Schema::table('promociones', function (Blueprint $table) {
|
||||
$table->foreignId('plantel_id')->constrained('plantels')->cascadeOnDelete();
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user