Skip to content

Instantly share code, notes, and snippets.

@madeinnordeste
Created January 26, 2017 17:09
Show Gist options
  • Save madeinnordeste/df629ec1c155ec2f905ee35af6ea3b83 to your computer and use it in GitHub Desktop.
Save madeinnordeste/df629ec1c155ec2f905ee35af6ea3b83 to your computer and use it in GitHub Desktop.
Laravel 5.3 Migration Example
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreatePatientsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('patients', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->string('gender', 1);
$table->date('born_date');
$table->string('nationality');
$table->string('color');
$table->string('marital_status');
$table->string('occupation');
$table->string('zipcode', 10);
$table->string('address');
$table->string('burgh');
$table->integer('city_id')->default(0)->unsigned();
$table->integer('state_id')->default(0)->unsigned();
$table->string('email');
$table->string('phone');
$table->string('cellphone');
$table->string('workphone');
$table->softDeletes();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('patients');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment