my changes

This commit is contained in:
Arno Kaimbacher 2018-08-06 14:30:51 +02:00
parent 28301e4312
commit 8dc1f1b048
263 changed files with 36882 additions and 4453 deletions

View file

@ -19,7 +19,7 @@ class CreateUsersTable extends Migration {
$table->string('email')->unique();
$table->string('password', 60);
$table->rememberToken();
$table->timestamps();
$table->nullableTimestamps();
});
}

View file

@ -1,33 +0,0 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateFinesTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('fines', function(Blueprint $table)
{
$table->integer('days');
$table->integer('fines');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('fines');
}
}

View file

@ -14,6 +14,7 @@ class CreatePeriodesTable extends Migration {
{
Schema::create('periodes', function(Blueprint $table)
{
$table->increments('id');
$table->integer('days');
$table->timestamps();
});

View file

@ -0,0 +1,46 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateTransactionsTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('transactions', function(Blueprint $table)
{
$table->increments('id');
$table->integer('student_id')->unsigned();
$table->foreign('student_id')->references('id')->on('students');
$table->integer('book_id')->unsigned();
$table->foreign('book_id')->references('id')->on('books');
$table->integer('borrowed_at');
$table->integer('returned_at')->default('0');
$table->integer('fines')->default('0');
$table->boolean('status')->default('0');
$table->timestamps();
});
// Schema::table('transactions', function($table) {
// $table->foreign('student_id')->references('id')->on('students');
// });
// Schema::table('transactions', function($table) {
// $table->foreign('book_id')->references('id')->on('books');
// });
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('transactions');
}
}

View file

@ -0,0 +1,41 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateBooksTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('books', function(Blueprint $table)
{
$table->increments('id');
$table->string('title');
$table->string('author');
$table->integer('year');
$table->integer('stock');
$table->integer('category_id')->unsigned();
$table->foreign('category_id')->references('id')->on('categories');
$table->integer('shelf_id')->unsigned();
$table->foreign('shelf_id')->references('id')->on('shelves');
$table->integer('year_id')->default('0');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('books');
}
}

View file

@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateCollectionsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('collections', function (Blueprint $table) {
$table->increments('id');
$table->string('number', 255)->nullable();
$table->string('name', 255)->nullable();
$table->string('oai_subset', 255)->nullable();
$table->integer('parent_id')->unsigned()->nullable();
$table->foreign('parent_id')->references('id')->on('collections')->onDelete('cascade');
$table->boolean('visible')->default('1');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('collections');
}
}

View file

@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateDocumentsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('documents', function (Blueprint $table) {
$table->increments('id');
$table->string('publication_state', 100)->default('draft');;
$table->boolean('belongs_to_bibliography')->default('0');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('documents');
}
}

View file

@ -0,0 +1,43 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateLinkDocumentsCollections extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('link_documents_collections', function (Blueprint $table) {
// $table->increments('id');
$table->unsignedInteger('collection_id')->nullable()->index();
$table->foreign('collection_id')
->references('id')->on('collections')
->onDelete('set null');
//->onDelete('cascade');
$table->unsignedInteger('document_id')->nullable()->index();
$table->foreign('document_id')
->references('id')->on('documents')
->onDelete('set null');
//->onDelete('cascade');
$table->primary(['collection_id', 'document_id']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('link_documents_collections');
}
}

View file

@ -0,0 +1,59 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateStudentsTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('persons', function(Blueprint $table)
{
$table->increments('id');
$table->string('name');
$table->integer('registered_at');
$table->boolean('status')->default('1');
$table->timestamps();
});
Schema::create('link_documents_persons', function (Blueprint $table) {
// $table->increments('id');
$table->unsignedInteger('person_id')->index('ix_fk_link_documents_persons_persons');
$table->foreign('person_id', 'fk_link_documents_persons_persons')
->references('id')->on('persons')
->onDelete('no action')->onUpdate('no action');//detach the relation via code
$table->unsignedInteger('document_id')->index('ix_fk_link_persons_documents_documents');
$table->foreign('document_id','fk_link_persons_documents_documents')
->references('id')->on('documents')
->onDelete('cascade')->onUpdate('cascade');
$table
->enum('role', ['advisor', 'author', 'contributor', 'editor', 'referee', 'other', 'translator', 'submitter'])
->default('author');
$table->primary(['person_id', 'document_id', 'role']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('persons');
Schema::drop('link_persons_documents');
}
}

View file

@ -0,0 +1,91 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreatePermissionTables extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
$tableNames = config('permission.table_names');
Schema::create($tableNames['permissions'], function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->string('guard_name');
$table->timestamps();
});
Schema::create($tableNames['roles'], function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->string('guard_name');
$table->timestamps();
});
Schema::create($tableNames['model_has_permissions'], function (Blueprint $table) use ($tableNames) {
$table->unsignedInteger('permission_id');
$table->morphs('model');
$table->foreign('permission_id')
->references('id')
->on($tableNames['permissions'])
->onDelete('cascade');
$table->primary(['permission_id', 'model_id', 'model_type'], 'model_has_permissions_permission_model_type_primary');
});
Schema::create($tableNames['model_has_roles'], function (Blueprint $table) use ($tableNames) {
$table->unsignedInteger('role_id');
$table->morphs('model');
$table->foreign('role_id')
->references('id')
->on($tableNames['roles'])
->onDelete('cascade');
$table->primary(['role_id', 'model_id', 'model_type']);
});
Schema::create($tableNames['role_has_permissions'], function (Blueprint $table) use ($tableNames) {
$table->unsignedInteger('permission_id');
$table->unsignedInteger('role_id');
$table->foreign('permission_id')
->references('id')
->on($tableNames['permissions'])
->onDelete('cascade');
$table->foreign('role_id')
->references('id')
->on($tableNames['roles'])
->onDelete('cascade');
$table->primary(['permission_id', 'role_id']);
app('cache')->forget('spatie.permission.cache');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
$tableNames = config('permission.table_names');
Schema::drop($tableNames['role_has_permissions']);
Schema::drop($tableNames['model_has_roles']);
Schema::drop($tableNames['model_has_permissions']);
Schema::drop($tableNames['roles']);
Schema::drop($tableNames['permissions']);
}
}

View file

@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateCategoriesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('categories', function (Blueprint $table) {
$table->increments('id');
$table->string('category');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('categories');
}
}

View file

@ -0,0 +1,39 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateBooksTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('books', function (Blueprint $table) {
$table->increments('id');
$table->string('title');
$table->string('author');
$table->integer('year');
$table->integer('stock');
$table->integer('category_id')->unsigned();
$table->foreign('category_id')->references('id')->on('categories');
//$table->integer('shelf_id')->unsigned();
//$table->foreign('shelf_id');//->references('id')->on('shelves');
$table->integer('year_id')->default('0');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('books');
}
}

View file

@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateDocumentsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('documents', function (Blueprint $table) {
$table->increments('id');
$table->string('type', 100);
$table->string('publication_state', 100)->default('draft');;
$table->boolean('belongs_to_bibliography')->default('0');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('documents');
}
}