Implementa recomendação formal com adopção e conferência independente
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
<?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('recommendation_policies', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('tenant_id')->constrained()->restrictOnDelete();
|
||||
$table->foreignId('created_by')->constrained('users')->restrictOnDelete();
|
||||
$table->unsignedInteger('revision');
|
||||
$table->boolean('enabled');
|
||||
$table->json('roles');
|
||||
$table->unsignedInteger('required_count');
|
||||
$table->text('reason');
|
||||
$table->timestamp('created_at');
|
||||
$table->unique(['tenant_id', 'revision']);
|
||||
});
|
||||
Schema::create('recommendation_adoptions', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('tenant_id')->constrained()->restrictOnDelete();
|
||||
$table->foreignId('requisition_id')->constrained()->restrictOnDelete();
|
||||
$table->foreignId('recommendation_policy_id')->constrained()->restrictOnDelete();
|
||||
$table->foreignId('created_by')->constrained('users')->restrictOnDelete();
|
||||
$table->unsignedInteger('revision');
|
||||
$table->json('snapshot');
|
||||
$table->text('reason');
|
||||
$table->timestamp('created_at');
|
||||
$table->unique(['requisition_id', 'revision']);
|
||||
});
|
||||
Schema::create('recommendation_attempts', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('tenant_id')->constrained()->restrictOnDelete();
|
||||
$table->foreignId('recommendation_adoption_id')->constrained()->restrictOnDelete();
|
||||
$table->foreignId('quotation_id')->constrained()->restrictOnDelete();
|
||||
$table->foreignId('created_by')->constrained('users')->restrictOnDelete();
|
||||
$table->unsignedInteger('revision');
|
||||
$table->string('basis_hash', 64);
|
||||
$table->json('snapshot');
|
||||
$table->text('reason');
|
||||
$table->timestamp('created_at');
|
||||
$table->unique(['recommendation_adoption_id', 'revision'], 'recommendation_attempt_version_unique');
|
||||
});
|
||||
Schema::create('recommendation_reviews', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('tenant_id')->constrained()->restrictOnDelete();
|
||||
$table->foreignId('recommendation_attempt_id')->constrained()->restrictOnDelete();
|
||||
$table->foreignId('reviewed_by')->constrained('users')->restrictOnDelete();
|
||||
$table->string('verdict');
|
||||
$table->text('reason');
|
||||
$table->json('snapshot');
|
||||
$table->timestamp('created_at');
|
||||
$table->unique(['recommendation_attempt_id', 'reviewed_by']);
|
||||
});
|
||||
Schema::table('purchase_awards', fn (Blueprint $table) => $table->json('recommendation_snapshot')->nullable());
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
throw new LogicException('Preservar políticas, adopções, decisões e conferências de recomendação.');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user