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,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateCadastroCarteiraHabilitacaoCategoriaTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('cadastro_carteira_habilitacao_categoria', function (Blueprint $table) {
MigrationUtil::idWithoutIncrements($table);
$table->string('letra', 3);
MigrationUtil::addCommonFields($table, ['staticData' => true]);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('cadastro_carteira_habilitacao_categoria');
}
}

View File

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

View File

@@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateCadastroDeficienciaTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('cadastro_deficiencia', function (Blueprint $table) {
MigrationUtil::idWithoutIncrements($table);
$table->foreignId('deficiencia_base_id')->constrained('cadastro_deficiencia_base');
$table->string('descricao', 50);
MigrationUtil::addCommonFields($table, ['staticData' => true]);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('cadastro_deficiencia');
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,69 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateCadastroCidadaoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('cadastro_cidadao', function (Blueprint $table) {
$table->id();
$table->string('cpf', 11);
$table->string('nome', 150);
$table->string('nome_social', 40)->nullable();
$table->date('data_nascimento');
$table->string('conjuge', 150)->nullable();
$table->string('nome_mae', 150)->nullable();
$table->string('nome_pai', 150)->nullable();
$table->unsignedBigInteger('prontuario');
$table->boolean('frequenta_escola')->nullable();
$table->foreignId('municipio_nascimento_id')->nullable()->constrained('intranet.cadastro_municipio');
$table->foreignId('pais_nascimento_id')->nullable()->constrained('intranet.cadastro_pais');
$table->foreignId('estado_nascimento_id')->nullable()->constrained('intranet.cadastro_estado');
$table->foreignId('deficiencia_id')->nullable()->constrained('cadastro_deficiencia');
$table->string('deficiencia_outro', 50)->nullable();
$table->foreignId('escolaridade_id')->nullable()->constrained('cadastro_escolaridade');
$table->foreignId('estado_civil_id')->nullable()->constrained('cadastro_estado_civil');
$table->foreignId('etnia_indigena_id')->nullable()->constrained('cadastro_etnia_indigena');
$table->foreignId('local_nascimento_id')->nullable()->constrained('cadastro_local_nascimento');
$table->foreignId('mobilidade_reduzida_id')->nullable()->constrained('cadastro_mobilidade_reduzida');
$table->foreignId('motivo_duplicidade_cpf_id')->nullable()->constrained('cadastro_motivo_duplicidade_cpf');
$table->string('motivo_duplicidade_cpf_outro', 50)->nullable();
$table->foreignId('nacionalidade_id')->constrained('cadastro_nacionalidade');
$table->date('data_naturalizacao')->nullable();
$table->foreignId('preferencia_nome_id')->nullable()->constrained('cadastro_preferencia_nome');
$table->foreignId('raca_cor_id')->constrained('cadastro_raca_cor');
$table->foreignId('sexo_id')->constrained('cadastro_sexo');
$table->foreignId('identidade_genero_id')->nullable()->constrained('cadastro_identidade_genero');
$table->foreignId('situacao_familiar_conjugal_id')->nullable()->constrained('cadastro_situacao_familiar_conjugal');
$table->foreignId('tipo_sanguineo_id')->nullable()->constrained('cadastro_tipo_sanguineo');
$table->foreignId('domicilio_id')->nullable()->constrained('cadastro_domicilio');
$table->date('data_entrada_domicilio')->nullable();
$table->string('caracteristicas_fisicas', 500)->nullable();
$table->foreignId('ocupacao_id')->nullable()->constrained('sigtap.ocupacao');
$table->string('fator_risco_outro', 100)->nullable();
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
$table->unique(['prontuario', 'deleted_at']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('cadastro_cidadao');
}
}

View File

@@ -0,0 +1,39 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateCadastroTituloEleitorTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('cadastro_titulo_eleitor', function (Blueprint $table) {
$table->id();
$table->foreignId('cidadao_id')->constrained('cadastro_cidadao');
$table->char('numero', 13);
$table->string('zona', 3);
$table->char('secao', 4);
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
$table->unique(['numero', 'deleted_at']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('cadastro_titulo_eleitor');
}
}

View File

@@ -0,0 +1,40 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateCadastroCarteiraIdentidadeTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('cadastro_carteira_identidade', function (Blueprint $table) {
$table->id();
$table->foreignId('cidadao_id')->constrained('cadastro_cidadao');
$table->foreignId('estado_id')->nullable()->constrained('intranet.cadastro_estado');
$table->string('numero', 15);
$table->string('orgao_emissor', 5)->nullable();
$table->date('data_emissao')->nullable();
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
$table->unique(['numero', 'deleted_at']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('cadastro_carteira_identidade');
}
}

View File

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

View File

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

View File

@@ -0,0 +1,45 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateCadastroCertidaoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('cadastro_certidao', function (Blueprint $table) {
$table->id();
$table->foreignId('tipo_id')->constrained('cadastro_certidao_tipo');
$table->foreignId('modelo_id')->constrained('cadastro_certidao_modelo');
$table->foreignId('cidadao_id')->constrained('cadastro_cidadao');
$table->foreignId('municipio_id')->nullable()->constrained('intranet.cadastro_municipio');
$table->string('numero', 40);
$table->string('cartorio_nome', 20)->nullable();
$table->string('cartorio_codigo', 15)->nullable();
$table->string('livro', 8)->nullable();
$table->char('folha', 4)->nullable();
$table->date('data_emissao')->nullable();
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
$table->unique(['tipo_id', 'numero', 'deleted_at']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('cadastro_certidao');
}
}

View File

@@ -0,0 +1,41 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateCadastroCarteiraTrabalhoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('cadastro_carteira_trabalho', function (Blueprint $table) {
$table->id();
$table->foreignId('cidadao_id')->constrained('cadastro_cidadao');
$table->foreignId('estado_id')->constrained('intranet.cadastro_estado');
$table->string('numero', 7);
$table->string('serie', 5);
$table->date('data_emissao');
$table->string('nis_pis_pasep', 11);
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
$table->unique(['numero', 'deleted_at']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('cadastro_carteira_trabalho');
}
}

View File

@@ -0,0 +1,41 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateCadastroCarteiraHabilitacaoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('cadastro_carteira_habilitacao', function (Blueprint $table) {
$table->id();
$table->foreignId('cidadao_id')->constrained('cadastro_cidadao');
$table->foreignId('estado_id')->constrained('intranet.cadastro_estado');
$table->foreignId('categoria_id')->constrained('cadastro_carteira_habilitacao_categoria');
$table->string('numero', 11);
$table->date('data_emissao');
$table->date('data_validade');
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
$table->unique(['numero', 'deleted_at']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('cadastro_carteira_habilitacao');
}
}

View File

@@ -0,0 +1,38 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateCadastroEstrangeiroEntradaBrasilTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('cadastro_estrangeiro_entrada_brasil', function (Blueprint $table) {
$table->id();
$table->foreignId('cidadao_id')->constrained('cadastro_cidadao');
$table->string('rne', 20);
$table->date('data_entrada');
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
$table->unique(['rne', 'deleted_at']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('cadastro_estrangeiro_entrada_brasil');
}
}

View File

@@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateCadastroCidadaoConvenioMedicoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('cadastro_cidadao_convenio_medico', function (Blueprint $table) {
$table->foreignId('cidadao_id')->constrained('cadastro_cidadao');
$table->foreignId('convenio_medico_id')->constrained('cadastro_convenio_medico');
$table->primary(['cidadao_id', 'convenio_medico_id']);
MigrationUtil::addCommonFields($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('cadastro_cidadao_convenio_medico');
}
}

View File

@@ -0,0 +1,38 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateCadastroCidadaoTelefoneTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('cadastro_cidadao_telefone', function (Blueprint $table) {
$table->id();
$table->foreignId('cidadao_id')->constrained('cadastro_cidadao');
$table->string('numero', 11);
$table->string('observacao', 50)->nullable();
$table->boolean('autoriza_sms');
$table->boolean('principal');
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('cadastro_cidadao_telefone');
}
}

View File

@@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateCadastroUsuarioRegistroTipoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('cadastro_usuario_registro_tipo', function (Blueprint $table) {
MigrationUtil::idWithoutIncrements($table);
$table->string('descricao', 40);
$table->string('sigla', 10)->nullable();
MigrationUtil::addCommonFields($table, ['staticData' => true]);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('cadastro_usuario_registro_tipo');
}
}

View File

@@ -0,0 +1,54 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateCadastroUsuarioTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('cadastro_usuario', function (Blueprint $table) {
$table->id();
$table->foreignId('cidadao_id')->constrained('cadastro_cidadao');
$table->string('usuario', 100);
$table->string('email', 180);
$table->string('senha', 255);
$table->foreignId('registro_tipo_id')->nullable()->constrained('cadastro_usuario_registro_tipo');
$table->string('registro_tipo_outro', 50)->nullable();
$table->string('registro_numero', 25)->nullable();
$table->foreignId('registro_estado_id')->nullable()->constrained('intranet.cadastro_estado');
$table->timestamp('ultima_troca_senha')->nullable();
$table->integer('tempo_sessao')->nullable();
$table->boolean('troca_senha')->default(false);
$table->timestamp('ultima_tentativa')->nullable();
$table->timestamp('ultimo_acesso')->nullable();
$table->boolean('bloqueado')->default(false);
$table->char('cns', 15);
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
$table->unique(['usuario', 'deleted_at']);
$table->unique(['email', 'deleted_at']);
$table->unique(['cns', 'deleted_at']);
$table->unique(['cidadao_id', 'deleted_at']);
$table->unique(['registro_tipo_id', 'registro_numero', 'deleted_at']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('cadastro_usuario');
}
}

View File

@@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateCadastroUsuarioHistoricoSenhaTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('cadastro_usuario_historico_senha', function (Blueprint $table) {
$table->id();
$table->foreignId('usuario_id')->constrained('cadastro_usuario');
$table->string('senha', 255);
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('cadastro_usuario_historico_senha');
}
}

View File

@@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateCadastroUsuarioHistoricoAcessoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('cadastro_usuario_historico_acesso', function (Blueprint $table) {
$table->id();
$table->foreignId('usuario_id')->constrained('cadastro_usuario');
$table->boolean('sucesso')->default(true);
$table->boolean('ativo')->default(true);
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('cadastro_usuario_historico_acesso');
}
}

View File

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

View File

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

View File

@@ -0,0 +1,45 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateCadastroPacienteTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('cadastro_paciente', function (Blueprint $table) {
$table->id();
$table->foreignId('cidadao_id')->constrained('cadastro_cidadao');
$table->char('cns', 15)->nullable();
$table->string('email', 255)->nullable();
$table->foreignId('classificacao_id')->constrained('cadastro_paciente_classificacao');
$table->foreignId('subclassificacao_id')->nullable()->constrained('cadastro_paciente_subclassificacao');
$table->foreignId('unidade_id')->constrained('cadastro_unidade');
$table->unsignedInteger('sequencial_desconhecido')->nullable();
$table->timestamp('sequencial_desconhecido_em')->nullable();
$table->timestamp('sem_documentos_em')->nullable();
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
$table->unique(['cns', 'deleted_at']);
$table->unique(['sequencial_desconhecido', 'sequencial_desconhecido_em', 'deleted_at']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('cadastro_paciente');
}
}

View File

@@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateCadastroProntuarioUnidadeTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('cadastro_prontuario_unidade', function (Blueprint $table) {
$table->id();
$table->foreignId('paciente_id')->constrained('cadastro_paciente')->onDelete('cascade');
$table->foreignId('unidade_id')->constrained('cadastro_unidade');
$table->string('prontuario', 10);
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('cadastro_prontuario_unidade');
}
}

View File

@@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateCadastroPacienteClassificacaoHistoricoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('cadastro_paciente_classificacao_historico', function (Blueprint $table) {
$table->id();
$table->foreignId('paciente_id')->constrained('cadastro_paciente')->onDelete('cascade');
$table->foreignId('classificacao_id')->constrained('cadastro_paciente_classificacao');
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('cadastro_paciente_classificacao_historico');
}
}

View File

@@ -0,0 +1,39 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateCadastroLotacaoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('cadastro_lotacao', function (Blueprint $table) {
$table->id();
$table->foreignId('infraestrutura_id')->constrained('cadastro_infraestrutura');
$table->foreignId('usuario_id')->constrained('cadastro_usuario');
$table->foreignId('ocupacao_id')->constrained('sigtap.ocupacao');
$table->boolean('realiza_atendimento');
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
$table->unique(['infraestrutura_id', 'usuario_id', 'ocupacao_id', 'deleted_at']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('cadastro_lotacao');
}
}

View File

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

View File

@@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateCadastroAlergiaTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('cadastro_alergia', function (Blueprint $table) {
$table->id();
$table->foreignId('tipo_id')->constrained('cadastro_alergia_tipo');
$table->string('agente_substancia_especifica', 100);
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('cadastro_alergia');
}
}

View File

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

View File

@@ -0,0 +1,38 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateCadastroCidadaoAlergiaTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('cadastro_cidadao_alergia', function (Blueprint $table) {
$table->foreignId('cidadao_id')->constrained('cadastro_cidadao');
$table->foreignId('alergia_id')->constrained('cadastro_alergia');
$table->foreignId('criticidade_id')->constrained('cadastro_alergia_criticidade');
$table->string('reacoes_observacoes', 100)->nullable();
$table->primary(['cidadao_id', 'alergia_id']);
MigrationUtil::addCommonFields($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('cadastro_cidadao_alergia');
}
}

View File

@@ -0,0 +1,40 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateCadastroObitoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('cadastro_obito', function (Blueprint $table) {
$table->id();
$table->foreignId('cidadao_id')->constrained('cadastro_cidadao');
$table->dateTime('obito_em');
$table->string('declaracao', 13);
$table->string('causa', 255)->nullable();
$table->foreignId('cid_id')->nullable()->constrained('sigtap.cid');
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
$table->unique(['cidadao_id', 'deleted_at']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('cadastro_obito');
}
}

View File

@@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateCadastroCidadaoDoencaCronicaTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('cadastro_cidadao_doenca_cronica', function (Blueprint $table) {
$table->id();
$table->foreignId('cidadao_id')->constrained('cadastro_cidadao');
$table->string('descricao', 3000);
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('cadastro_cidadao_doenca_cronica');
}
}

View File

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

View File

@@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateCadastroCidadaoFatorRiscoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('cadastro_cidadao_fator_risco', function (Blueprint $table) {
$table->foreignId('cidadao_id')->constrained('cadastro_cidadao');
$table->foreignId('fator_risco_id')->constrained('cadastro_fator_risco');
$table->primary(['cidadao_id', 'fator_risco_id']);
MigrationUtil::addCommonFields($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('cadastro_cidadao_fator_risco');
}
}

View File

@@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class DropCnsOnCadastroUsuarioTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('cadastro_usuario', function (Blueprint $table) {
$table->dropUnique(['cns', 'deleted_at']);
$table->dropColumn('cns');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('cadastro_usuario', function (Blueprint $table) {
$table->char('cns', 15);
$table->unique(['cns', '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 DropCnsOnCadastroPacienteTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('cadastro_paciente', function (Blueprint $table) {
$table->dropUnique(['cns', 'deleted_at']);
$table->dropColumn('cns');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('cadastro_paciente', function (Blueprint $table) {
$table->char('cns', 15);
$table->unique(['cns', '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 AddCnsToCadastroCidadaoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('cadastro_cidadao', function (Blueprint $table) {
$table->char('cns', 15)->nullable()->after('id');
$table->unique(['cns', 'deleted_at']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('cadastro_cidadao', function (Blueprint $table) {
$table->dropUnique(['cns', 'deleted_at']);
$table->dropColumn('cns');
});
}
}

View File

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

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class SetCpfToNullOnCadastroCidadao extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('cadastro_cidadao', function (Blueprint $table) {
$table->string('cpf', 11)->nullable(true)->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('cadastro_cidadao', function (Blueprint $table) {
$table->string('cpf', 11)->nullable(false)->change();
});
}
}

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class SetNacionalidadeIdToNullOnCadastroCidadao extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('cadastro_cidadao', function (Blueprint $table) {
$table->foreignId('nacionalidade_id')->nullable(true)->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('cadastro_cidadao', function (Blueprint $table) {
$table->foreignId('nacionalidade_id')->nullable(false)->change();
});
}
}

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class SetRacaCorIdToNullOnCadastroCidadao extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('cadastro_cidadao', function (Blueprint $table) {
$table->foreignId('raca_cor_id')->nullable(true)->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('cadastro_cidadao', function (Blueprint $table) {
$table->foreignId('raca_cor_id')->nullable(false)->change();
});
}
}

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class SetClassificacaoIdToNullOnCadastroPaciente extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('cadastro_paciente', function (Blueprint $table) {
$table->foreignId('classificacao_id')->nullable(true)->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('cadastro_paciente', function (Blueprint $table) {
$table->foreignId('classificacao_id')->nullable(false)->change();
});
}
}

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class SetUnidadeIdToNullOnCadastroPaciente extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('cadastro_paciente', function (Blueprint $table) {
$table->foreignId('unidade_id')->nullable(true)->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('cadastro_paciente', function (Blueprint $table) {
$table->foreignId('unidade_id')->nullable(false)->change();
});
}
}

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class SetDataNascimentoToNullOnCadastroCidadao extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('cadastro_cidadao', function (Blueprint $table) {
$table->date('data_nascimento')->nullable(true)->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('cadastro_cidadao', function (Blueprint $table) {
$table->date('data_nascimento')->nullable(false)->change();
});
}
}

View File

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

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddCodigoCadsusToCadastroEtniaIndigenaTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('cadastro_etnia_indigena', function (Blueprint $table) {
$table->char('codigo_cadsus', 4)->after('codigo');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('cadastro_etnia_indigena', function (Blueprint $table) {
$table->dropColumn('codigo_cadsus');
});
}
}

View File

@@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class DropOcupacaoIdFromCadastroCidadao extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('cadastro_cidadao', function (Blueprint $table) {
$table->dropForeign(['ocupacao_id']);
$table->dropColumn('ocupacao_id');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('cadastro_cidadao', function (Blueprint $table) {
$table->foreignId('ocupacao_id')->nullable()->constrained('sigtap.ocupacao');
});
}
}

View File

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

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class SetEmailToNullOnCadastroUsuario extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('cadastro_usuario', function (Blueprint $table) {
$table->string('email', 180)->nullable(true)->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('cadastro_usuario', function (Blueprint $table) {
$table->string('email', 180)->nullable(false)->change();
});
}
}

View File

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

View File

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

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AlterDeclaracaoFromCadastroObito extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('cadastro_obito', function (Blueprint $table) {
$table->string('declaracao', 13)->nullable(true)->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('cadastro_obito', function (Blueprint $table) {
$table->string('declaracao', 13)->nullable(false)->change();
});
}
}

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class SetUnidadeIdToNullableOnCadastroPacienteTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('cadastro_paciente', function (Blueprint $table) {
$table->foreignId('unidade_id')->nullable()->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('cadastro_paciente', function (Blueprint $table) {
$table->foreignId('unidade_id')->nullable(false)->change();
});
}
}

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddCidadaoIdToCadastroCidadaoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('cadastro_cidadao', function (Blueprint $table) {
$table->unsignedBigInteger('cidadao_id')->nullable()->after('id');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('cadastro_cidadao', function (Blueprint $table) {
$table->dropColumn('cidadao_id');
});
}
}

View File

@@ -0,0 +1,48 @@
<?php
use Doctrine\DBAL\Types\StringType;
use Doctrine\DBAL\Types\Type;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class SetFieldsToNullableOnCadastroTituloEleitor extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('cadastro_titulo_eleitor', function (Blueprint $table) {
if (!Type::hasType('char')) {
Type::addType('char', StringType::class);
}
$table->string('zona', 3)->nullable()->change();
$table->char('secao', 4)->nullable()->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('cadastro_titulo_eleitor', function (Blueprint $table) {
if (!Type::hasType('char')) {
Type::addType('char', StringType::class);
}
$table->string('zona', 3)->nullable(false)->change();
$table->char('secao', 4)->nullable(false)->change();
});
}
}

View File

@@ -0,0 +1,40 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class SetFieldsToNullableOnCadastroCarteiraTrabalho extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('cadastro_carteira_trabalho', function (Blueprint $table) {
$table->foreignId('estado_id')->nullable()->change();
$table->string('serie', 5)->nullable()->change();
$table->date('data_emissao')->nullable()->change();
$table->string('nis_pis_pasep', 11)->nullable()->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('cadastro_carteira_trabalho', function (Blueprint $table) {
$table->foreignId('estado_id')->nullable(false)->change();
$table->string('serie', 5)->nullable(false)->change();
$table->date('data_emissao')->nullable(false)->change();
$table->string('nis_pis_pasep', 11)->nullable(false)->change();
});
}
}

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AlterSizeEmailOnCadastroPaciente extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('cadastro_paciente', function (Blueprint $table) {
$table->string('email', 100)->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('cadastro_paciente', function (Blueprint $table) {
$table->string('email', 255)->change();
});
}
}

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AlterSizeNomeSocialOnCadastroCidadao extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('cadastro_cidadao', function (Blueprint $table) {
$table->string('nome_social', 150)->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('cadastro_cidadao', function (Blueprint $table) {
$table->string('nome_social', 40)->change();
});
}
}

View File

@@ -0,0 +1,46 @@
<?php
use Doctrine\DBAL\Types\StringType;
use Doctrine\DBAL\Types\Type;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AlterSizeFolhaOnCadastroCertidao extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('cadastro_certidao', function (Blueprint $table) {
if (!Type::hasType('char')) {
Type::addType('char', StringType::class);
}
$table->char('folha', 10)->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('cadastro_certidao', function (Blueprint $table) {
if (!Type::hasType('char')) {
Type::addType('char', StringType::class);
}
$table->char('folha', 4)->change();
});
}
}

View File

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

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AlterSizeNumeroAtCadastroCarteiraTrabalho extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('cadastro_carteira_trabalho', function (Blueprint $table) {
$table->string('numero', 16)->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('cadastro_carteira_trabalho', function (Blueprint $table) {
$table->string('numero', 7)->change();
});
}
}

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AlterSizeOrgaoEmissorAtCadastroCarteiraIdentidade extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('cadastro_carteira_identidade', function (Blueprint $table) {
$table->string('orgao_emissor', 8)->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('cadastro_carteira_identidade', function (Blueprint $table) {
$table->string('orgao_emissor', 5)->change();
});
}
}

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AlterSizeZonaAtCadastroTituloEleitor extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('cadastro_titulo_eleitor', function (Blueprint $table) {
$table->string('zona', 4)->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('cadastro_titulo_eleitor', function (Blueprint $table) {
$table->string('zona', 3)->change();
});
}
}

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AlterSizeCartorioNomeAtCadastroCertidao extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('cadastro_certidao', function (Blueprint $table) {
$table->string('cartorio_nome', 70)->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('cadastro_certidao', function (Blueprint $table) {
$table->string('cartorio_nome', 20)->change();
});
}
}

View File

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

View File

@@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddObservacaoIntoPaciente extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('cadastro_paciente', function (Blueprint $table) {
$table->string('observacao', 300)
->nullable()
->after('sem_documentos_em');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('cadastro_paciente', function (Blueprint $table) {
$table->dropColumn('observacao');
});
}
}

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateCadastroCidadaoMedicamentoUsoContinuoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('cadastro_cidadao_medicamento_uso_continuo', function (Blueprint $table) {
$table->foreignId('cidadao_id')->constrained('cadastro_cidadao');
$table->foreignId('medicamento_id')->constrained('cadastro_medicamento');
$table->primary(['cidadao_id', 'medicamento_id']);
MigrationUtil::addCommonFields($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('cadastro_cidadao_medicamento_uso_continuo');
}
}

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddCodigoEsusToCadastroIdentidadeGeneroTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('cadastro_identidade_genero', function (Blueprint $table) {
$table->smallInteger('codigo_esus')->nullable()->after('descricao')->unique();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('cadastro_identidade_genero', function (Blueprint $table) {
$table->dropColumn('codigo_esus');
});
}
}

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddCodigoEsusToCadastroNacionalidadeTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('cadastro_nacionalidade', function (Blueprint $table) {
$table->smallInteger('codigo_esus')->nullable()->after('descricao')->unique();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('cadastro_nacionalidade', function (Blueprint $table) {
$table->dropColumn('codigo_esus');
});
}
}

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddCodigoEsusToCadastroSexoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('cadastro_sexo', function (Blueprint $table) {
$table->smallInteger('codigo_esus')->nullable()->after('descricao')->unique();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('cadastro_sexo', function (Blueprint $table) {
$table->dropColumn('codigo_esus');
});
}
}

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddCodigoEsusToCadastroRacaCorTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('cadastro_raca_cor', function (Blueprint $table) {
$table->smallInteger('codigo_esus')->nullable()->after('descricao')->unique();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('cadastro_raca_cor', function (Blueprint $table) {
$table->dropColumn('codigo_esus');
});
}
}

View File

@@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddPortariaNaturalizacaoToCadastroCidadaoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('cadastro_cidadao', function (Blueprint $table) {
$table->string('portaria_naturalizacao', 16)->nullable()->after('data_naturalizacao');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('cadastro_cidadao', function (Blueprint $table) {
$table->dropColumn('portaria_naturalizacao');
});
}
}

View File

@@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddFieldsValidadeCadastroToCadastroPaciente extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('cadastro_paciente', function (Blueprint $table) {
$table->date('validade_inicio')->nullable()->after('subclassificacao_id');
$table->date('validade_fim')->nullable()->after('validade_inicio');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('cadastro_paciente', function (Blueprint $table) {
$table->dropColumn(['validade_inicio', 'validade_fim']);
});
}
}

View File

@@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateCadastroPacienteGestacaoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('cadastro_paciente_gestacao', function (Blueprint $table) {
$table->id();
$table->foreignId('paciente_id')->constrained('cadastro_paciente');
$table->date('inicio');
$table->date('fim')->nullable();
MigrationUtil::addCommonFields($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('cadastro_paciente_gestacao');
}
}

View File

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

View File

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

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddProtocoloCrossToCadastroPacienteTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('cadastro_paciente', function (Blueprint $table) {
$table->string('protocolo_cross', 10)->nullable()->after('observacao');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('cadastro_paciente', function (Blueprint $table) {
$table->dropColumn(['protocolo_cross']);
});
}
}

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class SetDeclaracaoToNullOnCadastroObitoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('cadastro_obito', function (Blueprint $table) {
$table->string('declaracao', 13)->nullable()->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('cadastro_obito', function (Blueprint $table) {
$table->string('declaracao', 13)->nullable(false)->change();
});
}
}

View File

@@ -0,0 +1,53 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateCadastroPacienteCondicaoSaudeTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('cadastro_paciente_condicao_saude', function (Blueprint $table) {
$table->id();
$table->foreignId('paciente_id')->constrained('cadastro_paciente')->onDelete('cascade');
$table->foreignId('peso_id')->nullable()->constrained('atencao_basica_cadastro_peso');
$table->boolean('internacao')->default(false)->nullable();
$table->string('internacao_motivo', 50)->nullable();
$table->date('internacao_data')->nullable();
$table->boolean('doenca_cardiaca')->default(false)->nullable();
$table->boolean('problemas_rins')->default(false)->nullable();
$table->boolean('doenca_respiratoria')->default(false)->nullable();
$table->boolean('tratamento_saude_mental')->default(false)->nullable();
$table->date('tratamento_saude_mental_internacao_data')->nullable();
$table->date('tratamento_saude_mental_alta_data')->nullable();
$table->boolean('acamado')->default(false)->nullable();
$table->boolean('domiciliado')->default(false)->nullable();
$table->boolean('plantas_medicinais')->default(false)->nullable();
$table->string('plantas_medicinais_quais', 50)->nullable();
$table->boolean('praticas_integrativas')->default(false)->nullable();
$table->string('outras_condicoes_primaria', 250)->nullable();
$table->string('outras_condicoes_secundaria', 250)->nullable();
$table->string('outras_condicoes_terciaria', 250)->nullable();
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('cadastro_paciente_condicao_saude');
}
}

View File

@@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateCadastroPacienteCondicaoSaudeDoencaCardiacaTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('cadastro_paciente_condicao_saude_doenca_cardiaca', function (Blueprint $table) {
$table->foreignId('paciente_condicao_saude_id')->constrained('cadastro_paciente_condicao_saude');
$table->foreignId('doenca_cardiaca_id')->constrained('atencao_basica_cadastro_doenca_cardiaca');
$table->primary(['paciente_condicao_saude_id', 'doenca_cardiaca_id']);
MigrationUtil::addCommonFields($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('cadastro_paciente_condicao_saude_doenca_cardiaca');
}
}

View File

@@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateCadastroPacienteCondicaoSaudeProblemasRinsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('cadastro_paciente_condicao_saude_problemas_rins', function (Blueprint $table) {
$table->foreignId('paciente_condicao_saude_id')->constrained('cadastro_paciente_condicao_saude');
$table->foreignId('problemas_rins_id')->constrained('atencao_basica_cadastro_problemas_rins');
$table->primary(['paciente_condicao_saude_id', 'problemas_rins_id']);
MigrationUtil::addCommonFields($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('cadastro_paciente_condicao_saude_problemas_rins');
}
}

View File

@@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateCadastroPacienteCondicaoSaudeDoencaRespiratoriaTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('cadastro_paciente_condicao_saude_doenca_respiratoria', function (Blueprint $table) {
$table->foreignId('paciente_condicao_saude_id')->constrained('cadastro_paciente_condicao_saude');
$table->foreignId('doenca_respiratoria_id')->constrained('atencao_basica_cadastro_doenca_respiratoria');
$table->primary(['paciente_condicao_saude_id', 'doenca_respiratoria_id']);
MigrationUtil::addCommonFields($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('cadastro_paciente_condicao_saude_doenca_respiratoria');
}
}

Some files were not shown because too many files have changed in this diff Show More