Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created February 10, 2020 18:25
Show Gist options
  • Save parzibyte/62b74ec89431ebc1e874ab08a91e8e07 to your computer and use it in GitHub Desktop.
Save parzibyte/62b74ec89431ebc1e874ab08a91e8e07 to your computer and use it in GitHub Desktop.
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class EliminarIdTutorDeAlumno extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('alumnos', function (Blueprint $table) {
$table->dropForeign('alumnos_id_tutor_foreign');
$table->dropColumn("id_tutor");
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('alumnos', function (Blueprint $table) {
$table->unsignedBigInteger("id_tutor");
$table->foreign("id_tutor")
->references("id")
->on("tutores")
->onUpdate("cascade")
->onDelete("cascade");
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment