Created
May 1, 2017 21:49
-
-
Save ubiratanlima/8dd077af896382d04933ef13d0bca7c4 to your computer and use it in GitHub Desktop.
Migration-add_field
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
class AddEmpresaIdTableRiscos extends Migration | |
{ | |
/** | |
* Run the migrations. | |
* | |
* @return void | |
*/ | |
public function up() | |
{ | |
Schema::table('Riscos', function (Blueprint $table) { | |
$table->string('empresa_id')->unsigned(); | |
$table->foreign('empresa_id')->reference('id')->on('empresas')->onDelete('cascade'); | |
}); | |
} | |
/** | |
* Reverse the migrations. | |
* | |
* @return void | |
*/ | |
public function down() | |
{ | |
Schema::table('Riscos', function (Blueprint $table) { | |
$table->dropColumn('empresa_id'); | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment