Browse Source

Merge pull request #8 from sebsel/fix-migrations

Fix migrations
pull/13/head
Aaron Parecki 7 years ago
committed by GitHub
parent
commit
f495b21e2b
1 changed files with 51 additions and 0 deletions
  1. +51
    -0
      compass/database/migrations/2000_00_00_000000_setup.php

+ 51
- 0
compass/database/migrations/2000_00_00_000000_setup.php View File

@ -0,0 +1,51 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class Setup extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('databases', function (Blueprint $table) {
$table->increments('id');
$table->string('name', 100);
$table->string('read_token', 255);
$table->string('write_token', 255);
$table->unsignedInteger('created_by');
$table->datetime('created_at');
$table->unique(['read_token','write_token']);
});
Schema::create('users', function (Blueprint $table) {
$table->increments('id');
$table->string('url', 255);
$table->datetime('created_at')->nullable();
$table->datetime('last_login')->nullable();
});
Schema::create('database_users', function (Blueprint $table) {
$table->unsignedInteger('database_id');
$table->unsignedInteger('user_id');
$table->datetime('created_at')->nullable();
$table->primary(['database_id','user_id']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('users');
Schema::drop('databases');
Schema::drop('database_users');
}
}

Loading…
Cancel
Save