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,38 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatePainelSenhaOpcaoEntradaTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('painel_senha_opcao_entrada', function (Blueprint $table) {
$table->id();
$table->foreignId('faixa_etaria_id')->nullable()->constrained('geral_faixa_etaria');
$table->string('nome', 100);
$table->string('sigla', 2);
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
$table->unique(['faixa_etaria_id', 'nome', 'sigla', 'deleted_at']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('painel_senha_opcao_entrada');
}
}

View File

@@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatePainelSenhaStatusTipoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('painel_senha_status_tipo', function (Blueprint $table) {
MigrationUtil::idWithoutIncrements($table);
$table->string('nome', 100)->unique();
MigrationUtil::addCommonFields($table, ['staticData' => true]);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('painel_senha_status_tipo');
}
}

View File

@@ -0,0 +1,38 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatePainelSenhaStatusTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('painel_senha_status', function (Blueprint $table) {
$table->id();
$table->foreignId('centro_custo_id')->constrained('cadastro_centro_custo');
$table->foreignId('tipo_id')->constrained('painel_senha_status_tipo');
$table->string('nome', 100);
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
$table->unique(['centro_custo_id', 'tipo_id']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('painel_senha_status');
}
}

View File

@@ -0,0 +1,38 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatePainelSenhaTempoEsperaTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('painel_senha_tempo_espera', function (Blueprint $table) {
MigrationUtil::idWithoutIncrements($table);
$table->string('cor', 100);
$table->smallInteger('tempo');
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
$table->unique(['cor', 'deleted_at']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('painel_senha_tempo_espera');
}
}

View File

@@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatePainelSenhaPrioridadeTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('painel_senha_prioridade', function (Blueprint $table) {
MigrationUtil::idWithoutIncrements($table);
$table->string('nome', 100)->unique();
MigrationUtil::addCommonFields($table, ['staticData' => true]);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('painel_senha_prioridade');
}
}

View File

@@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatePainelSenhaTelaTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('painel_senha_tela', function (Blueprint $table) {
$table->id();
$table->foreignId('infraestrutura_id')->constrained('cadastro_infraestrutura');
$table->string('nome', 100);
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
$table->unique(['infraestrutura_id', 'nome', 'deleted_at']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('painel_senha_tela');
}
}

View File

@@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatePainelSenhaEncaminhamentoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('painel_senha_encaminhamento', function (Blueprint $table) {
$table->id();
$table->foreignId('centro_custo_id_de')->constrained('cadastro_centro_custo');
$table->foreignId('centro_custo_id_para')->constrained('cadastro_centro_custo');
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
$table->unique(['centro_custo_id_de', 'centro_custo_id_para', 'deleted_at']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('painel_senha_encaminhamento');
}
}

View File

@@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatePainelSenhaOpcaoExibicaoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('painel_senha_opcao_exibicao', function (Blueprint $table) {
$table->id();
$table->foreignId('centro_custo_id')->constrained('cadastro_centro_custo');
$table->foreignId('status_id')->constrained('painel_senha_status');
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
$table->unique(['centro_custo_id', 'status_id', 'deleted_at']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('painel_senha_opcao_exibicao');
}
}

View File

@@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatePainelSenhaOpcaoAtendimentoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('painel_senha_opcao_atendimento', function (Blueprint $table) {
$table->id();
$table->foreignId('centro_custo_id')->constrained('cadastro_centro_custo');
$table->foreignId('status_id')->constrained('painel_senha_status');
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
$table->unique(['centro_custo_id', 'status_id', 'deleted_at']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('painel_senha_opcao_atendimento');
}
}

View File

@@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatePainelSenhaOpcaoChamadaTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('painel_senha_opcao_chamada', function (Blueprint $table) {
$table->id();
$table->foreignId('centro_custo_id')->constrained('cadastro_centro_custo');
$table->foreignId('tela_id')->constrained('painel_senha_tela');
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
$table->unique(['centro_custo_id', 'tela_id', 'deleted_at']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('painel_senha_opcao_chamada');
}
}

View File

@@ -0,0 +1,44 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatePainelSenhaFilaTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('painel_senha_fila', function (Blueprint $table) {
$table->id();
$table->foreignId('centro_custo_id')->constrained('cadastro_centro_custo');
$table->foreignId('opcao_entrada_id')->constrained('painel_senha_opcao_entrada');
$table->foreignId('prioridade_id')->nullable()->constrained('painel_senha_prioridade');
$table->foreignId('status_id')->constrained('painel_senha_status');
$table->unsignedInteger('senha');
$table->boolean('evadido')->default(false);
$table->text('motivo_evasao', 500)->nullable();
$table->text('motivo_cancelamento_evasao', 500)->nullable();
$table->boolean('finalizado')->default(false);
$table->date('emitido_em')->default(DB::raw('CURRENT_DATE'));
$table->timestamp('atualizado_em')->default(DB::raw('CURRENT_TIMESTAMP'));
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('painel_senha_fila');
}
}

View File

@@ -0,0 +1,45 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatePainelSenhaFilaHistoricoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('painel_senha_fila_historico', function (Blueprint $table) {
$table->id();
$table->foreignId('fila_id')->constrained('painel_senha_fila')->onDelete("cascade");
$table->foreignId('centro_custo_id')->constrained('cadastro_centro_custo');
$table->foreignId('opcao_entrada_id')->constrained('painel_senha_opcao_entrada');
$table->foreignId('prioridade_id')->nullable()->constrained('painel_senha_prioridade');
$table->foreignId('status_id')->constrained('painel_senha_status');
$table->unsignedInteger('senha');
$table->boolean('evadido');
$table->text('motivo_evasao', 500)->nullable();
$table->text('motivo_cancelamento_evasao', 500)->nullable();
$table->boolean('finalizado');
$table->date('emitido_em');
$table->timestamp('atualizado_em');
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('painel_senha_fila_historico');
}
}

View File

@@ -0,0 +1,38 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatePainelSenhaChamadaTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('painel_senha_chamada', function (Blueprint $table) {
$table->id();
$table->foreignId('fila_id')->constrained('painel_senha_fila');
$table->foreignId('status_id')->constrained('painel_senha_status');
$table->foreignId('tela_id')->constrained('painel_senha_tela');
$table->foreignId('sala_id')->nullable()->constrained('cadastro_sala');
$table->foreignId('paciente_id')->nullable()->constrained('cadastro_paciente');
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('painel_senha_chamada');
}
}

View File

@@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class DropPainelSenhaOpcaoAtendimentoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::dropIfExists('painel_senha_opcao_atendimento');
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::create('painel_senha_opcao_atendimento', function (Blueprint $table) {
$table->id();
$table->foreignId('centro_custo_id')->constrained('cadastro_centro_custo');
$table->foreignId('status_id')->constrained('painel_senha_status');
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
$table->unique(['centro_custo_id', 'status_id', 'deleted_at']);
});
}
}

View File

@@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class DropPainelSenhaOpcaoExibicaoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::dropIfExists('painel_senha_opcao_exibicao');
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::create('painel_senha_opcao_exibicao', function (Blueprint $table) {
$table->id();
$table->foreignId('centro_custo_id')->constrained('cadastro_centro_custo');
$table->foreignId('status_id')->constrained('painel_senha_status');
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
$table->unique(['centro_custo_id', 'status_id', 'deleted_at']);
});
}
}

View File

@@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddPrioridadeObrigatoriaIntoPainelSenhaOpcaoEntradaTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('painel_senha_opcao_entrada', function (Blueprint $table) {
$table->boolean('prioridade_obrigatoria')
->after('nome')
->default(false);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('painel_senha_opcao_entrada', function (Blueprint $table) {
$table->dropColumn('prioridade_obrigatoria');
});
}
}

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class DropUniqueFromPainelSenhaOpcaoEntradaTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('painel_senha_opcao_entrada', function (Blueprint $table) {
$table->dropForeign(['faixa_etaria_id']);
$table->dropUnique(['faixa_etaria_id', 'nome', 'sigla', 'deleted_at']);
$table->foreign('faixa_etaria_id')->references('id')->on('geral_faixa_etaria');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('painel_senha_opcao_entrada', function (Blueprint $table) {
$table->unique(['faixa_etaria_id', 'nome', 'sigla', 'deleted_at']);
});
}
}

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddCentroCustoIdIntoPainelSenhaOpcaoEntradaTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('painel_senha_opcao_entrada', function (Blueprint $table) {
$table->foreignId('centro_custo_id')->constrained('cadastro_centro_custo')->after('id');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('painel_senha_opcao_entrada', function (Blueprint $table) {
$table->dropForeign(['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 AddInfraestruturaIdIntoPainelSenhaTempoEsperaTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('painel_senha_tempo_espera', function (Blueprint $table) {
$table->foreignId('infraestrutura_id')->constrained('cadastro_infraestrutura')->after('id');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('painel_senha_tempo_espera', function (Blueprint $table) {
$table->dropForeign(['infraestrutura_id']);
});
}
}

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddUniqueIntoPainelSenhaOpcaoEntradaTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('painel_senha_opcao_entrada', function (Blueprint $table) {
$table->unique(['centro_custo_id', 'faixa_etaria_id', 'nome', 'sigla', 'deleted_at']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('painel_senha_opcao_entrada', function (Blueprint $table) {
$table->dropUnique(['centro_custo_id', 'faixa_etaria_id', 'nome', 'sigla', 'deleted_at']);
});
}
}

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class DropUniqueFromPainelSenhaTempoEsperaTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('painel_senha_tempo_espera', function (Blueprint $table) {
$table->dropUnique(['cor', 'deleted_at']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('painel_senha_tempo_espera', function (Blueprint $table) {
$table->unique(['cor', 'deleted_at']);
});
}
}

View File

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

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddIdIntoPainelSenhaTempoEsperaTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('painel_senha_tempo_espera', function (Blueprint $table) {
$table->id();
$table->unique(['infraestrutura_id', 'tempo', 'deleted_at']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('painel_senha_tempo_espera', function (Blueprint $table) {
$table->dropColumn('id');
$table->dropUnique(['infraestrutura_id', 'tempo', 'deleted_at']);
});
}
}

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddPacienteIdIntoPainelSenhaFilaTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('painel_senha_fila', function (Blueprint $table) {
$table->foreignId('paciente_id')->nullable()->after('status_id')->constrained('cadastro_paciente');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('painel_senha_fila', function (Blueprint $table) {
$table->dropForeign(['paciente_id']);
});
}
}

View File

@@ -0,0 +1,60 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AlterUniqueFromPainelSenhaStatus extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('painel_senha_status', function (Blueprint $table) {
$table->dropForeign(['tipo_id']);
$table->dropForeign(['centro_custo_id']);
$table->dropUnique(['centro_custo_id', 'tipo_id']);
$table->foreign('centro_custo_id')
->on('cadastro_centro_custo')
->references('id');
$table->foreign('tipo_id')
->on('painel_senha_status_tipo')
->references('id');
$table->unique(['centro_custo_id', 'tipo_id', 'deleted_at']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('painel_senha_status', function (Blueprint $table) {
$table->dropForeign(['tipo_id']);
$table->dropForeign(['centro_custo_id']);
$table->dropUnique(['centro_custo_id', 'tipo_id', 'deleted_at']);
$table->foreign('centro_custo_id')
->on('cadastro_centro_custo')
->references('id');
$table->foreign('tipo_id')
->on('painel_senha_status_tipo')
->references('id');
$table->unique(['centro_custo_id', 'tipo_id']);
});
}
}

View File

@@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddReabertoEmReaberturaLotacaoIdToPainelSenhaFila extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('painel_senha_fila', function (Blueprint $table) {
$table->timestamp('reaberto_em')->nullable()->after('atualizado_em');
$table->foreignId('reabertura_lotacao_id')->nullable()->after('reaberto_em')->constrained('cadastro_lotacao');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('painel_senha_fila', function (Blueprint $table) {
$table->dropColumn('reaberto_em');
MigrationUtil::dropColumnWithForeign($table, 'reabertura_lotacao_id');
});
}
}

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddModuloIdToPainelSenhaOpcaoEntradaTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('painel_senha_opcao_entrada', function (Blueprint $table) {
$table->foreignId('modulo_id')->constrained('administracao_modulo');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('painel_senha_opcao_entrada', function (Blueprint $table) {
MigrationUtil::dropColumnWithForeign($table, 'modulo_id');
});
}
}

View File

@@ -0,0 +1,55 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddUniqueWithModuloToPainelSenhaOpcaoEntradaTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('painel_senha_opcao_entrada', function (Blueprint $table) {
$table->dropForeign(['centro_custo_id']);
$table->dropForeign(['faixa_etaria_id']);
$table->dropUnique(['centro_custo_id', 'faixa_etaria_id', 'nome', 'sigla', 'deleted_at']);
$table->foreign('centro_custo_id')->references('id')->on('cadastro_centro_custo');
$table->foreign('faixa_etaria_id')->references('id')->on('geral_faixa_etaria');
$table->unique(
['centro_custo_id', 'modulo_id', 'faixa_etaria_id', 'nome', 'sigla', 'deleted_at'],
'pai_sen_opc_ent_cen_cus_id_mod_id_fai_eta_id_nom_sig_del_unique'
);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('painel_senha_opcao_entrada', function (Blueprint $table) {
$table->dropForeign(['centro_custo_id']);
$table->dropForeign(['modulo_id']);
$table->dropForeign(['faixa_etaria_id']);
$table->dropUnique('pai_sen_opc_ent_cen_cus_id_mod_id_fai_eta_id_nom_sig_del_unique');
$table->foreign('centro_custo_id')->references('id')->on('cadastro_centro_custo');
$table->foreign('modulo_id')->references('id')->on('administracao_modulo');
$table->foreign('faixa_etaria_id')->references('id')->on('geral_faixa_etaria');
$table->unique(['centro_custo_id', 'faixa_etaria_id', 'nome', 'sigla', 'deleted_at']);
});
}
}

View File

@@ -0,0 +1,42 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
class AddGrauToPainelSenhaPrioridadeTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('painel_senha_prioridade', function (Blueprint $table) {
$table->unsignedSmallInteger('grau')->default(0)->nullable()->after('nome');
});
DB::statement("UPDATE painel_senha_prioridade SET grau = 0;");
Schema::table('painel_senha_prioridade', function (Blueprint $table) {
$table->unsignedSmallInteger('grau')->nullable(false)->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('painel_senha_prioridade', function (Blueprint $table) {
$table->dropColumn('grau');
});
}
}

View File

@@ -0,0 +1,55 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddLogFieldsOnPainelSenhaPrioridade extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('painel_senha_prioridade', function (Blueprint $table) {
$table->unsignedBigInteger('created_lotacao_id')->nullable();
$table->foreign('created_lotacao_id', $foreignNames['created_lotacao_id'] ?? null)
->references('id')->on('cadastro_lotacao');
$table->unsignedBigInteger('created_centro_custo_id')->nullable();
$table->foreign('created_centro_custo_id', $foreignNames['created_centro_custo_id'] ?? null)
->references('id')->on('cadastro_centro_custo');
$table->unsignedBigInteger('updated_lotacao_id')->nullable();
$table->foreign('updated_lotacao_id', $foreignNames['updated_lotacao_id'] ?? null)
->references('id')->on('cadastro_lotacao');
$table->unsignedBigInteger('updated_centro_custo_id')->nullable();
$table->foreign('updated_centro_custo_id', $foreignNames['updated_centro_custo_id'] ?? null)
->references('id')->on('cadastro_centro_custo');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('painel_senha_prioridade', function (Blueprint $table) {
MigrationUtil::dropColumnWithForeign($table, 'created_lotacao_id');
MigrationUtil::dropColumnWithForeign($table, 'created_centro_custo_id');
MigrationUtil::dropColumnWithForeign($table, 'updated_lotacao_id');
MigrationUtil::dropColumnWithForeign($table, 'updated_centro_custo_id');
});
}
}

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatePainelSenhaParametrizacaoInfraestruturaTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('painel_senha_parametrizacao_infraestrutura', function (Blueprint $table) {
$table->id();
$table->foreignId('infraestrutura_id')->constrained('cadastro_infraestrutura');
MigrationUtil::addCommonFields($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('painel_senha_parametrizacao_infraestrutura');
}
}

View File

@@ -0,0 +1,39 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatePainelSenhaParametrizacaoInfraestruturaModuloTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('painel_senha_parametrizacao_infraestrutura_modulo', function (Blueprint $table) {
$table->foreignId('parametrizacao_infraestrutura_id')
->constrained('painel_senha_parametrizacao_infraestrutura')
->onDelete('cascade');
$table->foreignId('modulo_id')->constrained('administracao_modulo');
$table->primary(['parametrizacao_infraestrutura_id', 'modulo_id']);
MigrationUtil::addCommonFields($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('painel_senha_parametrizacao_infraestrutura_modulo');
}
}

View File

@@ -0,0 +1,39 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatePainelSenhaAvisoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('painel_senha_aviso', function (Blueprint $table) {
$table->id();
$table->string('mensagem', 140);
$table->boolean('is_ativo')->default(true);
$table->date('data_inicial');
$table->date('data_final');
$table->string('dias_semana')->nullable();
$table->time('hora_inicial');
$table->time('hora_final');
$table->integer('intervalo');
MigrationUtil::addCommonFields($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('painel_senha_aviso');
}
}

View File

@@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatePainelSenhaAvisoAgendamentoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('painel_senha_aviso_agendamento', function (Blueprint $table) {
$table->id();
$table->foreignId('aviso_id')->constrained('painel_senha_aviso');
$table->dateTime('data_hora_agendada')->nullable();
$table->dateTime('data_hora_executada')->nullable();
$table->boolean('is_envio_manual')->default(false);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('painel_senha_aviso_agendamento');
}
}

View File

@@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatePainelSenhaAvisoUnidadeTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('painel_senha_aviso_unidade', function (Blueprint $table) {
$table->id();
$table->foreignId('aviso_id')->constrained('painel_senha_aviso');
$table->foreignId('unidade_id')->constrained('cadastro_unidade');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('painel_senha_aviso_unidade');
}
}

View File

@@ -0,0 +1,147 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
class UpdatePainelSenhaStatusTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('painel_senha_fila', function (Blueprint $table) {
$table->dropForeign(['status_id']);
});
Schema::table('painel_senha_fila_historico', function (Blueprint $table) {
$table->dropForeign(['status_id']);
});
Schema::table('painel_senha_chamada', function (Blueprint $table) {
$table->dropForeign(['status_id']);
});
DB::table('painel_senha_fila')
->join('painel_senha_status', 'painel_senha_status.id', 'painel_senha_fila.status_id')
->update(['painel_senha_fila.status_id' => DB::raw('painel_senha_status.tipo_id')]);
DB::table('painel_senha_fila_historico')
->join('painel_senha_status', 'painel_senha_status.id', 'painel_senha_fila_historico.status_id')
->update(['painel_senha_fila_historico.status_id' => DB::raw('painel_senha_status.tipo_id')]);
DB::table('painel_senha_chamada')
->join('painel_senha_status', 'painel_senha_status.id', 'painel_senha_chamada.status_id')
->update(['painel_senha_chamada.status_id' => DB::raw('painel_senha_status.tipo_id')]);
Schema::dropIfExists('painel_senha_status');
Schema::rename('painel_senha_status_tipo', 'painel_senha_status');
Schema::table('painel_senha_fila', function (Blueprint $table) {
$table->foreign('status_id')->references('id')->on('painel_senha_status');
});
Schema::table('painel_senha_fila_historico', function (Blueprint $table) {
$table->foreign('status_id')->references('id')->on('painel_senha_status');
});
Schema::table('painel_senha_chamada', function (Blueprint $table) {
$table->foreign('status_id')->references('id')->on('painel_senha_status');
});
DB::table('administracao_lotacao_permissao_historico')
->whereExists(function($query) {
$query->select(DB::raw(1))
->from('administracao_permissao')
->join('administracao_funcionalidade', 'administracao_funcionalidade.id', 'administracao_permissao.funcionalidade_id')
->join('administracao_modulo', 'administracao_modulo.id', 'administracao_funcionalidade.modulo_id')
->where('administracao_modulo.identificador', 'painel-senha')
->where('administracao_funcionalidade.identificador', 'status')
->whereColumn('administracao_permissao.id', 'administracao_lotacao_permissao_historico.permissao_id');
})
->delete();
DB::table('administracao_papel_permissao_historico')
->whereExists(function($query) {
$query->select(DB::raw(1))
->from('administracao_permissao')
->join('administracao_funcionalidade', 'administracao_funcionalidade.id', 'administracao_permissao.funcionalidade_id')
->join('administracao_modulo', 'administracao_modulo.id', 'administracao_funcionalidade.modulo_id')
->where('administracao_modulo.identificador', 'painel-senha')
->where('administracao_funcionalidade.identificador', 'status')
->whereColumn('administracao_permissao.id', 'administracao_papel_permissao_historico.permissao_id');
})
->delete();
DB::table('administracao_lotacao_permissao')
->whereExists(function($query) {
$query->select(DB::raw(1))
->from('administracao_permissao')
->join('administracao_funcionalidade', 'administracao_funcionalidade.id', 'administracao_permissao.funcionalidade_id')
->join('administracao_modulo', 'administracao_modulo.id', 'administracao_funcionalidade.modulo_id')
->where('administracao_modulo.identificador', 'painel-senha')
->where('administracao_funcionalidade.identificador', 'status')
->whereColumn('administracao_permissao.id', 'administracao_lotacao_permissao.permissao_id');
})
->delete();
DB::table('administracao_papel_permissao')
->whereExists(function($query) {
$query->select(DB::raw(1))
->from('administracao_permissao')
->join('administracao_funcionalidade', 'administracao_funcionalidade.id', 'administracao_permissao.funcionalidade_id')
->join('administracao_modulo', 'administracao_modulo.id', 'administracao_funcionalidade.modulo_id')
->where('administracao_modulo.identificador', 'painel-senha')
->where('administracao_funcionalidade.identificador', 'status')
->whereColumn('administracao_permissao.id', 'administracao_papel_permissao.permissao_id');
})
->delete();
DB::table('administracao_permissao')
->whereExists(function($query) {
$query->select(DB::raw(1))
->from('administracao_funcionalidade')
->join('administracao_modulo', 'administracao_modulo.id', 'administracao_funcionalidade.modulo_id')
->where('administracao_modulo.identificador', 'painel-senha')
->where('administracao_funcionalidade.identificador', 'status')
->whereColumn('administracao_funcionalidade.id', 'administracao_permissao.funcionalidade_id');
})
->delete();
DB::table('administracao_menu')
->whereExists(function($query) {
$query->select(DB::raw(1))
->from('administracao_funcionalidade')
->join('administracao_modulo', 'administracao_modulo.id', 'administracao_funcionalidade.modulo_id')
->where('administracao_modulo.identificador', 'painel-senha')
->where('administracao_funcionalidade.identificador', 'status')
->whereColumn('administracao_funcionalidade.id', 'administracao_menu.funcionalidade_id');
})
->delete();
DB::table('administracao_funcionalidade')
->whereExists(function($query) {
$query->select(DB::raw(1))
->from('administracao_modulo')
->where('administracao_modulo.nome', 'Painel de senha')
->whereColumn('administracao_modulo.id', 'administracao_funcionalidade.modulo_id');
})
->where('administracao_funcionalidade.identificador', 'status')
->delete();
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatePainelSenhaCentroCustoCompartilhadoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('painel_senha_centro_custo_compartilhado', function (Blueprint $table) {
$table->id();
$table->foreignId('opcao_entrada_id')->constrained('painel_senha_opcao_entrada');
$table->foreignId('centro_custo_id')->constrained('cadastro_centro_custo');
MigrationUtil::addCommonFields($table);
$table->unique(['opcao_entrada_id', 'centro_custo_id']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('painel_senha_centro_custo_compartilhado');
}
}

View File

@@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatePainelSenhaOpcaoEntradaDestinoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('painel_senha_opcao_entrada_destino', function (Blueprint $table) {
$table->id();
$table->foreignId('opcao_entrada_origem_id')->constrained('painel_senha_opcao_entrada');
$table->foreignId('opcao_entrada_destino_id')->constrained('painel_senha_opcao_entrada');
MigrationUtil::addCommonFields($table);
$table->unique(['opcao_entrada_origem_id', 'opcao_entrada_destino_id']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('painel_senha_opcao_entrada_destino');
}
}

View File

@@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddOpcaoEntradaDestinoIdToPainelSenhaFila extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('painel_senha_fila', function (Blueprint $table) {
$table->foreignId('opcao_entrada_destino_id')
->nullable()
->after('opcao_entrada_id')
->constrained('painel_senha_opcao_entrada');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('painel_senha_fila', function (Blueprint $table) {
$table->dropConstrainedForeignId('opcao_entrada_destino_id');
});
}
}

View File

@@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddOpcaoEntradaDestinoIdToPainelSenhaFilaHistorico extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('painel_senha_fila_historico', function (Blueprint $table) {
$table->foreignId('opcao_entrada_destino_id')
->nullable()
->after('opcao_entrada_id')
->constrained('painel_senha_opcao_entrada');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('painel_senha_fila_historico', function (Blueprint $table) {
$table->dropConstrainedForeignId('opcao_entrada_destino_id');
});
}
}

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatePainelSenhaPrioridadeTipoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('painel_senha_prioridade_tipo', function (Blueprint $table) {
MigrationUtil::idWithoutIncrements($table);
$table->string('nome', 100)->unique();
MigrationUtil::addCommonFields($table, ['staticData' => true]);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('painel_senha_prioridade_tipo');
}
}

View File

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

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddTipoIdToPainelSenhaPrioridadeTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('painel_senha_prioridade', function (Blueprint $table) {
$table->foreignId('tipo_id')->nullable()->after('id')->constrained('painel_senha_prioridade_tipo');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('painel_senha_prioridade', function (Blueprint $table) {
$table->dropConstrainedForeignId('tipo_id');
});
}
}