schema->hasTable('organisation_membership_approvals')) { DB::table('organisation_membership_approvals')->delete(); $this->schema->table('organisation_membership_approvals', function (Blueprint $table) { $table->dropForeign(['requester_id']); $table->dropForeign(['organisation_id']); $table->dropIndex(['requester_id']); $table->dropColumn(['requester_id']); $table->dropColumn(['organisation_id']); $table->integer('owner_id')->unsigned(); $table->index('owner_id'); }); } } /** * {@inheritdoc} */ public function down() { if ($this->schema->hasTable('organisation_membership_approvals')) { DB::table('organisation_membership_approvals')->delete(); $this->schema->table('organisation_membership_approvals', function (Blueprint $table) { $table->dropIndex(['owner_id']); $table->dropColumn('owner_id')->unsigned(); $table->integer('requester_id')->unsigned(); $table->integer('organisation_id')->unsigned(); $table->index('requester_id'); $table->foreign('requester_id')->references('id')->on('users'); $table->foreign('organisation_id')->references('id')->on('organisations'); }); } } }