Created
February 10, 2020 18:25
-
-
Save parzibyte/62b74ec89431ebc1e874ab08a91e8e07 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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