%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/vacivi36/core/database/migrations/
Upload File :
Create Path :
Current File : /home/vacivi36/core/database/migrations/2024_10_31_000007_create_vaccine_applications_table.php

<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateVaccineApplicationsTable extends Migration
{
    public function up()
    {
        Schema::create('vaccine_applications', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('schedule_id'); // Identificador do agendamento
            $table->unsignedBigInteger('vaccine_id'); // Identificador da vacina
            $table->unsignedBigInteger('user_id')->nullable(); // Identificador do user
            $table->date('application_date'); // Data da aplicação
            $table->integer('dose_number'); // Número da dose aplicada
            $table->boolean('is_applied')->nullable();
            $table->text('notes')->nullable(); // Observações sobre a aplicação
            $table->text('reason')->nullable(); // Motivo para caso o usuário não tenha aplicado a vacina no paciente
            $table->timestamps();
            $table->softDeletes();

            // Relacionamento com a tabela schedules
            $table->foreign('schedule_id')->references('id')->on('schedules')->onDelete('restrict');
            $table->foreign('vaccine_id')->references('id')->on('vaccines')->onDelete('restrict');
            $table->foreign('user_id')->references('id')->on('users')->onDelete('restrict');
        });
    }

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


Zerion Mini Shell 1.0