This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateCadastroLivroRegistroTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('cadastro_livro_registro', 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_livro_registro');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateCadastroLivroRegistroTipoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('cadastro_livro_registro_tipo', 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_livro_registro_tipo');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateCadastroMaterialTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('cadastro_material', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->string('descricao', 100);
|
||||
$table->string('codigo_material', 10)->nullable();
|
||||
$table->foreignId('unidade_medida_id')->constrained('cadastro_unidade_medida');
|
||||
$table->decimal('volume_unidade_medida')->nullable();
|
||||
$table->foreignId('grupo_id')->constrained('cadastro_grupo');
|
||||
$table->foreignId('subgrupo_id')->nullable()->constrained('cadastro_subgrupo');
|
||||
$table->boolean('is_ativo')->default(true);
|
||||
|
||||
//Medicamento
|
||||
$table->foreignId('receita_tipo_id')->nullable()->constrained('cadastro_receita_tipo');
|
||||
$table->foreignId('livro_registro_id')->nullable()->constrained('cadastro_livro_registro');
|
||||
$table->foreignId('livro_registro_tipo_id')->nullable()->constrained('cadastro_livro_registro_tipo');
|
||||
$table->foreignId('forma_farmaceutica_id')->nullable()->constrained('cadastro_forma_farmaceutica');
|
||||
$table->foreignId('via_administracao_id')->nullable()->constrained('cadastro_via_administracao');
|
||||
$table->foreignId('material_bndasaf_id')->nullable()->constrained('cadastro_material_bndasaf');
|
||||
$table->boolean('is_exibir_receita')->default(false);
|
||||
$table->boolean('is_exibir_prescricao_interna')->default(false);
|
||||
$table->boolean('is_alto_custo')->default(false);
|
||||
$table->boolean('is_programa_remedio_em_casa')->default(false);
|
||||
$table->boolean('is_acao_judicial')->default(false);
|
||||
$table->boolean('is_remume')->default(false);
|
||||
|
||||
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('cadastro_material');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateCadastroUnidadeApresentacaoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('cadastro_unidade_apresentacao', function (Blueprint $table) {
|
||||
|
||||
MigrationUtil::idWithoutIncrements($table);
|
||||
|
||||
$table->string('nome', 100)->unique();
|
||||
$table->string('sigla', 10);
|
||||
|
||||
MigrationUtil::addCommonFields($table, ['staticData' => true]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('cadastro_unidade_apresentacao');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddFieldUnidadeApresentacaoIdIntoCadastroMaterial extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('cadastro_material', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('unidade_apresentacao_id')
|
||||
->after('codigo_material')
|
||||
->constrained('cadastro_unidade_apresentacao');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('cadastro_material', function (Blueprint $table) {
|
||||
|
||||
MigrationUtil::dropColumnWithForeign($table, 'unidade_apresentacao_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AlterFieldNameFromVolumeUnidadeMedidaToQuantidade extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('cadastro_material', function (Blueprint $table) {
|
||||
|
||||
$table->renameColumn('volume_unidade_medida', 'quantidade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('cadastro_material', function (Blueprint $table) {
|
||||
|
||||
$table->renameColumn('quantidade', 'volume_unidade_medida');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AlterTableNameFromCadastroUnidadeApresentacaoToCadastroApresentacao extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::rename('cadastro_unidade_apresentacao', 'cadastro_apresentacao');
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::rename('cadastro_apresentacao', 'cadastro_unidade_apresentacao');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AlterFieldUnidadeApresentacaoIdFromCadastroMaterial extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('cadastro_material', function (Blueprint $table) {
|
||||
|
||||
$table->renameColumn('unidade_apresentacao_id', 'apresentacao_id');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('cadastro_material', function (Blueprint $table) {
|
||||
|
||||
$table->renameColumn('apresentacao_id', 'unidade_apresentacao_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddPossuiLoteIntoCadastroMaterial extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('cadastro_material', function (Blueprint $table) {
|
||||
|
||||
$table->boolean('possui_lote')->default(false);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('cadastro_material', function (Blueprint $table) {
|
||||
|
||||
$table->dropColumn('possui_lote');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class RenameMaterialBndasafIdToMaterialBnafarIdOnCadastroMaterialTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('cadastro_material', function (Blueprint $table) {
|
||||
MigrationUtil::dropColumnWithForeign($table, 'material_bndasaf_id');
|
||||
$table->foreignId('material_bnafar_id')->nullable()->after('via_administracao_id')->constrained('cadastro_material_bnafar');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('cadastro_material', function (Blueprint $table) {
|
||||
MigrationUtil::dropColumnWithForeign($table, 'material_bnafar_id');
|
||||
$table->foreignId('material_bndasaf_id')->nullable()->after('via_administracao_id')->constrained('cadastro_material_bnafar');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddConcentracaoApresentacaoUnidadeMedidaIdToCadastroMaterial extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('cadastro_material', function (Blueprint $table) {
|
||||
|
||||
$table->unsignedInteger('concentracao')->nullable()->after('codigo_material');
|
||||
|
||||
$table->foreignId('apresentacao_unidade_medida_id')
|
||||
->nullable()
|
||||
->after('quantidade')
|
||||
->constrained('cadastro_unidade_medida');
|
||||
|
||||
$table->foreignId('unidade_medida_id')->nullable()->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('cadastro_material', function (Blueprint $table) {
|
||||
|
||||
$table->dropColumn('concentracao');
|
||||
|
||||
MigrationUtil::dropColumnWithForeign($table, 'apresentacao_unidade_medida_id');
|
||||
|
||||
$table->foreignId('unidade_medida_id')->nullable(false)->change();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class DropConcentracaoUnidadeMedidaOnCadastroMaterialTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('cadastro_material', function (Blueprint $table) {
|
||||
|
||||
$table->dropColumn('concentracao');
|
||||
|
||||
MigrationUtil::dropColumnWithForeign($table, 'unidade_medida_id');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('cadastro_material', function (Blueprint $table) {
|
||||
|
||||
$table->unsignedInteger('concentracao')->nullable()->after('codigo_material');
|
||||
|
||||
$table->foreignId('unidade_medida_id')
|
||||
->nullable()
|
||||
->after('concentracao')
|
||||
->constrained('cadastro_unidade_medida');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddPrescricaoUnidadeMedidaIdToCadastroMaterialTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('cadastro_material', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('prescricao_unidade_medida_id')
|
||||
->nullable()
|
||||
->after('apresentacao_unidade_medida_id')
|
||||
->constrained('cadastro_unidade_medida');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('cadastro_material', function (Blueprint $table) {
|
||||
|
||||
MigrationUtil::dropColumnWithForeign($table, 'prescricao_unidade_medida_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AlterarDescricaoCadastroMaterialBnafar extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('cadastro_material_bnafar', function (Blueprint $table) {
|
||||
$table->string('descricao', 250)->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('cadastro_material_bnafar', function (Blueprint $table) {
|
||||
$table->string('descricao', 200)->change();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddQuantidadeGotasMlToCadastroMaterialTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('cadastro_material', function (Blueprint $table) {
|
||||
|
||||
$table->decimal('quantidade_gotas_ml', 6, 3)->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('cadastro_material', function (Blueprint $table) {
|
||||
|
||||
$table->dropColumn('quantidade_gotas_ml');
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user