Implementa regras de investimento por empresa com dupla aprovacao
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
<?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('investment_policies', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('tenant_id')->constrained()->restrictOnDelete();
|
||||
$table->foreignId('created_by')->constrained('users')->restrictOnDelete();
|
||||
$table->unsignedInteger('revision');
|
||||
$table->string('status')->default('pending');
|
||||
$table->string('mode');
|
||||
$table->string('scope');
|
||||
$table->string('currency', 3);
|
||||
$table->bigInteger('ceiling_minor');
|
||||
$table->boolean('includes_tax');
|
||||
$table->date('valid_from');
|
||||
$table->date('valid_until');
|
||||
$table->text('reason');
|
||||
$table->timestamp('decided_at')->nullable();
|
||||
$table->timestamps();
|
||||
$table->unique(['tenant_id', 'revision']);
|
||||
});
|
||||
Schema::create('investment_policy_reviews', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('tenant_id')->constrained()->restrictOnDelete();
|
||||
$table->foreignId('investment_policy_id')->constrained()->restrictOnDelete();
|
||||
$table->foreignId('reviewed_by')->constrained('users')->restrictOnDelete();
|
||||
$table->string('decision');
|
||||
$table->text('reason');
|
||||
$table->timestamp('created_at');
|
||||
$table->unique(['investment_policy_id', 'reviewed_by']);
|
||||
});
|
||||
Schema::table('budgets', fn (Blueprint $table) => $table->string('kind')->default('operating'));
|
||||
Schema::table('purchase_awards', fn (Blueprint $table) => $table->json('investment_snapshot')->nullable());
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
throw new LogicException('Preservar regras e decisões de investimento.');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user