42 lines
1.0 KiB
PHP
42 lines
1.0 KiB
PHP
<?php
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
return new class extends Migration
|
|
{
|
|
/**
|
|
* Run the migrations.
|
|
*/
|
|
public function up(): void
|
|
{
|
|
Schema::create('cotizaciones', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->foreignId('company_id')->constrained()->cascadeOnDelete();
|
|
$table->foreignId('cliente_id')->constrained()->cascadeOnDelete();
|
|
|
|
$table->string('token')->unique(); // link público
|
|
$table->enum('estado', ['pendiente','vista','aprobada','rechazada'])
|
|
->default('pendiente');
|
|
|
|
$table->timestamp('aprobada_en')->nullable();
|
|
$table->string('aprobada_por')->nullable();
|
|
|
|
$table->decimal('subtotal', 10, 2)->default(0);
|
|
$table->decimal('iva', 10, 2)->default(0);
|
|
$table->decimal('total', 10, 2)->default(0);
|
|
|
|
$table->timestamps();
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*/
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('cotizacions');
|
|
}
|
|
};
|