12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- <?php
- use Illuminate\Database\Migrations\Migration;
- use Illuminate\Database\Schema\Blueprint;
- use Illuminate\Support\Facades\Schema;
- class CreateItemsExchangeTable extends Migration
- {
- /**
- * Run the migrations.
- *
- * @return void
- */
- public function up()
- {
- Schema::create('items_exchange', function (Blueprint $table) {
- $table->increments('id');
- $table->unsignedInteger('item_id');
- $table->unsignedInteger('item_offer_id');
- $table->tinyInteger('status')->default(null)->nullable();
- $table->timestamps();
- $table->foreign('item_id')
- ->references('id')->on('items')
- ->onDelete('cascade');
- $table->foreign('item_offer_id')
- ->references('id')->on('items')
- ->onDelete('cascade');
- });
- }
- /**
- * Reverse the migrations.
- *
- * @return void
- */
- public function down()
- {
- Schema::table('items_exchange', function (Blueprint $table) {
- $table->dropForeign(['item_id']);
- $table->dropForeign(['item_offer_id']);
- });
- Schema::dropIfExists('items_exchange');
- }
- }
|