261c848ffd
to prevent duplicate records
39 lines
795 B
PHP
39 lines
795 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
class CreateSplitsTable extends Migration
|
|
{
|
|
/**
|
|
* Run the migrations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function up()
|
|
{
|
|
Schema::create('splits', function (Blueprint $table) {
|
|
$table->uuid('id')->primary();
|
|
$table->date('date');
|
|
$table->string('symbol', 25);
|
|
$table->float('split_amount', 12, 4);
|
|
$table->timestamps();
|
|
|
|
$table->unique(['date', 'symbol']);
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function down()
|
|
{
|
|
Schema::dropIfExists('splits');
|
|
}
|
|
}
|