init commit
All checks were successful
build-api-image / build (push) Successful in 51s

This commit is contained in:
Antonio Lopes dos Santos
2026-08-04 16:52:02 -03:00
commit afec302c3e
11594 changed files with 1636728 additions and 0 deletions

View File

@@ -0,0 +1,53 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateViagemsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('transporte_paciente_viagem', function (Blueprint $table) {
$table->id();
$table->foreignId('condutor_id')->nullable()->references('id')->on('transporte_paciente_condutor');
$table->foreignId('veiculo_id')->nullable()->references('id')->on('transporte_paciente_veiculo');
$table->date('data')->nullable();
$table->time('horario_saida_temp')->nullable();
$table->time('horario_saida_real')->nullable();
$table->time('horario_chegada_destino')->nullable();
$table->time('horario_saida_destino')->nullable();
$table->date('data_chegada')->nullable();
$table->time('horario_chegada')->nullable();
$table->string('km_saida', 6)->nullable();
$table->string('km_chegada', 6)->nullable();
$table->decimal('diaria')->nullable();
$table->decimal('refeicao')->nullable();
$table->decimal('pernoite')->nullable();
$table->decimal('pedagio')->nullable();
$table->decimal('combustivel')->nullable();
$table->decimal('outras_despesas')->nullable();
$table->string('descricao_outras_despesas', 200)->nullable();
$table->decimal('total_despesa')->nullable();
$table->foreignId('situacao_id')->default(1);
$table->foreignId('jornada_id')->nullable()->references('id')->on('transporte_paciente_jornada');
$table->foreignId('destino_id')->nullable()->references('id')->on('transporte_paciente_destino');
MigrationUtil::addCommonFields($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('transporte_paciente_viagem');
}
}

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateTransportePacienteViagemStatusTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('transporte_paciente_viagem_status', function (Blueprint $table) {
$table->id();
$table->string('descricao');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('transporte_paciente_viagem_status');
}
}

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class RenameTransportePacienteViagemColumn extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('transporte_paciente_viagem', function(Blueprint $table) {
$table->renameColumn('situacao_id', 'status_id');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('transporte_paciente_viagem', function(Blueprint $table) {
$table->renameColumn('status_id', 'situacao_id');
});
}
}

View File

@@ -0,0 +1,48 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddCommonFieldsToTransportePacienteViagemStatusTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('transporte_paciente_viagem_status', function (Blueprint $table) {
$table->foreignId('created_lotacao_id')->nullable()->constrained('cadastro_lotacao');
$table->foreignId('updated_lotacao_id')->nullable()->constrained('cadastro_lotacao');
$table->foreignId('created_centro_custo_id')->nullable()->constrained('cadastro_centro_custo');
$table->foreignId('updated_centro_custo_id')->nullable()->constrained('cadastro_centro_custo');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('transporte_paciente_viagem_status', function (Blueprint $table) {
$table->dropForeign(['created_lotacao_id']);
$table->dropColumn(['created_lotacao_id']);
$table->dropForeign(['created_centro_custo_id']);
$table->dropColumn(['created_centro_custo_id']);
$table->dropForeign(['updated_lotacao_id']);
$table->dropColumn(['updated_lotacao_id']);
$table->dropForeign(['updated_centro_custo_id']);
$table->dropColumn(['updated_centro_custo_id']);
});
}
}

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddProtocoloIntoTransportePacienteViagemTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('transporte_paciente_viagem', function (Blueprint $table) {
$table->unsignedInteger('protocolo')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('transporte_paciente_viagem', function (Blueprint $table) {
$table->dropColumn('protocolo');
});
}
}

View File

@@ -0,0 +1,27 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
class AlterTransportePacienteViagemTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
DB::statement("UPDATE transporte_paciente_viagem SET protocolo = id WHERE status_id != 3;");
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
DB::statement("UPDATE transporte_paciente_viagem SET protocolo = NULL;");
}
}