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 CreateAlmoxarifadoMotivoBaixaTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('almoxarifado_motivo_baixa', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->string('descricao', 100);
|
||||
$table->boolean('justificar')->default(false);
|
||||
|
||||
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('almoxarifado_motivo_baixa');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAlmoxarifadoDocumentoTipoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('almoxarifado_documento_tipo', function (Blueprint $table) {
|
||||
|
||||
MigrationUtil::idWithoutIncrements($table);
|
||||
|
||||
$table->string('nome', 50)->unique();
|
||||
|
||||
MigrationUtil::addCommonFields($table, ['staticData' => true]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('almoxarifado_documento_tipo');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAlmoxarifadoEntradaTipoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('almoxarifado_entrada_tipo', function (Blueprint $table) {
|
||||
|
||||
MigrationUtil::idWithoutIncrements($table);
|
||||
|
||||
$table->string('nome', 50)->unique();
|
||||
|
||||
MigrationUtil::addCommonFields($table, ['staticData' => true]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('almoxarifado_entrada_tipo');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAlmoxarifadoEntradaTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('almoxarifado_entrada', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->foreignId('tipo_id')->constrained('almoxarifado_entrada_tipo');
|
||||
$table->boolean('finalizada')->default(false);
|
||||
$table->timestamp('finalizada_em')->nullable();
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('almoxarifado_entrada');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAlmoxarifadoEntradaDocumentoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('almoxarifado_entrada_documento', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->foreignId('entrada_id')->constrained('almoxarifado_entrada')->onDelete('cascade');
|
||||
$table->foreignId('tipo_id')->constrained('almoxarifado_documento_tipo');
|
||||
$table->foreignId('fornecedor_id')->constrained('cadastro_fornecedor');
|
||||
$table->string('numero_pedido', 20);
|
||||
$table->string('numero', 10);
|
||||
$table->date('data');
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('almoxarifado_entrada_documento');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAlmoxarifadoEntradaItemTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('almoxarifado_entrada_item', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->foreignId('entrada_id')->constrained('almoxarifado_entrada')->onDelete('cascade');
|
||||
$table->foreignId('material_id')->constrained('cadastro_material');
|
||||
$table->unsignedInteger('quantidade');
|
||||
$table->string('lote', 15)->nullable();
|
||||
$table->date('validade_lote')->nullable();
|
||||
$table->decimal('valor_total', 14, 6);
|
||||
$table->decimal('valor_unitario', 14, 6);
|
||||
$table->string('numero_empenho', 20)->nullable();
|
||||
$table->decimal('despesas', 14, 6)->nullable();
|
||||
$table->string('numero_autorizacao_fornecimento', 9)->nullable();
|
||||
$table->foreignId('fabricante_id')->nullable()->constrained('cadastro_fabricante');
|
||||
$table->string('codigo_barras', 13)->nullable();
|
||||
$table->timestamp('estornado_em')->nullable();
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('almoxarifado_entrada_item');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAlmoxarifadoSaidaTipoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('almoxarifado_saida_tipo', function (Blueprint $table) {
|
||||
|
||||
MigrationUtil::idWithoutIncrements($table);
|
||||
|
||||
$table->string('nome', 50)->unique();
|
||||
|
||||
MigrationUtil::addCommonFields($table, ['staticData' => true]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('almoxarifado_saida_tipo');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAlmoxarifadoSaidaTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('almoxarifado_saida', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->foreignId('tipo_id')->constrained('almoxarifado_saida_tipo');
|
||||
$table->boolean('finalizada')->default(false);
|
||||
$table->timestamp('finalizada_em')->nullable();
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('almoxarifado_saida');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAlmoxarifadoSaidaRequisicaoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('almoxarifado_saida_requisicao', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->foreignId('saida_id')->constrained('almoxarifado_saida')->onDelete('cascade');
|
||||
$table->foreignId('infraestrutura_id')->constrained('cadastro_infraestrutura');
|
||||
$table->foreignId('usuario_id')->constrained('cadastro_usuario');
|
||||
$table->string('numero', 20)->unique();
|
||||
$table->date('data');
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('almoxarifado_saida_requisicao');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAlmoxarifadoSaidaItemTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('almoxarifado_saida_item', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->foreignId('saida_id')->constrained('almoxarifado_saida')->onDelete('cascade');
|
||||
$table->foreignId('material_id')->constrained('cadastro_material');
|
||||
$table->boolean('escolheu_entrada_item_manualmente');
|
||||
$table->timestamp('estornado_em')->nullable();
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('almoxarifado_saida_item');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAlmoxarifadoSaidaItemEntradaItemTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('almoxarifado_saida_item_entrada_item', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('saida_item_id')->constrained('almoxarifado_saida_item');
|
||||
$table->foreignId('entrada_item_id')->constrained('almoxarifado_entrada_item');
|
||||
$table->unsignedInteger('quantidade_saida');
|
||||
$table->foreignId('entrada_item_estornado_id')->nullable()->constrained('almoxarifado_entrada_item');
|
||||
|
||||
$table->primary(['saida_item_id', 'entrada_item_id']);
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('almoxarifado_saida_item_entrada_item');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddSaidaItemEstornoIdToAlmoxarifadoEntradaItem extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('almoxarifado_entrada_item', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('saida_item_estornado_id')
|
||||
->nullable()
|
||||
->after('estornado_em')
|
||||
->constrained('almoxarifado_saida_item');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('almoxarifado_entrada_item', function (Blueprint $table) {
|
||||
|
||||
MigrationUtil::dropColumnWithForeign($table, 'saida_item_estornado_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAlmoxarifadoSaidaBaixaTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('almoxarifado_saida_baixa', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->foreignId('saida_id')->constrained('almoxarifado_saida')->onDelete('cascade');
|
||||
$table->foreignId('motivo_id')->constrained('almoxarifado_motivo_baixa');
|
||||
$table->string('justificativa', 100)->nullable();
|
||||
$table->foreignId('usuario_solicitante_id')->nullable()->constrained('cadastro_usuario');
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('almoxarifado_saida_baixa');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddConsumoInternoToAlmoxarifadoMotivoBaixa extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('almoxarifado_motivo_baixa', function (Blueprint $table) {
|
||||
|
||||
$table->boolean('consumo_interno')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('almoxarifado_motivo_baixa', function (Blueprint $table) {
|
||||
|
||||
$table->dropColumn('consumo_interno');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAlmoxarifadoInventarioTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('almoxarifado_inventario', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->boolean('finalizado')->default(false);
|
||||
$table->timestamp('finalizado_em')->nullable();
|
||||
$table->foreignId('material_id')->constrained('cadastro_material');
|
||||
$table->string('lote', 15)->nullable();
|
||||
$table->date('validade_lote')->nullable();
|
||||
$table->unsignedInteger('contagem')->nullable();
|
||||
$table->boolean('is_novo_lote')->default(false);
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('almoxarifado_inventario');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class SetFieldsToNullableAtAlmoxarifadoEntradaDocumento extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('almoxarifado_entrada_documento', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('tipo_id')->nullable()->change();
|
||||
$table->string('numero_pedido', 20)->nullable()->change();
|
||||
$table->string('numero', 10)->nullable()->change();
|
||||
$table->date('data')->nullable()->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('almoxarifado_entrada_documento', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('tipo_id')->nullable(false)->change();
|
||||
$table->string('numero_pedido', 20)->nullable(false)->change();
|
||||
$table->string('numero', 10)->nullable(false)->change();
|
||||
$table->date('data')->nullable(false)->change();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AlterAlmoxarifadoSaidaRequisicao extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('almoxarifado_saida_requisicao', function (Blueprint $table) {
|
||||
|
||||
MigrationUtil::dropColumnWithForeign($table, 'infraestrutura_id');
|
||||
|
||||
$table->foreignId('centro_custo_id')->after('saida_id')->constrained('cadastro_centro_custo');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('almoxarifado_saida_requisicao', function (Blueprint $table) {
|
||||
|
||||
MigrationUtil::dropColumnWithForeign($table, 'centro_custo_id');
|
||||
|
||||
$table->foreignId('infraestrutura_id')->after('saida_id')->constrained('cadastro_infraestrutura');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAlmoxarifadoParametrizacaoRequisicaoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('almoxarifado_parametrizacao_requisicao', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->boolean('numero_requisicao_automatico')->default(false);
|
||||
$table->boolean('permite_requisitar_materiais_sem_estoque')->default(false);
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('almoxarifado_parametrizacao_requisicao');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAlmoxarifadoParametrizacaoControleEstoqueGrupoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('almoxarifado_parametrizacao_controle_estoque_grupo', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->foreignId('centro_custo_id')->constrained('cadastro_centro_custo');
|
||||
$table->foreignId('grupo_id')->constrained('cadastro_grupo');
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('almoxarifado_parametrizacao_controle_estoque_grupo');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAlmoxarifadoParametrizacaoControleEstoqueSubgrupoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('almoxarifado_parametrizacao_controle_estoque_subgrupo', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
|
||||
$table->foreignId('parametrizacao_controle_estoque_grupo_id')
|
||||
->constrained('almoxarifado_parametrizacao_controle_estoque_grupo')
|
||||
->onDelete('cascade');
|
||||
|
||||
$table->foreignId('subgrupo_id')->constrained('cadastro_subgrupo');
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('almoxarifado_parametrizacao_controle_estoque_subgrupo');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAlmoxarifadoRequisicaoPermissaoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('almoxarifado_requisicao_permissao', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->foreignId('centro_custo_requisitante_id')->constrained('cadastro_centro_custo');
|
||||
$table->foreignId('material_id')->constrained('cadastro_material');
|
||||
$table->integer('estoque_maximo')->nullable();
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('almoxarifado_requisicao_permissao');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAlmoxarifadoReservaMotivoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('almoxarifado_reserva_motivo', function (Blueprint $table) {
|
||||
|
||||
MigrationUtil::idWithoutIncrements($table);
|
||||
|
||||
$table->string('nome', 50)->unique();
|
||||
|
||||
MigrationUtil::addCommonFields($table, ['staticData' => true]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('almoxarifado_reserva_motivo');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAlmoxarifadoReservaTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('almoxarifado_reserva', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->foreignId('motivo_id')->constrained('almoxarifado_reserva_motivo');
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('almoxarifado_reserva');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAlmoxarifadoReservaItemTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('almoxarifado_reserva_item', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->foreignId('reserva_id')->constrained('almoxarifado_reserva')->onDelete('cascade');
|
||||
$table->foreignId('material_id')->constrained('cadastro_material');
|
||||
$table->boolean('escolheu_entrada_item_manualmente');
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('almoxarifado_reserva_item');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAlmoxarifadoReservaItemEntradaItemTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('almoxarifado_reserva_item_entrada_item', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('reserva_item_id')->constrained('almoxarifado_reserva_item');
|
||||
$table->foreignId('entrada_item_id')->constrained('almoxarifado_entrada_item');
|
||||
$table->unsignedInteger('quantidade_saida');
|
||||
|
||||
$table->primary(['reserva_item_id', 'entrada_item_id']);
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('almoxarifado_reserva_item_entrada_item');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAlmoxarifadoRequisicaoStatusTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('almoxarifado_requisicao_status', function (Blueprint $table) {
|
||||
|
||||
MigrationUtil::idWithoutIncrements($table);
|
||||
|
||||
$table->string('nome', 50)->unique();
|
||||
|
||||
MigrationUtil::addCommonFields($table, ['staticData' => true]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('almoxarifado_requisicao_status');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAlmoxarifadoRequisicaoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('almoxarifado_requisicao', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->foreignId('status_id')->constrained('almoxarifado_requisicao_status');
|
||||
$table->foreignId('centro_custo_id')->constrained('cadastro_centro_custo');
|
||||
$table->string('numero', 20)->unique();
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('almoxarifado_requisicao');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAlmoxarifadoRequisicaoItemTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('almoxarifado_requisicao_item', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->foreignId('requisicao_id')->constrained('almoxarifado_requisicao')->onDelete('cascade');
|
||||
$table->foreignId('material_id')->constrained('cadastro_material');
|
||||
$table->integer('quantidade');
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('almoxarifado_requisicao_item');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAlmoxarifadoRequisicaoRespostaStatusTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('almoxarifado_requisicao_resposta_status', function (Blueprint $table) {
|
||||
|
||||
MigrationUtil::idWithoutIncrements($table);
|
||||
|
||||
$table->string('nome', 50)->unique();
|
||||
|
||||
MigrationUtil::addCommonFields($table, ['staticData' => true]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('almoxarifado_requisicao_resposta_status');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAlmoxarifadoRequisicaoRespostaTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('almoxarifado_requisicao_resposta', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->foreignId('status_id')->constrained('almoxarifado_requisicao_resposta_status');
|
||||
$table->foreignId('requisicao_id')->constrained('almoxarifado_requisicao');
|
||||
$table->foreignId('reserva_id')->nullable()->constrained('almoxarifado_reserva');
|
||||
$table->foreignId('saida_id')->nullable()->constrained('almoxarifado_saida');
|
||||
$table->foreignId('entrada_id')->nullable()->constrained('almoxarifado_entrada');
|
||||
$table->string('observacoes', 1000)->nullable();
|
||||
$table->timestamp('enviada_em')->nullable();
|
||||
$table->timestamp('recebida_em')->nullable();
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('almoxarifado_requisicao_resposta');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAlmoxarifadoRequisicaoRespostaItemMotivoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('almoxarifado_requisicao_resposta_item_motivo', function (Blueprint $table) {
|
||||
|
||||
MigrationUtil::idWithoutIncrements($table);
|
||||
|
||||
$table->string('nome', 50)->unique();
|
||||
|
||||
MigrationUtil::addCommonFields($table, ['staticData' => true]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('almoxarifado_requisicao_resposta_item_motivo');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAlmoxarifadoRequisicaoRespostaItemTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('almoxarifado_requisicao_resposta_item', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->foreignId('requisicao_resposta_id')->constrained('almoxarifado_requisicao_resposta')->onDelete('cascade');
|
||||
$table->foreignId('requisicao_item_id')->constrained('almoxarifado_requisicao_item');
|
||||
$table->foreignId('reserva_item_id')->nullable()->constrained('almoxarifado_reserva_item');
|
||||
$table->foreignId('saida_item_id')->nullable()->constrained('almoxarifado_saida_item');
|
||||
$table->foreignId('motivo_id')->nullable()->constrained('almoxarifado_requisicao_resposta_item_motivo');
|
||||
$table->string('motivo_outro', 300)->nullable();
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('almoxarifado_requisicao_resposta_item');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAlmoxarifadoRequisicaoRespostaItemEntradaItemTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('almoxarifado_requisicao_resposta_item_entrada_item', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('requisicao_resposta_item_id')->constrained('almoxarifado_requisicao_resposta_item');
|
||||
$table->foreignId('entrada_item_id')->constrained('almoxarifado_entrada_item');
|
||||
|
||||
$table->primary(['requisicao_resposta_item_id', 'entrada_item_id']);
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('almoxarifado_requisicao_resposta_item_entrada_item');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAlmoxarifadoRequisicaoRespostaItemRecebimentoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('almoxarifado_requisicao_resposta_item_recebimento', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->foreignId('requisicao_resposta_item_id')->constrained('almoxarifado_requisicao_resposta_item')->onDelete('cascade');
|
||||
$table->foreignId('entrada_item_origem_id')->nullable()->constrained('almoxarifado_entrada_item');
|
||||
$table->unsignedInteger('quantidade');
|
||||
$table->string('lote', 15)->nullable();
|
||||
$table->date('validade_lote')->nullable();
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('almoxarifado_requisicao_resposta_item_recebimento');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class DropEntradaIdOnAlmoxarifadoRequisicaoRespostaTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('almoxarifado_requisicao_resposta', function (Blueprint $table) {
|
||||
|
||||
MigrationUtil::dropColumnWithForeign($table, 'entrada_id');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('almoxarifado_requisicao_resposta', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('entrada_id')->nullable()->constrained('almoxarifado_entrada');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAlmoxarifadoBalanceteFechamentoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('almoxarifado_balancete_fechamento', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->unsignedTinyInteger('mes');
|
||||
$table->year('ano');
|
||||
$table->integer('saldo_fisico');
|
||||
$table->decimal('saldo_financeiro', 18, 6);
|
||||
|
||||
$table->unique(['mes', 'ano']);
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('almoxarifado_balancete_fechamento');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddCentroCustoIdToAlmoxarifadoEntrada extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
DB::transaction(function () {
|
||||
|
||||
Schema::table('almoxarifado_entrada', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('centro_custo_id')->nullable()->after('id')->constrained('cadastro_centro_custo');
|
||||
});
|
||||
|
||||
DB::statement("UPDATE almoxarifado_entrada SET centro_custo_id = created_centro_custo_id");
|
||||
|
||||
Schema::table('almoxarifado_entrada', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('centro_custo_id')->nullable(false)->change();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('almoxarifado_entrada', function (Blueprint $table) {
|
||||
|
||||
MigrationUtil::dropColumnWithForeign($table, 'centro_custo_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddCentroCustoIdToAlmoxarifadoSaida extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
DB::transaction(function () {
|
||||
|
||||
Schema::table('almoxarifado_saida', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('centro_custo_id')->nullable()->after('id')->constrained('cadastro_centro_custo');
|
||||
});
|
||||
|
||||
DB::statement("UPDATE almoxarifado_saida SET centro_custo_id = created_centro_custo_id");
|
||||
|
||||
Schema::table('almoxarifado_saida', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('centro_custo_id')->nullable(false)->change();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('almoxarifado_saida', function (Blueprint $table) {
|
||||
|
||||
MigrationUtil::dropColumnWithForeign($table, 'centro_custo_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAlmoxarifadoSaidaTransferenciaTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('almoxarifado_saida_transferencia', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->foreignId('saida_id')->constrained('almoxarifado_saida')->onDelete('cascade');
|
||||
$table->foreignId('centro_custo_id')->constrained('cadastro_centro_custo');
|
||||
$table->foreignId('usuario_id')->constrained('cadastro_usuario');
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('almoxarifado_saida_transferencia');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAlmoxarifadoSaidaItemEntradaItemTransferenciaTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('almoxarifado_saida_item_entrada_item_transferencia', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('saida_item_origem_id')->constrained('almoxarifado_saida_item');
|
||||
$table->foreignId('entrada_item_destino_id')->constrained('almoxarifado_entrada_item');
|
||||
|
||||
$table->primary(['saida_item_origem_id', 'entrada_item_destino_id']);
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('almoxarifado_saida_item_entrada_item_transferencia');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddEnviadaLotacaoIdToAlmoxarifadoRequisicaoRespostaTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('almoxarifado_requisicao_resposta', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('enviada_lotacao_id')->nullable()->after('enviada_em')->constrained('cadastro_lotacao');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('almoxarifado_requisicao_resposta', function (Blueprint $table) {
|
||||
|
||||
MigrationUtil::dropColumnWithForeign($table, 'enviada_lotacao_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAlmoxarifadoParametrizacaoEstoqueTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('almoxarifado_parametrizacao_estoque', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->foreignId('centro_custo_id')->constrained('cadastro_centro_custo');
|
||||
$table->foreignId('material_id')->constrained('cadastro_material');
|
||||
$table->integer('estoque_minimo')->nullable();
|
||||
$table->integer('estoque_maximo')->nullable();
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('almoxarifado_parametrizacao_estoque');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAlmoxarifadoMotivoBaixaTipoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('almoxarifado_motivo_baixa_tipo', function (Blueprint $table) {
|
||||
|
||||
MigrationUtil::idWithoutIncrements($table);
|
||||
|
||||
$table->string('nome', 50)->unique();
|
||||
|
||||
MigrationUtil::addCommonFields($table, ['staticData' => true]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('almoxarifado_motivo_baixa_tipo');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddTipoIdToAlmoxarifadoMotivoBaixaTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('almoxarifado_motivo_baixa', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('tipo_id')->nullable()->before('descricao')->constrained('almoxarifado_motivo_baixa_tipo');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('almoxarifado_motivo_baixa', function (Blueprint $table) {
|
||||
|
||||
MigrationUtil::dropColumnWithForeign($table, 'tipo_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
use App\Enums\Almoxarifado\MotivoBaixaTipo;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class DropConsumoInternoOnAlmoxarifadoMotivoBaixaTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::disableForeignKeyConstraints();
|
||||
|
||||
DB::statement("
|
||||
UPDATE almoxarifado_motivo_baixa
|
||||
SET tipo_id = " . MotivoBaixaTipo::CONSUMO_INTERNO . "
|
||||
WHERE consumo_interno = 1
|
||||
");
|
||||
|
||||
Schema::enableForeignKeyConstraints();
|
||||
|
||||
Schema::table('almoxarifado_motivo_baixa', function (Blueprint $table) {
|
||||
|
||||
$table->dropColumn('consumo_interno');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('almoxarifado_motivo_baixa', function (Blueprint $table) {
|
||||
|
||||
$table->boolean('consumo_interno')->nullable();
|
||||
});
|
||||
|
||||
DB::statement("
|
||||
UPDATE almoxarifado_motivo_baixa
|
||||
SET consumo_interno = 1
|
||||
WHERE tipo_id = " . MotivoBaixaTipo::CONSUMO_INTERNO . "
|
||||
");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddControlavaEstoqueToAlmoxarifadoRequisicaoRespostaItemRecebimento extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('almoxarifado_requisicao_resposta_item_recebimento', function (Blueprint $table) {
|
||||
|
||||
$table->boolean('controlava_estoque')->nullable()->after('validade_lote');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('almoxarifado_requisicao_resposta_item_recebimento', function (Blueprint $table) {
|
||||
|
||||
$table->dropColumn('controlava_estoque');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,166 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class CreateTriggersValidaEstoqueAlmoxarifado extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
DB::statement("
|
||||
CREATE OR REPLACE TRIGGER tr_almoxarifado_saida_valida_estoque_before_insert
|
||||
BEFORE INSERT ON almoxarifado_saida_item_entrada_item
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
DECLARE estoque BIGINT;
|
||||
|
||||
SELECT (
|
||||
ei.quantidade
|
||||
-
|
||||
COALESCE((
|
||||
SELECT SUM(siei.quantidade_saida)
|
||||
FROM almoxarifado_saida_item_entrada_item siei
|
||||
JOIN almoxarifado_saida_item si ON si.id = siei.saida_item_id
|
||||
JOIN almoxarifado_saida s ON s.id = si.saida_id
|
||||
WHERE s.finalizada
|
||||
AND siei.entrada_item_id = ei.id
|
||||
), 0)
|
||||
-
|
||||
COALESCE((
|
||||
SELECT SUM(riei.quantidade_saida)
|
||||
FROM almoxarifado_reserva_item_entrada_item riei
|
||||
WHERE riei.entrada_item_id = ei.id
|
||||
), 0)
|
||||
) INTO estoque
|
||||
FROM almoxarifado_entrada_item ei
|
||||
WHERE ei.id = NEW.entrada_item_id;
|
||||
|
||||
IF NEW.quantidade_saida > estoque THEN
|
||||
SIGNAL SQLSTATE '45000' SET MYSQL_ERRNO=12340, MESSAGE_TEXT = 'QUANTIDADE INSUFICIENTE';
|
||||
END IF;
|
||||
END;
|
||||
");
|
||||
|
||||
DB::statement("
|
||||
CREATE OR REPLACE TRIGGER tr_almoxarifado_saida_valida_estoque_before_update
|
||||
BEFORE UPDATE ON almoxarifado_saida_item_entrada_item
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
DECLARE estoque BIGINT;
|
||||
|
||||
SELECT (
|
||||
ei.quantidade
|
||||
-
|
||||
COALESCE((
|
||||
SELECT SUM(siei.quantidade_saida)
|
||||
FROM almoxarifado_saida_item_entrada_item siei
|
||||
JOIN almoxarifado_saida_item si ON si.id = siei.saida_item_id
|
||||
JOIN almoxarifado_saida s ON s.id = si.saida_id
|
||||
WHERE s.finalizada
|
||||
AND siei.entrada_item_id = ei.id
|
||||
AND siei.saida_item_id <> NEW.saida_item_id
|
||||
), 0)
|
||||
-
|
||||
COALESCE((
|
||||
SELECT SUM(riei.quantidade_saida)
|
||||
FROM almoxarifado_reserva_item_entrada_item riei
|
||||
WHERE riei.entrada_item_id = ei.id
|
||||
), 0)
|
||||
) INTO estoque
|
||||
FROM almoxarifado_entrada_item ei
|
||||
WHERE ei.id = NEW.entrada_item_id;
|
||||
|
||||
IF NEW.quantidade_saida > estoque THEN
|
||||
SIGNAL SQLSTATE '45000' SET MYSQL_ERRNO=12340, MESSAGE_TEXT = 'QUANTIDADE INSUFICIENTE';
|
||||
END IF;
|
||||
END;
|
||||
");
|
||||
|
||||
DB::statement("
|
||||
CREATE OR REPLACE TRIGGER tr_almoxarifado_reserva_valida_estoque_before_insert
|
||||
BEFORE INSERT ON almoxarifado_reserva_item_entrada_item
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
DECLARE estoque BIGINT;
|
||||
|
||||
SELECT (
|
||||
ei.quantidade
|
||||
-
|
||||
COALESCE((
|
||||
SELECT SUM(siei.quantidade_saida)
|
||||
FROM almoxarifado_saida_item_entrada_item siei
|
||||
JOIN almoxarifado_saida_item si ON si.id = siei.saida_item_id
|
||||
JOIN almoxarifado_saida s ON s.id = si.saida_id
|
||||
WHERE s.finalizada
|
||||
AND siei.entrada_item_id = ei.id
|
||||
), 0)
|
||||
-
|
||||
COALESCE((
|
||||
SELECT SUM(riei.quantidade_saida)
|
||||
FROM almoxarifado_reserva_item_entrada_item riei
|
||||
WHERE riei.entrada_item_id = ei.id
|
||||
), 0)
|
||||
) INTO estoque
|
||||
FROM almoxarifado_entrada_item ei
|
||||
WHERE ei.id = NEW.entrada_item_id;
|
||||
|
||||
IF NEW.quantidade_saida > estoque THEN
|
||||
SIGNAL SQLSTATE '45000' SET MYSQL_ERRNO=12340, MESSAGE_TEXT = 'QUANTIDADE INSUFICIENTE';
|
||||
END IF;
|
||||
END;
|
||||
");
|
||||
|
||||
DB::statement("
|
||||
CREATE OR REPLACE TRIGGER tr_almoxarifado_reserva_valida_estoque_before_update
|
||||
BEFORE UPDATE ON almoxarifado_reserva_item_entrada_item
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
DECLARE estoque BIGINT;
|
||||
|
||||
SELECT (
|
||||
ei.quantidade
|
||||
-
|
||||
COALESCE((
|
||||
SELECT SUM(siei.quantidade_saida)
|
||||
FROM almoxarifado_saida_item_entrada_item siei
|
||||
JOIN almoxarifado_saida_item si ON si.id = siei.saida_item_id
|
||||
JOIN almoxarifado_saida s ON s.id = si.saida_id
|
||||
WHERE s.finalizada
|
||||
AND siei.entrada_item_id = ei.id
|
||||
), 0)
|
||||
-
|
||||
COALESCE((
|
||||
SELECT SUM(riei.quantidade_saida)
|
||||
FROM almoxarifado_reserva_item_entrada_item riei
|
||||
WHERE riei.entrada_item_id = ei.id
|
||||
AND riei.reserva_item_id <> NEW.reserva_item_id
|
||||
), 0)
|
||||
) INTO estoque
|
||||
FROM almoxarifado_entrada_item ei
|
||||
WHERE ei.id = NEW.entrada_item_id;
|
||||
|
||||
IF NEW.quantidade_saida > estoque THEN
|
||||
SIGNAL SQLSTATE '45000' SET MYSQL_ERRNO=12340, MESSAGE_TEXT = 'QUANTIDADE INSUFICIENTE';
|
||||
END IF;
|
||||
END;
|
||||
");
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
DB::statement("DROP TRIGGER IF EXISTS tr_almoxarifado_saida_valida_estoque_before_insert;");
|
||||
DB::statement("DROP TRIGGER IF EXISTS tr_almoxarifado_saida_valida_estoque_before_update;");
|
||||
DB::statement("DROP TRIGGER IF EXISTS tr_almoxarifado_reserva_valida_estoque_before_insert;");
|
||||
DB::statement("DROP TRIGGER IF EXISTS tr_almoxarifado_reserva_valida_estoque_before_update;");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAlmoxarifadoDispensacaoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('almoxarifado_dispensacao', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('usuario_id')->constrained('cadastro_usuario');
|
||||
$table->foreignId('paciente_id')->constrained('cadastro_paciente');
|
||||
$table->date('data_dispensacao');
|
||||
$table->string('observacao', 300)->nullable();
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('almoxarifado_dispensacao');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAlmoxarifadoDispensacaoItemTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('almoxarifado_dispensacao_item', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('dispensacao_id')->constrained('almoxarifado_dispensacao');
|
||||
$table->foreignId('material_id')->constrained('cadastro_material');
|
||||
$table->foreignId('saida_item_id')->nullable()->constrained('almoxarifado_saida_item');
|
||||
$table->integer('quantidade');
|
||||
$table->date('dispensado_em');
|
||||
$table->boolean('estornado')->default(false);
|
||||
$table->string('observacao', 300)->nullable();
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('almoxarifado_dispensacao_item');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddPrazoValidadeToAlmoxarifadoParametrizacaoRequisicao extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('almoxarifado_parametrizacao_requisicao', function (Blueprint $table) {
|
||||
$table->integer('prazo_validade')->nullable()->after('permite_requisitar_materiais_sem_estoque');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('almoxarifado_parametrizacao_requisicao', function (Blueprint $table) {
|
||||
$table->dropColumn('prazo_validade');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddMotivoObrigatorioToAlmoxarifadoParametrizacaoRequisicao extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('almoxarifado_parametrizacao_requisicao', function (Blueprint $table) {
|
||||
$table->boolean('motivo_obrigatorio')->default(true)->after('prazo_validade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('almoxarifado_parametrizacao_requisicao', function (Blueprint $table) {
|
||||
$table->dropColumn('motivo_obrigatorio');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAlmoxarifadoParametrizacaoDispensacaoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('almoxarifado_parametrizacao_dispensacao', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('grupo_id')->nullable()->constrained('cadastro_grupo');
|
||||
$table->foreignId('material_id')->nullable()->constrained('cadastro_material');
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('almoxarifado_parametrizacao_dispensacao');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAlmoxarifadoParametrizacaoDispensacaoUnidadeTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('almoxarifado_parametrizacao_dispensacao_unidade', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('centro_custo_id')->constrained('cadastro_centro_custo');
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('almoxarifado_parametrizacao_dispensacao_unidade');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddIntegracaoBnafarMedicamentoIdToAlmoxarifadoEntradaItemTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('almoxarifado_entrada_item', function (Blueprint $table) {
|
||||
$table->foreignId('integracao_bnafar_medicamento_id')->nullable()->after('material_id')->constrained('integracao_bnafar_medicamento');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('almoxarifado_entrada_item', function (Blueprint $table) {
|
||||
$table->dropConstrainedForeignId('integracao_bnafar_medicamento_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddIntegracaoBnafarMedicamentoIdToAlmoxarifadoInventarioTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('almoxarifado_inventario', function (Blueprint $table) {
|
||||
$table->foreignId('integracao_bnafar_medicamento_id')->nullable()->after('material_id')->constrained('integracao_bnafar_medicamento');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('almoxarifado_inventario', function (Blueprint $table) {
|
||||
$table->dropConstrainedForeignId('integracao_bnafar_medicamento_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAlmoxarifadoEntradaLogTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('almoxarifado_entrada_log', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('entrada_id')->constrained('almoxarifado_entrada')->onDelete('cascade');
|
||||
$table->foreignId('centro_custo_id')->nullable()->constrained('cadastro_centro_custo');
|
||||
$table->foreignId('tipo_id')->constrained('almoxarifado_entrada_tipo');
|
||||
$table->boolean('finalizada')->default(false);
|
||||
$table->timestamp('finalizada_em')->nullable();
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('almoxarifado_entrada_log');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAlmoxarifadoEntradaDocumentoLogTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('almoxarifado_entrada_documento_log', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('entrada_documento_id')->constrained('almoxarifado_entrada_documento')->onDelete('cascade');
|
||||
$table->foreignId('entrada_id')->constrained('almoxarifado_entrada')->onDelete('cascade');
|
||||
$table->foreignId('tipo_id')->constrained('almoxarifado_documento_tipo');
|
||||
$table->foreignId('fornecedor_id')->constrained('cadastro_fornecedor');
|
||||
$table->string('numero_pedido', 20);
|
||||
$table->string('numero', 10);
|
||||
$table->date('data');
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('almoxarifado_entrada_documento_log');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAlmoxarifadoEntradaItemLogTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('almoxarifado_entrada_item_log', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('entrada_item_id')->constrained('almoxarifado_entrada_item')->onDelete('cascade');
|
||||
$table->foreignId('entrada_id')->constrained('almoxarifado_entrada')->onDelete('cascade');
|
||||
$table->foreignId('material_id')->constrained('cadastro_material');
|
||||
$table->foreignId('integracao_bnafar_medicamento_id')->nullable()->constrained('integracao_bnafar_medicamento');
|
||||
$table->unsignedInteger('quantidade');
|
||||
$table->string('lote', 15)->nullable();
|
||||
$table->date('validade_lote')->nullable();
|
||||
$table->decimal('valor_total', 14, 6);
|
||||
$table->decimal('valor_unitario', 14, 6);
|
||||
$table->string('numero_empenho', 20)->nullable();
|
||||
$table->decimal('despesas', 14, 6)->nullable();
|
||||
$table->string('numero_autorizacao_fornecimento', 9)->nullable();
|
||||
$table->foreignId('fabricante_id')->nullable()->constrained('cadastro_fabricante');
|
||||
$table->string('codigo_barras', 13)->nullable();
|
||||
$table->timestamp('estornado_em')->nullable();
|
||||
$table->foreignId('saida_item_estornado_id')->nullable()->constrained('almoxarifado_saida_item');
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('almoxarifado_entrada_item_log');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddOrigemProgramaticaIdToAlmoxarifadoEntradaDocumentoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
DB::transaction(function () {
|
||||
Schema::table('almoxarifado_entrada_documento', function (Blueprint $table) {
|
||||
$table->foreignId('origem_programatica_id')->nullable()->after('fornecedor_id')->constrained('cadastro_origem_programatica');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('almoxarifado_entrada_documento', function (Blueprint $table) {
|
||||
MigrationUtil::dropColumnWithForeign($table, 'origem_programatica_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAlmoxarifadoParametrizacaoPortalDivulgacaoGrupoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('almoxarifado_parametrizacao_portal_divulgacao_grupo', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->foreignId('centro_custo_id')->constrained('cadastro_centro_custo');
|
||||
$table->foreignId('grupo_id')->constrained('cadastro_grupo');
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('almoxarifado_parametrizacao_portal_divulgacao_grupo');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAlmoxarifadoParametrizacaoPortalDivulgacaoSubgrupoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('almoxarifado_parametrizacao_portal_divulgacao_subgrupo', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
|
||||
$table->foreignId('parametrizacao_portal_divulgacao_grupo_id')
|
||||
->constrained('almoxarifado_parametrizacao_portal_divulgacao_grupo')
|
||||
->onDelete('cascade');
|
||||
|
||||
$table->foreignId('subgrupo_id')->constrained('cadastro_subgrupo');
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('almoxarifado_parametrizacao_portal_divulgacao_subgrupo');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAlmoxarifadoParametrizacaoPortalDivulgacaoItemTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('almoxarifado_parametrizacao_portal_divulgacao_item', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('parametrizacao_portal_divulgacao_grupo_id')
|
||||
->constrained('almoxarifado_parametrizacao_portal_divulgacao_grupo')
|
||||
->onDelete('cascade');
|
||||
$table->foreignId('material_id')->nullable()->constrained('cadastro_material');
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('almoxarifado_parametrizacao_portal_divulgacao_item');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class UpdateTriggersAlmoxarifado extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
DB::statement("
|
||||
CREATE OR REPLACE TRIGGER tr_almoxarifado_saida_valida_estoque_before_update
|
||||
BEFORE UPDATE ON almoxarifado_saida_item_entrada_item
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
DECLARE estoque BIGINT;
|
||||
|
||||
IF NEW.quantidade_saida <> OLD.quantidade_saida THEN
|
||||
|
||||
SELECT (
|
||||
ei.quantidade
|
||||
- COALESCE((
|
||||
SELECT SUM(siei.quantidade_saida)
|
||||
FROM almoxarifado_saida_item_entrada_item siei
|
||||
JOIN almoxarifado_saida_item si ON si.id = siei.saida_item_id
|
||||
JOIN almoxarifado_saida s ON s.id = si.saida_id
|
||||
WHERE s.finalizada
|
||||
AND siei.entrada_item_id = ei.id
|
||||
AND siei.saida_item_id <> NEW.saida_item_id
|
||||
), 0)
|
||||
- COALESCE((
|
||||
SELECT SUM(riei.quantidade_saida)
|
||||
FROM almoxarifado_reserva_item_entrada_item riei
|
||||
WHERE riei.entrada_item_id = ei.id
|
||||
AND riei.reserva_item_id <> NEW.saida_item_id
|
||||
), 0)
|
||||
) INTO estoque
|
||||
FROM almoxarifado_entrada_item ei
|
||||
WHERE ei.id = NEW.entrada_item_id;
|
||||
|
||||
IF NEW.quantidade_saida > estoque THEN
|
||||
SIGNAL SQLSTATE '45000'
|
||||
SET MYSQL_ERRNO=12340,
|
||||
MESSAGE_TEXT = 'QUANTIDADE INSUFICIENTE';
|
||||
END IF;
|
||||
|
||||
END IF;
|
||||
END;
|
||||
");
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
DB::statement("DROP TRIGGER IF EXISTS tr_almoxarifado_saida_valida_estoque_before_update");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AlterTableAlmoxarifadoEntradaDocumentoLog extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('almoxarifado_entrada_documento_log', function (Blueprint $table) {
|
||||
$table->unsignedBigInteger('tipo_id')->nullable()->change();
|
||||
$table->unsignedBigInteger('numero_pedido')->nullable()->change();
|
||||
$table->unsignedBigInteger('numero')->nullable()->change();
|
||||
$table->unsignedBigInteger('data')->nullable()->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('almoxarifado_entrada_documento_log', function (Blueprint $table) {
|
||||
$table->unsignedBigInteger('tipo_id')->nullable(false)->change();
|
||||
$table->unsignedBigInteger('numero_pedido')->nullable(false)->change();
|
||||
$table->unsignedBigInteger('numero')->nullable(false)->change();
|
||||
$table->unsignedBigInteger('data')->nullable(false)->change();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AlterTableAlmoxarifadoEntradaDocumentoLogAntigo extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('almoxarifado_entrada_documento_log', function (Blueprint $table) {
|
||||
//$table->date('data')->nullable()->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('almoxarifado_entrada_documento_log', function (Blueprint $table) {
|
||||
//$table->bigInteger('data')->nullable()->change();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class AlterTableAlmoxarifadoEntradaDocumentoLogCorrecao extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
DB::statement("ALTER TABLE almoxarifado_entrada_documento_log CHANGE data data DATE DEFAULT NULL;");
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
DB::statement("ALTER TABLE almoxarifado_entrada_documento_log CHANGE data data BIGINT UNSIGNED DEFAULT NULL;");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddConfirmadoToAlmoxarifadoSaidaTransferenciaTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('almoxarifado_saida_transferencia', function (Blueprint $table) {
|
||||
|
||||
$table->boolean('confirmado')->default(false)->after('usuario_id');
|
||||
});
|
||||
|
||||
DB::table('almoxarifado_saida_transferencia')
|
||||
->join('almoxarifado_saida', 'almoxarifado_saida.id', 'almoxarifado_saida_transferencia.saida_id')
|
||||
->where('almoxarifado_saida.finalizada', true)
|
||||
->update(['confirmado' => true]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('almoxarifado_saida_transferencia', function (Blueprint $table) {
|
||||
|
||||
$table->dropColumn('confirmado');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddRecusadoToAlmoxarifadoSaidaTransferenciaTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('almoxarifado_saida_transferencia', function (Blueprint $table) {
|
||||
|
||||
$table->boolean('recusado')->default(false)->after('confirmado');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('almoxarifado_saida_transferencia', function (Blueprint $table) {
|
||||
|
||||
$table->dropColumn('recusado');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAlmoxarifadoSaidaItemRecusadoTransferenciaTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('almoxarifado_saida_item_recusado_transferencia', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->foreignId('saida_id')->constrained('almoxarifado_saida');
|
||||
$table->foreignId('saida_item_id')->constrained('almoxarifado_saida_item');
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('almoxarifado_saida_item_recusado_transferencia');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user