Skip to content

Instantly share code, notes, and snippets.

@ubiratanlima
Created May 1, 2017 21:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ubiratanlima/8dd077af896382d04933ef13d0bca7c4 to your computer and use it in GitHub Desktop.
Save ubiratanlima/8dd077af896382d04933ef13d0bca7c4 to your computer and use it in GitHub Desktop.
Migration-add_field
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