Explorar o código

feat(treasury): relax launch columns for manual entries

unit_id, financial_plan_account_id and from/to account ids become nullable so a simple manual entrada/saida can hit a single account.
ebagabee hai 1 mes
pai
achega
696e994782

+ 30 - 0
database/migrations/2026_06_18_000002_make_treasury_launch_columns_nullable.php

@@ -0,0 +1,30 @@
+<?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::table('treasury_launches', function (Blueprint $table) {
+            // Movimentação manual simples (entrada/saída) lança em um único banco e,
+            // no franqueador, sem unidade nem plano de contas (CB021 ainda pendente).
+            $table->foreignId('unit_id')->nullable()->change();
+            $table->foreignId('financial_plan_account_id')->nullable()->change();
+            $table->foreignId('from_account_id')->nullable()->change();
+            $table->foreignId('to_account_id')->nullable()->change();
+        });
+    }
+
+    public function down(): void
+    {
+        Schema::table('treasury_launches', function (Blueprint $table) {
+            $table->foreignId('unit_id')->nullable(false)->change();
+            $table->foreignId('financial_plan_account_id')->nullable(false)->change();
+            $table->foreignId('from_account_id')->nullable(false)->change();
+            $table->foreignId('to_account_id')->nullable(false)->change();
+        });
+    }
+};