akaunting/database/migrations/2017_09_01_000000_create_items_table.php
2017-10-21 14:23:57 +03:00

46 lines
1.2 KiB
PHP

<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateItemsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('items', function (Blueprint $table) {
$table->increments('id');
$table->integer('company_id');
$table->string('name');
$table->string('sku');
$table->text('description')->nullable();
$table->double('sale_price', 15, 4);
$table->double('purchase_price', 15, 4);
$table->integer('quantity');
$table->integer('category_id')->nullable();
$table->integer('tax_id')->nullable();
$table->string('picture')->nullable();
$table->boolean('enabled');
$table->timestamps();
$table->softDeletes();
$table->index('company_id');
$table->unique(['company_id', 'sku', 'deleted_at']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('items');
}
}