Skip to content

Instantly share code, notes, and snippets.

@ChadTaljaardt
Created February 15, 2017 01:26
Show Gist options
  • Save ChadTaljaardt/861ea22a9710df066872944ae6c7144d to your computer and use it in GitHub Desktop.
Save ChadTaljaardt/861ea22a9710df066872944ae6c7144d to your computer and use it in GitHub Desktop.
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('users', function (Blueprint $table) {
$table->uuid('id');
$table->string('name');
$table->string('email')->unique();
$table->string('password');
$table->rememberToken();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('users');
}
}
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreatePlatesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('plates', function (Blueprint $table) {
$table->uuid('id');
$table->string('plate');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('plates');
}
}
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateDetectionsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('detections', function (Blueprint $table) {
$table->uuid('id');
$table->uuid('plate_id');
$table->uuid('user_id');
$table->uuid('incident_id')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('detections');
}
}
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateIncidentsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('incidents', function (Blueprint $table) {
$table->uuid('id');
$table->uuid('user_id');
$table->uuid('detection_id');
$table->uuid('plate_id');
$table->enum('severity', array('none', 'low', 'medium', 'high'));
$table->longtext('description');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('incidents');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment