Skip to content

Instantly share code, notes, and snippets.

@alexweissman
Created January 30, 2017 23:32
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 alexweissman/3be55b1d53116b94685d9a3128dbc75d to your computer and use it in GitHub Desktop.
Save alexweissman/3be55b1d53116b94685d9a3128dbc75d to your computer and use it in GitHub Desktop.
Basic migration for your sprinkle. Create in sprinkles/site/migrations/
<?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