osb/database/migrations/0215-create_costs.php

45 lines
928 B
PHP
Raw Permalink Normal View History

2024-06-21 07:43:32 +00:00
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('costs', function (Blueprint $table)
{
$table->id();
$table->timestamps();
$table->integer('site_id')->unsigned();
$table->boolean('active')->default(false);
$table->date('billed_at');
$table->string('invoice_num')->nullable();
$table->foreign(['site_id'])->references(['id'])->on('sites');
$table->integer('supplier_id')->unsigned();
$table->foreign(['supplier_id'])->references(['id'])->on('suppliers');
$table->unique(['id','site_id']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('costs');
}
};