update migrations

This commit is contained in:
hackerESQ
2024-08-10 13:30:34 -05:00
parent 804b4698f0
commit 7707c6dcb3
7 changed files with 19 additions and 13 deletions
@@ -1,6 +1,7 @@
<?php
use App\Models\Portfolio;
use App\Models\MarketData;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
@@ -16,13 +17,15 @@ class CreateHoldingsTable extends Migration
{
Schema::create('holdings', function (Blueprint $table) {
$table->uuid('id')->primary();
$table->foreignIdFor(Portfolio::class, 'portfolio_id')->onDelete('cascade');
$table->string('symbol', 15);
$table->foreignIdFor(Portfolio::class, 'portfolio_id')->constrained()->onDelete('cascade');
$table->foreignIdFor(MarketData::class, 'symbol');
$table->float('quantity', 12, 4);
$table->float('average_cost_basis', 12, 4);
$table->float('total_cost_basis', 12, 4)->nullable();
$table->float('realized_gain_loss_dollars', 12, 4)->nullable();
$table->float('dividends_earned', 12, 4)->nullable();
$table->timestamp('splits_synced_at')->nullable();
$table->timestamp('dividends_synced_at')->nullable();
$table->timestamps();
});
}