Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- use Illuminate\Database\Migrations\Migration;
- use Illuminate\Database\Schema\Blueprint;
- use Illuminate\Support\Facades\Schema;
- class ChangeFkOnDeleteInventoryHistories extends Migration
- {
- /**
- * Run the migrations.
- *
- * @return void
- */
- public function up()
- {
- Schema::table('inventory_histories', function (Blueprint $table) {
- $table->dropForeign(['ItemId'])->nullable();
- $table->bigInteger('ItemId')->unsigned()->nullable()->change();
- $table->foreign('ItemId')->references('Id')->on('inventories')->onDelete('no action');
- });
- }
- /**
- * Reverse the migrations.
- *
- * @return void
- */
- public function down()
- {
- Schema::table('inventory_histories', function (Blueprint $table) {
- $table->dropForeign(['ItemId'])->nullable();
- $table->bigInteger('ItemId')->unsigned()->change();
- $table->foreign('ItemId')->references('Id')->on('inventories')->onDelete('cascade');
- });
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement