Adiciona dotacoes e reservas orcamentais por empresa
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('budgets', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('tenant_id')->constrained()->restrictOnDelete();
|
||||
$table->foreignId('cost_center_id')->constrained()->restrictOnDelete();
|
||||
$table->unsignedSmallInteger('year');
|
||||
$table->bigInteger('amount_minor');
|
||||
$table->boolean('includes_tax');
|
||||
$table->text('reason');
|
||||
$table->foreignId('created_by')->constrained('users')->restrictOnDelete();
|
||||
$table->foreignId('approved_by')->nullable()->constrained('users')->restrictOnDelete();
|
||||
$table->timestamp('approved_at')->nullable();
|
||||
$table->timestamps();
|
||||
$table->unique(['tenant_id', 'cost_center_id', 'year']);
|
||||
});
|
||||
Schema::create('budget_entries', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('tenant_id')->constrained()->restrictOnDelete();
|
||||
$table->foreignId('budget_id')->constrained()->restrictOnDelete();
|
||||
$table->foreignId('requisition_id')->constrained()->restrictOnDelete();
|
||||
$table->foreignId('created_by')->constrained('users')->restrictOnDelete();
|
||||
$table->string('kind');
|
||||
$table->bigInteger('reserved_minor');
|
||||
$table->bigInteger('committed_minor');
|
||||
$table->timestamp('created_at');
|
||||
$table->unique(['requisition_id', 'kind']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
throw new LogicException('Preservar dotações e movimentos orçamentais.');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user