Browse Source

Merge branch 'master' of github.com:aaronpk/Compass

pull/13/head
Aaron Parecki 7 years ago
parent
commit
552cba80d8
No known key found for this signature in database GPG Key ID: 276C2817346D6056
2 changed files with 61 additions and 2 deletions
  1. +51
    -0
      compass/database/migrations/2000_00_00_000000_setup.php
  2. +10
    -2
      compass/resources/views/dashboard.blade.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');
}
}

+ 10
- 2
compass/resources/views/dashboard.blade.php View File

@ -12,7 +12,7 @@
<li class="db"><a href="/map/{{ $database->name }}">{{ $database->name }}</a></li> <li class="db"><a href="/map/{{ $database->name }}">{{ $database->name }}</a></li>
@endforeach @endforeach
<li> <li>
<a href="javascript:$('.databases .create').removeClass('hidden');$('.create-link').addClass('hidden');" class="pure-button create-link {{ session('create-error') ? 'hidden' : '' }}">create database</a>
<a href="#" class="pure-button create-link {{ session('create-error') ? 'hidden' : '' }}">create database</a>
@if(session('create-error')) @if(session('create-error'))
<div class="error">{{ session('create-error') }}</div> <div class="error">{{ session('create-error') }}</div>
@endif @endif
@ -28,5 +28,13 @@
</ul> </ul>
</div> </div>
<script>
$(function(){
$(".create-link").click(function(){
$('.databases .create').removeClass('hidden');
$('.create-link').addClass('hidden');
return false;
});
});
</script>
@endsection @endsection

Loading…
Cancel
Save