This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateImunizacaoSalaVacinacaoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('imunizacao_sala_vacinacao', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
$table->foreignId('infraestrutura_id')->constrained('cadastro_infraestrutura');
|
||||
$table->boolean('responsavel')->default(false);
|
||||
$table->boolean('permite_aplicacao')->default(false);
|
||||
$table->boolean('cria_ficha_ab')->default(false);
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('imunizacao_sala_vacinacao');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateImunizacaoParametrizacaoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('imunizacao_parametrizacao', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
$table->boolean('usa_esquema_vacinal');
|
||||
$table->boolean('considera_apenas_idade_minima');
|
||||
$table->boolean('perfil_campanha');
|
||||
$table->boolean('usa_ultimo_frasco');
|
||||
$table->integer('aprazamento_dias_antes')->nullable();
|
||||
$table->integer('aprazamento_dias_depois')->nullable();
|
||||
$table->boolean('aprazamento_ativo');
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('imunizacao_parametrizacao');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateImunizacaoParametrizacaoDescricaoVacinaTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('imunizacao_parametrizacao_descricao_vacina', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
$table->string('nome', 100);
|
||||
|
||||
MigrationUtil::addCommonFields($table, ['staticData' => true]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('imunizacao_parametrizacao_descricao_vacina');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateImunizacaoParametrizacaoOcupacaoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('imunizacao_parametrizacao_ocupacao', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
$table->foreignId('ocupacao_id')->constrained('sigtap.ocupacao');
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('imunizacao_parametrizacao_ocupacao');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateImunizacaoParametrizacaoSupervisorTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('imunizacao_parametrizacao_supervisor', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
$table->foreignId('usuario_id')->constrained('cadastro_usuario');
|
||||
$table->foreignId('sala_vacinacao_id')->constrained('imunizacao_sala_vacinacao');
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('imunizacao_parametrizacao_supervisor');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateImunizacaoParametrizacaoAplicadorTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('imunizacao_parametrizacao_aplicador', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
$table->foreignId('usuario_id')->constrained('cadastro_usuario');
|
||||
$table->foreignId('sala_vacinacao_id')->constrained('imunizacao_sala_vacinacao');
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('imunizacao_parametrizacao_aplicador');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateImunizacaoParametrizacaoExportacaoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('imunizacao_parametrizacao_exportacao', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
$table->integer('codigo_sistema');
|
||||
$table->string('sigla_sistema', 100);
|
||||
$table->string('senha_arquivo', 100);
|
||||
|
||||
MigrationUtil::addCommonFields($table, ['staticData' => true]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('imunizacao_parametrizacao_exportacao');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateImunizacaoProdutorTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('imunizacao_produtor', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
$table->integer('codigo')->unique();
|
||||
$table->string('nome', 100);
|
||||
$table->string('abreviacao', 50);
|
||||
|
||||
MigrationUtil::addCommonFields($table, ['staticData' => true]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('imunizacao_produtor');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateImunizacaoApresentacaoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('imunizacao_apresentacao', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
$table->integer('codigo')->unique();
|
||||
$table->string('nome', 100);
|
||||
|
||||
MigrationUtil::addCommonFields($table, ['staticData' => true]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('imunizacao_apresentacao');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateImunizacaoVacinaProdutorApresentacaoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('imunizacao_vacina_produtor_apresentacao', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
$table->foreignId('vacina_id')->constrained('cadastro_vacina');
|
||||
$table->foreignId('produtor_id')->constrained('imunizacao_produtor');
|
||||
$table->foreignId('apresentacao_id')->constrained('imunizacao_apresentacao');
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('imunizacao_vacina_produtor_apresentacao');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateImunizacaoEntradaTipoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('imunizacao_entrada_tipo', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
$table->string('nome', 100)->unique();
|
||||
|
||||
MigrationUtil::addCommonFields($table, ['staticData' => true]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('imunizacao_entrada_tipo');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateImunizacaoEntradaTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('imunizacao_entrada', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
$table->foreignId('tipo_id')->constrained('imunizacao_entrada_tipo');
|
||||
$table->foreignId('sala_vacinacao_id')->constrained('imunizacao_sala_vacinacao');
|
||||
$table->date('data_entrada');
|
||||
$table->string('origem', 100)->nullable();
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('imunizacao_entrada');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateImunizacaoEntradaVacinaTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('imunizacao_entrada_vacina', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
$table->foreignId('entrada_id')->constrained('imunizacao_entrada');
|
||||
$table->foreignId('vacina_id')->constrained('cadastro_vacina');
|
||||
$table->foreignId('produtor_id')->constrained('imunizacao_produtor');
|
||||
$table->foreignId('apresentacao_id')->constrained('imunizacao_apresentacao');
|
||||
$table->integer('quantidade');
|
||||
$table->string('lote', 30);
|
||||
$table->date('data_validade_lote');
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('imunizacao_entrada_vacina');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateImunizacaoSaidaTipoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('imunizacao_saida_tipo', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
$table->string('nome', 100)->unique();
|
||||
|
||||
MigrationUtil::addCommonFields($table, ['staticData' => true]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('imunizacao_saida_tipo');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateImunizacaoSaidaMotivoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('imunizacao_saida_motivo', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
$table->string('nome', 100)->unique();
|
||||
|
||||
MigrationUtil::addCommonFields($table, ['staticData' => true]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('imunizacao_saida_motivo');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateImunizacaoSaidaTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('imunizacao_saida', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
$table->foreignId('tipo_id')->constrained('imunizacao_saida_tipo');
|
||||
$table->foreignId('sala_vacinacao_id')->constrained('imunizacao_sala_vacinacao');
|
||||
$table->foreignId('motivo_id')->nullable()->constrained('imunizacao_saida_motivo');
|
||||
$table->string('motivo_indisponibilidade', 100)->nullable();
|
||||
$table->text('observacao', 300)->nullable();
|
||||
$table->date('data_saida');
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('imunizacao_saida');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateImunizacaoSaidaVacinaTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('imunizacao_saida_vacina', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
$table->foreignId('saida_id')->constrained('imunizacao_saida');
|
||||
$table->foreignId('entrada_vacina_id')->constrained('imunizacao_entrada_vacina');
|
||||
$table->foreignId('vacina_id')->constrained('cadastro_vacina');
|
||||
$table->integer('quantidade');
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('imunizacao_saida_vacina');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddSaidaVacinaIdToImunizacaoEntradaVacinaTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('imunizacao_entrada_vacina', function (Blueprint $table) {
|
||||
$table->foreignId('saida_vacina_id')->nullable()->after('entrada_id')->constrained('imunizacao_saida_vacina');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('imunizacao_entrada_vacina', function (Blueprint $table) {
|
||||
$table->dropForeign(['saida_vacina_id']);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateImunizacaoRequisicaoStatusTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('imunizacao_requisicao_status', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
$table->string('nome', 100)->unique();
|
||||
|
||||
MigrationUtil::addCommonFields($table, ['staticData' => true]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('imunizacao_requisicao_status');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateImunizacaoRequisicaoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('imunizacao_requisicao', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
$table->foreignId('status_id')->constrained('imunizacao_requisicao_status');
|
||||
$table->foreignId('sala_vacinacao_id_de')->constrained('imunizacao_sala_vacinacao');
|
||||
$table->foreignId('sala_vacinacao_id_para')->constrained('imunizacao_sala_vacinacao');
|
||||
$table->date('data_requisicao');
|
||||
$table->string('codigo', 14);
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('imunizacao_requisicao');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateImunizacaoRequisicaoVacinaMotivoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('imunizacao_requisicao_vacina_motivo', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
$table->string('nome', 100)->unique();
|
||||
|
||||
MigrationUtil::addCommonFields($table, ['staticData' => true]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('imunizacao_requisicao_vacina_motivo');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateImunizacaoRequisicaoVacinaTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('imunizacao_requisicao_vacina', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
$table->foreignId('requisicao_id')->constrained('imunizacao_requisicao');
|
||||
$table->foreignId('vacina_id')->constrained('cadastro_vacina');
|
||||
$table->foreignId('motivo_id')->nullable()->constrained('imunizacao_requisicao_vacina_motivo');
|
||||
$table->integer('quantidade');
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('imunizacao_requisicao_vacina');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddRequisicaoVacinaIdToImunizacaoSaidaVacinaTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('imunizacao_saida_vacina', function (Blueprint $table) {
|
||||
$table->foreignId('requisicao_vacina_id')->nullable()->after('entrada_vacina_id')->constrained('imunizacao_requisicao_vacina');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('imunizacao_saida_vacina', function (Blueprint $table) {
|
||||
$table->dropForeign(['requisicao_vacina_id']);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateImunizacaoDoseTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('imunizacao_dose', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
$table->string('nome', 100)->unique();
|
||||
$table->string('sigla', 100);
|
||||
|
||||
MigrationUtil::addCommonFields($table, ['staticData' => true]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('imunizacao_dose');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateImunizacaoGrupoAtendimentoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('imunizacao_grupo_atendimento', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
$table->string('nome', 100)->unique();
|
||||
|
||||
MigrationUtil::addCommonFields($table, ['staticData' => true]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('imunizacao_grupo_atendimento');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateImunizacaoEstrategiaTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('imunizacao_estrategia', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
$table->string('nome', 100)->unique();
|
||||
|
||||
MigrationUtil::addCommonFields($table, ['staticData' => true]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('imunizacao_estrategia');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateImunizacaoFaixaEtariaTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('imunizacao_faixa_etaria', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
$table->integer('inicio_ano');
|
||||
$table->integer('fim_ano');
|
||||
$table->integer('inicio_mes');
|
||||
$table->integer('fim_mes');
|
||||
$table->integer('inicio_dia');
|
||||
$table->integer('fim_dia');
|
||||
|
||||
MigrationUtil::addCommonFields($table, ['staticData' => true]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('imunizacao_faixa_etaria');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateImunizacaoEsquemaTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('imunizacao_esquema', function (Blueprint $table) {
|
||||
$table->foreignId('vacina_id')->constrained('cadastro_vacina');
|
||||
$table->foreignId('dose_id')->constrained('imunizacao_dose');
|
||||
$table->foreignId('faixa_etaria_id')->constrained('imunizacao_faixa_etaria');
|
||||
$table->foreignId('estrategia_id')->constrained('imunizacao_estrategia');
|
||||
|
||||
$table->unique(['vacina_id', 'dose_id', 'faixa_etaria_id', 'estrategia_id']);
|
||||
|
||||
MigrationUtil::addCommonFields($table, ['staticData' => true]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('imunizacao_esquema');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateImunizacaoExportacaoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('imunizacao_exportacao', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
$table->foreignId('usuario_id')->constrained('cadastro_usuario');
|
||||
$table->integer('mes');
|
||||
$table->integer('ano');
|
||||
$table->string('arquivo', 200);
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('imunizacao_exportacao');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateImunizacaoCampanhaTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('imunizacao_campanha', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
$table->foreignId('vacina_id')->constrained('cadastro_vacina');
|
||||
$table->string('nome', 100);
|
||||
$table->date('periodo_de');
|
||||
$table->date('periodo_ate');
|
||||
$table->integer('meta');
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('imunizacao_campanha');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateImunizacaoCampanhaPopulacaoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('imunizacao_campanha_populacao', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
$table->foreignId('campanha_id')->constrained('imunizacao_campanha');
|
||||
$table->foreignId('idade_inicial_medida_tempo_id')->constrained('geral_medida_tempo');
|
||||
$table->foreignId('idade_final_medida_tempo_id')->constrained('geral_medida_tempo');
|
||||
$table->foreignId('sexo_id')->nullable()->onstrained('cadastro_sexo');
|
||||
$table->integer('idade_inicial');
|
||||
$table->integer('idade_final');
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('imunizacao_campanha_populacao');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateImunizacaoRegistroAplicacaoMotivoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('imunizacao_registro_aplicacao_motivo', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
$table->string('nome', 200);
|
||||
|
||||
MigrationUtil::addCommonFields($table, ['staticData' => true]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('imunizacao_registro_aplicacao_motivo');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateImunizacaoRegistroAplicacaoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('imunizacao_registro_aplicacao', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
$table->foreignId('paciente_id')->constrained('cadastro_paciente');
|
||||
$table->foreignId('saida_vacina_id')->constrained('imunizacao_saida_vacina');
|
||||
$table->foreignId('aplicador_id')->constrained('cadastro_usuario');
|
||||
$table->foreignId('grupo_atendimento_id')->constrained('imunizacao_grupo_atendimento');
|
||||
$table->foreignId('dose_id')->constrained('imunizacao_dose');
|
||||
$table->foreignId('estrategia_id')->constrained('imunizacao_estrategia');
|
||||
$table->foreignId('motivo_id')->nullable()->constrained('imunizacao_registro_aplicacao_motivo');
|
||||
$table->foreignId('campanha_id')->nullable()->constrained('imunizacao_campanha');
|
||||
$table->foreignId('exportacao_id')->nullable()->constrained('imunizacao_exportacao');
|
||||
$table->date('data_aplicacao');
|
||||
$table->boolean('comunicante_hanseniase')->default(false);
|
||||
$table->boolean('gestante')->default(false);
|
||||
$table->boolean('puerpera')->default(false);
|
||||
$table->boolean('imunizacao_advertida')->default(false);
|
||||
$table->boolean('viajante')->default(false);
|
||||
$table->boolean('ultimo_frasco')->default(false);
|
||||
$table->text('observacao', 5000)->nullable();
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('imunizacao_registro_aplicacao');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateImunizacaoRegistroAtualizacaoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('imunizacao_registro_atualizacao', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
$table->foreignId('paciente_id')->constrained('cadastro_paciente');
|
||||
$table->foreignId('sala_vacinacao_id')->constrained('imunizacao_sala_vacinacao');
|
||||
$table->foreignId('aplicador_id')->constrained('cadastro_usuario');
|
||||
$table->foreignId('vacina_id')->constrained('cadastro_vacina');
|
||||
$table->foreignId('grupo_atendimento_id')->constrained('imunizacao_grupo_atendimento');
|
||||
$table->foreignId('dose_id')->constrained('imunizacao_dose');
|
||||
$table->foreignId('estrategia_id')->constrained('imunizacao_estrategia');
|
||||
$table->foreignId('exportacao_id')->nullable()->constrained('imunizacao_exportacao');
|
||||
$table->date('data_atualizacao');
|
||||
$table->string('lote', 30);
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('imunizacao_registro_atualizacao');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateImunizacaoRegistroAprazamentoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('imunizacao_registro_aprazamento', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
$table->foreignId('registro_aplicacao_id')->nullable()->constrained('imunizacao_registro_aplicacao');
|
||||
$table->foreignId('paciente_id')->constrained('cadastro_paciente');
|
||||
$table->foreignId('vacina_id')->constrained('cadastro_vacina');
|
||||
$table->foreignId('dose_id')->constrained('imunizacao_dose');
|
||||
$table->date('data_aprazamento');
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('imunizacao_registro_aprazamento');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddAtivoToImunizacaoSalaVacinacaoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('imunizacao_sala_vacinacao', function (Blueprint $table) {
|
||||
$table->boolean('ativo')->default(true)->after('cria_ficha_ab');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('imunizacao_sala_vacinacao', function (Blueprint $table) {
|
||||
$table->dropColumn('ativo');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddParametrizacaoDescricaoVacinaIdToImunizacaoParametrizacaoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('imunizacao_parametrizacao', function (Blueprint $table) {
|
||||
$table->foreignId('parametrizacao_descricao_vacina_id')->nullable()->after('id')->constrained('imunizacao_parametrizacao_descricao_vacina');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('imunizacao_parametrizacao', function (Blueprint $table) {
|
||||
$table->dropForeign(['parametrizacao_descricao_vacina_id']);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddObservacaoToImunizacaoRegistroAtualizacaoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('imunizacao_registro_atualizacao', function (Blueprint $table) {
|
||||
$table->text('observacao', 5000)->nullable()->after('lote');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('imunizacao_registro_atualizacao', function (Blueprint $table) {
|
||||
$table->dropColumn('observacao');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddObservacaoToImunizacaoRegistroAprazamentoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('imunizacao_registro_aprazamento', function (Blueprint $table) {
|
||||
$table->text('observacao', 5000)->nullable()->after('data_aprazamento');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('imunizacao_registro_aprazamento', function (Blueprint $table) {
|
||||
$table->dropColumn('observacao');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddUsuarioIdToImunizacaoRequisicaoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('imunizacao_requisicao', function (Blueprint $table) {
|
||||
$table->foreignId('usuario_id')->nullable()->after('sala_vacinacao_id_para')->constrained('cadastro_usuario');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('imunizacao_requisicao', function (Blueprint $table) {
|
||||
$table->dropForeign(['usuario_id']);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddObservacaoToImunizacaoRequisicaoVacinaTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('imunizacao_requisicao_vacina', function (Blueprint $table) {
|
||||
$table->text('observacao', 5000)->nullable()->after('quantidade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('imunizacao_requisicao_vacina', function (Blueprint $table) {
|
||||
$table->dropColumn('observacao');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class DropImunizacaoParametrizacaoAplicadorTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::dropIfExists('imunizacao_parametrizacao_aplicador');
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::create('imunizacao_parametrizacao_aplicador', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
$table->foreignId('usuario_id')->constrained('cadastro_usuario');
|
||||
$table->foreignId('sala_vacinacao_id')->constrained('imunizacao_sala_vacinacao');
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddEntradaVacinaIdToImunizacaoRegistroAplicacaoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('imunizacao_registro_aplicacao', function (Blueprint $table) {
|
||||
$table->foreignId('entrada_vacina_id')->nullable()->after('saida_vacina_id')->constrained('imunizacao_entrada_vacina');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('imunizacao_registro_aplicacao', function (Blueprint $table) {
|
||||
$table->dropForeign(['entrada_vacina_id']);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class SetSaidaVacinaIdNullableOnImunizacaoRegistroAplicacaoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('imunizacao_registro_aplicacao', function (Blueprint $table) {
|
||||
$table->bigInteger('saida_vacina_id')->unsigned()->nullable()->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('imunizacao_registro_aplicacao', function (Blueprint $table) {
|
||||
$table->bigInteger('saida_vacina_id')->unsigned()->nullable(false)->change();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddPreAtendimentoIdToImunizacaoRegistroAplicacaoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('imunizacao_registro_aplicacao', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('pre_atendimento_id')
|
||||
->nullable()
|
||||
->after('id')
|
||||
->constrained('ambulatorio_atendimento_pre_atendimento');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('imunizacao_registro_aplicacao', function (Blueprint $table) {
|
||||
|
||||
$table->dropConstrainedForeignId('pre_atendimento_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddPreAtendimentoIdToImunizacaoRegistroAtualizacaoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('imunizacao_registro_atualizacao', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('pre_atendimento_id')
|
||||
->nullable()
|
||||
->after('id')
|
||||
->constrained('ambulatorio_atendimento_pre_atendimento');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('imunizacao_registro_atualizacao', function (Blueprint $table) {
|
||||
|
||||
$table->dropConstrainedForeignId('pre_atendimento_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddCodigoRiaToImunizacaoProdutorTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('imunizacao_produtor', function (Blueprint $table) {
|
||||
$table->integer('codigo_ria')->nullable()->after('codigo');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('imunizacao_produtor', function (Blueprint $table) {
|
||||
$table->dropColumn('codigo_ria');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddCodigoRiaToImunizacaoGrupoAtendimentoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('imunizacao_grupo_atendimento', function (Blueprint $table) {
|
||||
$table->char('codigo_ria', 6)->nullable()->after('id');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('imunizacao_grupo_atendimento', function (Blueprint $table) {
|
||||
$table->dropColumn('codigo_ria');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddCodigoRiaToImunizacaoEstrategiaTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('imunizacao_estrategia', function (Blueprint $table) {
|
||||
$table->integer('codigo_ria')->nullable()->after('id');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('imunizacao_estrategia', function (Blueprint $table) {
|
||||
$table->dropColumn('codigo_ria');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddCodigoRiaToImunizacaoDoseTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('imunizacao_dose', function (Blueprint $table) {
|
||||
$table->integer('codigo_ria')->nullable()->after('id');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('imunizacao_dose', function (Blueprint $table) {
|
||||
$table->dropColumn('codigo_ria');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddCodigoEsusToImunizacaoDoseTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('imunizacao_dose', function (Blueprint $table) {
|
||||
$table->integer('codigo_esus')->nullable()->after('sigla');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('imunizacao_dose', function (Blueprint $table) {
|
||||
$table->dropColumn('codigo_esus');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AlterEstrategiaIdOnImunizacaoAtualizacaoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('imunizacao_registro_atualizacao', function (Blueprint $table) {
|
||||
$table->foreignId('estrategia_id')->nullable()->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('imunizacao_registro_atualizacao', function (Blueprint $table) {
|
||||
$table->foreignId('estrategia_id')->change();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddPermiteRequisicaoToImunizacaoSalaVacinacaoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('imunizacao_sala_vacinacao', function (Blueprint $table) {
|
||||
$table->boolean('permite_requisicao')->default(false)->after('permite_aplicacao');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('imunizacao_sala_vacinacao', function (Blueprint $table) {
|
||||
$table->dropColumn('permite_requisicao');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddCidIdToImunizacaoRegistroAplicacaoMotivoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('imunizacao_registro_aplicacao_motivo', function (Blueprint $table) {
|
||||
$table->foreignId('cid_id')->nullable()->after('id')->constrained('sigtap.cid');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('imunizacao_registro_aplicacao_motivo', function (Blueprint $table) {
|
||||
$table->dropForeign(['cid_id']);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddFieldsAplicacaoToImunizacaoParametrizacaoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('imunizacao_parametrizacao', function (Blueprint $table) {
|
||||
|
||||
$table->boolean('aplicacao_data_retroativa')->default(false)->after('aprazamento_ativo');
|
||||
$table->boolean('cadastro_outro_municipio')->default(false)->after('aplicacao_data_retroativa');
|
||||
$table->boolean('cadastro_provisorio')->default(false)->after('cadastro_outro_municipio');
|
||||
$table->boolean('cadastro_bloqueado')->default(false)->after('cadastro_provisorio');
|
||||
$table->boolean('cadastro_desatualizado')->default(false)->after('cadastro_bloqueado');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('imunizacao_parametrizacao', function (Blueprint $table) {
|
||||
|
||||
$table->dropColumn('aplicacao_data_retroativa');
|
||||
$table->dropColumn('cadastro_outro_municipio');
|
||||
$table->dropColumn('cadastro_provisorio');
|
||||
$table->dropColumn('cadastro_bloqueado');
|
||||
$table->dropColumn('cadastro_desatualizado');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AlterFieldsToImunizacaoParametrizacaoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('imunizacao_parametrizacao', function (Blueprint $table) {
|
||||
|
||||
$table->boolean('aplicacao_data_retroativa')->default(true)->change();
|
||||
$table->boolean('cadastro_outro_municipio')->default(true)->change();
|
||||
$table->boolean('cadastro_provisorio')->default(true)->change();
|
||||
$table->boolean('cadastro_bloqueado')->default(true)->change();
|
||||
$table->boolean('cadastro_desatualizado')->default(true)->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('imunizacao_parametrizacao', function (Blueprint $table) {
|
||||
$table->boolean('aplicacao_data_retroativa')->default(false);
|
||||
$table->boolean('cadastro_outro_municipio')->default(false);
|
||||
$table->boolean('cadastro_provisorio')->default(false);
|
||||
$table->boolean('cadastro_bloqueado')->default(false);
|
||||
$table->boolean('cadastro_desatualizado')->default(false);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class RenameMotivoIdOnImunizacaoRegistroAplicacaoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('imunizacao_registro_aplicacao', function (Blueprint $table) {
|
||||
$table->dropForeign(['motivo_id']);
|
||||
});
|
||||
|
||||
DB::table('imunizacao_registro_aplicacao')
|
||||
->select([
|
||||
'imunizacao_registro_aplicacao.id AS registro_aplicacao_id',
|
||||
'imunizacao_registro_aplicacao_motivo.cid_id',
|
||||
])
|
||||
->join('imunizacao_registro_aplicacao_motivo', 'imunizacao_registro_aplicacao_motivo.id', 'imunizacao_registro_aplicacao.motivo_id')
|
||||
->get()
|
||||
->each(function ($query) {
|
||||
DB::table('imunizacao_registro_aplicacao')
|
||||
->where('imunizacao_registro_aplicacao.id', $query->registro_aplicacao_id)
|
||||
->update(['imunizacao_registro_aplicacao.motivo_id' => $query->cid_id]);
|
||||
});
|
||||
|
||||
Schema::table('imunizacao_registro_aplicacao', function (Blueprint $table) {
|
||||
$table->renameColumn('motivo_id', 'cid_id');
|
||||
$table->foreign('cid_id')->references('id')->on('sigtap.cid');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class DropImunizacaoRegistroAplicacaoMotivoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::dropIfExists('imunizacao_registro_aplicacao_motivo');
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::create('imunizacao_registro_aplicacao_motivo', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
$table->string('nome', 200);
|
||||
|
||||
MigrationUtil::addCommonFields($table, ['staticData' => true]);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddExcluirToIntegracaoRiaDocumentoImunologicoRotinaTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('integracao_ria_documento_imunologico_rotina', function (Blueprint $table) {
|
||||
|
||||
$table->boolean('excluir')->default(false)->after('data_hora_envio');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('integracao_ria_documento_imunologico_rotina', function (Blueprint $table) {
|
||||
|
||||
$table->dropColumn('excluir');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddAlterarToIntegracaoRiaDocumentoImunologicoRotinaTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('integracao_ria_documento_imunologico_rotina', function (Blueprint $table) {
|
||||
|
||||
$table->boolean('alterar')->default(false)->after('excluir');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('integracao_ria_documento_imunologico_rotina', function (Blueprint $table) {
|
||||
|
||||
$table->dropColumn('alterar');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddOcupacaoIdToImunizacaoRegistroAplicacaoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('imunizacao_registro_aplicacao', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('ocupacao_id')->nullable()->constrained('sigtap.ocupacao');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('imunizacao_registro_aplicacao', function (Blueprint $table) {
|
||||
|
||||
$table->dropColumn('ocupacao_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddOcupacaoIdToImunizacaoRegistroAtualizacaoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('imunizacao_registro_atualizacao', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('ocupacao_id')->nullable()->constrained('sigtap.ocupacao');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('imunizacao_registro_atualizacao', function (Blueprint $table) {
|
||||
|
||||
$table->dropColumn('ocupacao_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
use App\Models\Imunizacao\RegistroAplicacao;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class SetOcupacaoIdOnImunizacaoRegistroAplicacaoFromAtb extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
DB::transaction(function () {
|
||||
|
||||
DB::table('imunizacao_registro_aplicacao as registro_aplicacao')
|
||||
->join('atencao_basica_vacinacao_paciente_item as vacinacao_paciente_item', 'vacinacao_paciente_item.id', 'registro_aplicacao.ficha_id')
|
||||
->join('atencao_basica_vacinacao_paciente as vacinacao_paciente', 'vacinacao_paciente.id', 'vacinacao_paciente_item.vacinacao_paciente_id')
|
||||
->join('atencao_basica_ficha_vacinacao as ficha_vacinacao', 'ficha_vacinacao.id', 'vacinacao_paciente.vacinacao_id')
|
||||
->whereNull('registro_aplicacao.ocupacao_id')
|
||||
->select(
|
||||
'registro_aplicacao.id as registro_aplicacao_id',
|
||||
'ficha_vacinacao.ocupacao_id as ficha_vacinacao_ocupacao_id'
|
||||
)
|
||||
->get()
|
||||
->each(function ($registro) {
|
||||
|
||||
RegistroAplicacao::where('id', $registro->registro_aplicacao_id)
|
||||
->update(['ocupacao_id' => $registro->ficha_vacinacao_ocupacao_id]);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
use App\Models\Imunizacao\RegistroAtualizacao;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class SetOcupacaoIdOnImunizacaoRegistroAtualizacaoFromAtb extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
DB::transaction(function () {
|
||||
|
||||
DB::table('imunizacao_registro_atualizacao as registro_atualizacao')
|
||||
->join('atencao_basica_vacinacao_paciente_item as vacinacao_paciente_item', 'vacinacao_paciente_item.id', 'registro_atualizacao.ficha_id')
|
||||
->join('atencao_basica_vacinacao_paciente as vacinacao_paciente', 'vacinacao_paciente.id', 'vacinacao_paciente_item.vacinacao_paciente_id')
|
||||
->join('atencao_basica_ficha_vacinacao as ficha_vacinacao', 'ficha_vacinacao.id', 'vacinacao_paciente.vacinacao_id')
|
||||
->whereNull('registro_atualizacao.ocupacao_id')
|
||||
->select(
|
||||
'registro_atualizacao.id as registro_atualizacao_id',
|
||||
'ficha_vacinacao.ocupacao_id as ficha_vacinacao_ocupacao_id'
|
||||
)
|
||||
->get()
|
||||
->each(function ($registro) {
|
||||
|
||||
RegistroAtualizacao::where('id', $registro->registro_atualizacao_id)
|
||||
->update(['ocupacao_id' => $registro->ficha_vacinacao_ocupacao_id]);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateImunizacaoEsquemaVacinalFaixaEtariaTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('imunizacao_esquema_vacinal_faixa_etaria', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->unsignedSmallInteger('inicio_ano');
|
||||
$table->unsignedSmallInteger('inicio_mes');
|
||||
$table->unsignedSmallInteger('inicio_dia');
|
||||
$table->unsignedSmallInteger('fim_ano');
|
||||
$table->unsignedSmallInteger('fim_mes');
|
||||
$table->unsignedSmallInteger('fim_dia');
|
||||
|
||||
MigrationUtil::addCommonFields($table, ['staticData' => true]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('imunizacao_esquema_vacinal_faixa_etaria');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateImunizacaoEsquemaVacinalRegraTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('imunizacao_esquema_vacinal_regra', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->foreignId('vacina_id')->constrained('cadastro_vacina');
|
||||
$table->foreignId('estrategia_id')->constrained('imunizacao_estrategia');
|
||||
$table->foreignId('dose_id')->constrained('imunizacao_dose');
|
||||
$table->foreignId('faixa_etaria_id')->constrained('imunizacao_esquema_vacinal_faixa_etaria');
|
||||
$table->unsignedSmallInteger('dias_aprazamento')->nullable();
|
||||
$table->foreignId('proxima_regra_id')->nullable()->constrained('imunizacao_esquema_vacinal_regra');
|
||||
|
||||
$table->unique(['vacina_id', 'estrategia_id', 'dose_id', 'faixa_etaria_id']);
|
||||
|
||||
MigrationUtil::addCommonFields($table, ['staticData' => true]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('imunizacao_esquema_vacinal_regra');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,178 @@
|
||||
<?php
|
||||
|
||||
use App\Services\Integracao\RiaService;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class CorrigeIntegracaoRiaDocumentoImunologicoRotinaDuplicado extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
if (!app()->environment('production')) {
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (app('config')->get('database.default') === 'demo'
|
||||
|| app('config')->get('database.default') === 'demo-wrk'
|
||||
) {
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
DB::transaction(function () {
|
||||
|
||||
$parametrizacao = RiaService::getParametrizacao();
|
||||
$token = null;
|
||||
$expiresAt = null;
|
||||
|
||||
if (!is_null($parametrizacao)) {
|
||||
|
||||
try {
|
||||
|
||||
$token = RiaService::getToken($parametrizacao->senha);
|
||||
$expiresAt = Carbon::now()->addMilliseconds($token['expires_in'])->subMinutes(2);
|
||||
}
|
||||
catch (Exception $e) {}
|
||||
}
|
||||
|
||||
$aplicacoes = DB::table('imunizacao_registro_aplicacao as aplicacao')
|
||||
->join('integracao_ria_documento_imunologico_rotina as documento', 'documento.registro_aplicacao_id', 'aplicacao.id')
|
||||
->select('aplicacao.id')
|
||||
->groupBy('aplicacao.id')
|
||||
->havingRaw("COUNT(*) > 1")
|
||||
->get();
|
||||
|
||||
$aplicacoes->each(function ($aplicacao) use ($parametrizacao, &$token, &$expiresAt) {
|
||||
|
||||
$documentos = DB::table('integracao_ria_documento_imunologico_rotina as documento')
|
||||
->select(
|
||||
'documento.id',
|
||||
'documento.identificador_rnds',
|
||||
'documento.data_hora_envio'
|
||||
)
|
||||
->where('documento.registro_aplicacao_id', $aplicacao->id)
|
||||
->orderByRaw("(CASE WHEN documento.identificador_rnds IS NULL THEN 0 ELSE 1 END) DESC, documento.data_hora_envio DESC")
|
||||
->get();
|
||||
|
||||
$documentos->each(function ($documento, $i) use ($parametrizacao, &$token, &$expiresAt) {
|
||||
|
||||
if ($i === 0) {
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (!is_null($documento->identificador_rnds)) {
|
||||
|
||||
if (!is_null($parametrizacao) && !is_null($token)) {
|
||||
|
||||
try {
|
||||
|
||||
if (Carbon::now() >= $expiresAt) {
|
||||
|
||||
$token = RiaService::getToken($parametrizacao->senha);
|
||||
$expiresAt = Carbon::now()->addMilliseconds($token['expires_in'])->subMinutes(2);
|
||||
}
|
||||
|
||||
$headers = [
|
||||
'Authorization' => $parametrizacao->cns_solicitante,
|
||||
'Content-Type' => 'application/json',
|
||||
'X-Authorization-Server' => "Bearer " . $token['access_token'],
|
||||
];
|
||||
|
||||
$response = RiaService::destroy($headers, $documento->identificador_rnds);
|
||||
|
||||
if ($response->status() === 204) {
|
||||
|
||||
DB::table('integracao_ria_documento_imunologico_rotina')->where('id', $documento->id)->delete();
|
||||
}
|
||||
}
|
||||
catch (Exception $e) {}
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
DB::table('integracao_ria_documento_imunologico_rotina')->where('id', $documento->id)->delete();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$atualizacoes = DB::table('imunizacao_registro_atualizacao as atualizacao')
|
||||
->join('integracao_ria_documento_imunologico_rotina as documento', 'documento.registro_atualizacao_id', 'atualizacao.id')
|
||||
->select('atualizacao.id')
|
||||
->groupBy('atualizacao.id')
|
||||
->havingRaw("COUNT(*) > 1")
|
||||
->get();
|
||||
|
||||
$atualizacoes->each(function ($atualizacao) use ($parametrizacao, &$token, &$expiresAt) {
|
||||
|
||||
$documentos = DB::table('integracao_ria_documento_imunologico_rotina as documento')
|
||||
->select(
|
||||
'documento.id',
|
||||
'documento.identificador_rnds',
|
||||
'documento.data_hora_envio'
|
||||
)
|
||||
->where('documento.registro_atualizacao_id', $atualizacao->id)
|
||||
->orderByRaw("(CASE WHEN documento.identificador_rnds IS NULL THEN 0 ELSE 1 END) DESC, documento.data_hora_envio DESC")
|
||||
->get();
|
||||
|
||||
$documentos->each(function ($documento, $i) use ($parametrizacao, &$token, &$expiresAt) {
|
||||
|
||||
if ($i === 0) {
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (!is_null($documento->identificador_rnds)) {
|
||||
|
||||
if (!is_null($parametrizacao) && !is_null($token)) {
|
||||
|
||||
try {
|
||||
|
||||
if (Carbon::now() >= $expiresAt) {
|
||||
|
||||
$token = RiaService::getToken($parametrizacao->senha);
|
||||
$expiresAt = Carbon::now()->addMilliseconds($token['expires_in'])->subMinutes(2);
|
||||
}
|
||||
|
||||
$headers = [
|
||||
'Authorization' => $parametrizacao->cns_solicitante,
|
||||
'Content-Type' => 'application/json',
|
||||
'X-Authorization-Server' => "Bearer " . $token['access_token'],
|
||||
];
|
||||
|
||||
$response = RiaService::destroy($headers, $documento->identificador_rnds);
|
||||
|
||||
if ($response->status() === 204) {
|
||||
|
||||
DB::table('integracao_ria_documento_imunologico_rotina')->where('id', $documento->id)->delete();
|
||||
}
|
||||
}
|
||||
catch (Exception $e) {}
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
DB::table('integracao_ria_documento_imunologico_rotina')->where('id', $documento->id)->delete();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateImunizacaoViaAdministracaoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('imunizacao_via_administracao', function (Blueprint $table) {
|
||||
|
||||
\MigrationUtil::idWithoutIncrements($table);
|
||||
|
||||
$table->string('nome', 50)->unique();
|
||||
$table->integer('codigo_ria')->unique();
|
||||
|
||||
\MigrationUtil::addCommonFields($table, ['staticData' => true]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('imunizacao_via_administracao');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateImunizacaoLocalAplicacaoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('imunizacao_local_aplicacao', function (Blueprint $table) {
|
||||
|
||||
\MigrationUtil::idWithoutIncrements($table);
|
||||
|
||||
$table->string('nome', 50)->unique();
|
||||
$table->integer('codigo_ria')->unique();
|
||||
|
||||
\MigrationUtil::addCommonFields($table, ['staticData' => true]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('imunizacao_local_aplicacao');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddViaAdministracaoLocalAplicacaoToImunizacaoEsquemaVacinalRegraTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('imunizacao_esquema_vacinal_regra', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('via_administracao_id')
|
||||
->nullable()
|
||||
->after('dias_aprazamento')
|
||||
->constrained('imunizacao_via_administracao');
|
||||
|
||||
$table->foreignId('local_aplicacao_id')
|
||||
->nullable()
|
||||
->after('via_administracao_id')
|
||||
->constrained('imunizacao_local_aplicacao');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('imunizacao_esquema_vacinal_regra', function (Blueprint $table) {
|
||||
|
||||
$table->dropConstrainedForeignId('via_administracao_id');
|
||||
$table->dropConstrainedForeignId('local_aplicacao_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddViaAdministracaoIdLocalAplicacaoIdToImunizacaoRegistroAplicacaoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('imunizacao_registro_aplicacao', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('via_administracao_id')
|
||||
->nullable()
|
||||
->after('estrategia_id')
|
||||
->constrained('imunizacao_via_administracao');
|
||||
|
||||
$table->foreignId('local_aplicacao_id')
|
||||
->nullable()
|
||||
->after('via_administracao_id')
|
||||
->constrained('imunizacao_local_aplicacao');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('imunizacao_registro_aplicacao', function (Blueprint $table) {
|
||||
|
||||
$table->dropConstrainedForeignId('via_administracao_id');
|
||||
$table->dropConstrainedForeignId('local_aplicacao_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddFieldImunizacaoRegistroAtualizacao extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('imunizacao_registro_atualizacao', function (Blueprint $table) {
|
||||
$table->foreignId('cid_id')->nullable()->after('estrategia_id')->constrained('sigtap.cid');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('imunizacao_registro_atualizacao', function (Blueprint $table) {
|
||||
$table->dropForeign(['cid_id']);
|
||||
$table->dropColumn('cid_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateImunizacaoViaAdministracaoLocalAplicacaoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('imunizacao_via_administracao_local_aplicacao', function (Blueprint $table) {
|
||||
$table->foreignId('via_administracao_id')->constrained('imunizacao_via_administracao');
|
||||
$table->foreignId('local_aplicacao_id')->constrained('imunizacao_local_aplicacao');
|
||||
|
||||
$table->primary(['via_administracao_id', 'local_aplicacao_id']);
|
||||
|
||||
\MigrationUtil::addCommonFields($table, ['staticData' => true]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('imunizacao_via_administracao_local_aplicacao');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user