Created
January 30, 2017 23:32
-
-
Save alexweissman/3be55b1d53116b94685d9a3128dbc75d to your computer and use it in GitHub Desktop.
Basic migration for your sprinkle. Create in sprinkles/site/migrations/
This file contains hidden or 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\Capsule\Manager as Capsule; | |
use Illuminate\Database\Schema\Blueprint; | |
/** | |
* Volunteer table | |
*/ | |
if (!$schema->hasTable('volunteers')) { | |
$schema->create('volunteers', function (Blueprint $table) { | |
$table->increments('id'); | |
$table->integer('user_id')->unsigned(); | |
$table->string('city', 255)->nullable(); | |
$table->text('comment')->nullable(); | |
$table->timestamps(); | |
$table->engine = 'InnoDB'; | |
$table->collation = 'utf8_unicode_ci'; | |
$table->charset = 'utf8'; | |
$table->foreign('user_id')->references('id')->on('users'); | |
$table->index('user_id'); | |
}); | |
echo "Created table 'volunteers'..." . PHP_EOL; | |
} else { | |
echo "Table 'volunteers' already exists. Skipping..." . PHP_EOL; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment