shareit/database/migrations/2018_09_08_192152_create_items_table.php
Bruno Fontes 4c4672d6f4
Fixing item_user migration primary keys
I had included item_id and user_id as primary keys to avoid duplications
but the command line to attach I am using does not duplicate.
Not only that, I got an error during migration of Multiple primary keys.
2018-09-16 19:29:14 -03:00

43 lines
1017 B
PHP

<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateItemsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('items', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->integer('product_id');
$table->integer('used_by')->nullable();
$table->integer('waiting_user_id')->nullable();
$table->timestamps();
});
Schema::create('item_user', function (Blueprint $table) {
$table->increments('id');
$table->integer('item_id');
$table->integer('user_id');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('items');
Schema::dropIfExists('item_user');
}
}