HEX
Server: Apache/2.4.58 (Ubuntu)
System: Linux Bradford-Sitios 6.14.0-1017-azure #17~24.04.1-Ubuntu SMP Mon Dec 1 20:10:50 UTC 2025 x86_64
User: www-data (33)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/api_matriculas/database/migrations/2025_09_30_185711_create_postulations_table.php
<?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('postulations', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('code_postulation')->nullable();

            // 🔹 Estudiante
            $table->string('student_first_name')->nullable();
            $table->string('student_second_name')->nullable();
            $table->string('student_last_name')->nullable();
            $table->string('student_second_last_name')->nullable();
            $table->string('student_rut', 20)->nullable();
            $table->string('student_email')->nullable();
            $table->string('student_mobile', 20)->nullable();
            $table->date('student_birthdate')->nullable();
            $table->unsignedBigInteger('student_gender_id')->nullable();
            $table->unsignedBigInteger('student_country_id')->nullable();
            $table->unsignedBigInteger('student_region_id')->nullable();
            $table->unsignedBigInteger('student_commune_id')->nullable();
            $table->string('student_address')->nullable();

            // 🔹 Apoderado
            $table->unsignedBigInteger('parent_relationship_id')->nullable();
            $table->string('parent_first_name')->nullable();
            $table->string('parent_second_name')->nullable();
            $table->string('parent_last_name')->nullable();
            $table->string('parent_second_last_name')->nullable();
            $table->string('parent_rut', 20)->nullable();
            $table->string('parent_email')->nullable();
            $table->string('parent_mobile', 20)->nullable();
            $table->unsignedBigInteger('parent_gender_id')->nullable();
            $table->string('parent_profession')->nullable();
            $table->unsignedBigInteger('parent_country_id')->nullable();
            $table->unsignedBigInteger('parent_region_id')->nullable();
            $table->unsignedBigInteger('parent_commune_id')->nullable();
            $table->string('parent_address')->nullable();

            // 🔹 Información académica
            $table->unsignedBigInteger('course_id')->nullable();
            $table->string('previous_school')->nullable();
            $table->integer('siblings')->default(0);
            $table->text('special_needs')->nullable();
            $table->date('date_entry')->nullable();

            // 🔹 Estado / control
            $table->unsignedBigInteger('status_postulation_id')->nullable();
            $table->unsignedBigInteger('period_id')->nullable();
            $table->boolean('deleted')->default(false);
            $table->boolean('status')->default(true);
            $table->timestamps();

            // 🔹 Auditoría
            $table->unsignedBigInteger('user_created')->nullable();
            $table->unsignedBigInteger('user_updated')->nullable();

            // 🔹 Llaves foráneas
            $table->foreign('student_gender_id')->references('id')->on('genders');
            $table->foreign('student_country_id')->references('id')->on('countries');
            $table->foreign('student_region_id')->references('id')->on('regions');
            $table->foreign('student_commune_id')->references('id')->on('communes');

            $table->foreign('parent_relationship_id')->references('id')->on('relationships');
            $table->foreign('parent_gender_id')->references('id')->on('genders');
            $table->foreign('parent_country_id')->references('id')->on('countries');
            $table->foreign('parent_region_id')->references('id')->on('regions');
            $table->foreign('parent_commune_id')->references('id')->on('communes');

            $table->foreign('course_id')->references('id')->on('courses');
            $table->foreign('status_postulation_id')->references('id')->on('status_postulation');
            $table->foreign('period_id')->references('id')->on('periods');
        });
    }

    public function down(): void
    {
        Schema::dropIfExists('postulations');
    }
};