osb/database/migrations/0262-create_invoice_item_tax.php

41 lines
858 B
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.
*
* @return void
*/
public function up()
{
Schema::create('invoice_item_taxes', function(Blueprint $table)
{
$table->id();
$table->integer('site_id')->unsigned();
$table->boolean('active')->default(true);
$table->float('amount',10,0);
$table->integer('invoice_item_id')->unsigned();
$table->foreign(['invoice_item_id','site_id'])->references(['id','site_id'])->on('invoice_items');
$table->integer('tax_id')->unsigned();
$table->foreign('tax_id')->references('id')->on('taxes');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('invoice_item_taxes');
}
};