%PDF- %PDF-
| Direktori : /home/vacivi36/core/database/migrations/ |
| Current File : /home/vacivi36/core/database/migrations/2024_10_30_000003_create_patients_table.php |
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatePatientsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('patients', function (Blueprint $table) {
$table->id();
$table->string('name'); // Nome do paciente
$table->string('cpf')->unique(); // CPF do paciente
$table->date('date_of_birth')->nullable(); // Data de nascimento
$table->text('notes')->nullable(); // Observações
$table->string('postal_code')->nullable(); // CEP
$table->string('address'); // Logradouro
$table->string('district')->nullable(); // Bairro
$table->string('address_number')->nullable(); // Número
$table->string('address_complement')->nullable(); // Complemento
$table->string('city'); // Cidade
$table->string('phone')->nullable(); // Telefone fixo
$table->string('mobile')->nullable(); // Celular
$table->string('email')->unique()->nullable(); // Email
$table->unsignedBigInteger('company_id')->nullable();
$table->timestamps(); // Created at e updated at
$table->softDeletes();
$table->foreign('company_id')->references('id')->on('companies')->onDelete('restrict');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('patients');
}
}