- added nearly all migration files
- added nearly all database seed files
This commit is contained in:
parent
489546ef6e
commit
7641c1dfdf
40 changed files with 1168 additions and 915 deletions
|
@ -1,36 +0,0 @@
|
|||
<?php
|
||||
|
||||
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->increments('id');
|
||||
$table->string('name');
|
||||
$table->string('email')->unique();
|
||||
$table->string('password', 60);
|
||||
$table->rememberToken();
|
||||
$table->nullableTimestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('users');
|
||||
}
|
||||
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreatePasswordResetsTable extends Migration {
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('password_resets', function(Blueprint $table)
|
||||
{
|
||||
$table->string('email')->index();
|
||||
$table->string('token')->index();
|
||||
$table->timestamp('created_at');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('password_resets');
|
||||
}
|
||||
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
<?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');
|
||||
}
|
||||
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateShelvesTable extends Migration {
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('shelves', function(Blueprint $table)
|
||||
{
|
||||
$table->increments('id');
|
||||
$table->string('shelf');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('shelves');
|
||||
}
|
||||
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreatePeriodesTable extends Migration {
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('periodes', function(Blueprint $table)
|
||||
{
|
||||
$table->increments('id');
|
||||
$table->integer('days');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('periodes');
|
||||
}
|
||||
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateLac extends Migration {
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('roles', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('name');
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create('role_user', function(Blueprint $table){
|
||||
$table->unsignedInteger('user_id');
|
||||
$table->unsignedInteger('role_id');
|
||||
$table->primary(['user_id', 'role_id']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('roles');
|
||||
Schema::drop('role_user');
|
||||
}
|
||||
|
||||
}
|
|
@ -1,46 +0,0 @@
|
|||
<?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');
|
||||
}
|
||||
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
<?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');
|
||||
}
|
||||
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
<?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');
|
||||
}
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
<?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');
|
||||
}
|
||||
}
|
|
@ -1,59 +0,0 @@
|
|||
<?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');
|
||||
}
|
||||
|
||||
}
|
|
@ -1,91 +0,0 @@
|
|||
<?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']);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAccountsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('accounts', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('login', 20);
|
||||
$table->string('password', 60);
|
||||
$table->string('email')->unique();
|
||||
$table->string('first_name', 255)->nullable();
|
||||
$table->string('last_name', 255)->nullable();
|
||||
$table->rememberToken();
|
||||
$table->nullableTimestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('accounts');
|
||||
}
|
||||
}
|
79
database/migrations/2019_08_28_074630_create_roles_table.php
Normal file
79
database/migrations/2019_08_28_074630_create_roles_table.php
Normal file
|
@ -0,0 +1,79 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateRolesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
DB::beginTransaction();
|
||||
|
||||
// Create table for storing roles
|
||||
Schema::create('roles', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('name', 255);
|
||||
$table->string('display_name', 255)->nullable();
|
||||
$table->string('description', 255)->nullable();
|
||||
$table->nullableTimestamps();
|
||||
});
|
||||
|
||||
// Create table for associating roles to accounts (Many-to-Many)
|
||||
Schema::create('link_accounts_roles', function (Blueprint $table) {
|
||||
$table->unsignedInteger('account_id')->unsigned();
|
||||
$table->unsignedInteger('role_id')->unsigned();
|
||||
|
||||
$table->foreign('account_id')
|
||||
->references('id')->on('accounts')
|
||||
->onDelete('cascade')->onUpdate('cascade');
|
||||
$table->foreign('role_id')
|
||||
->references('id')->on('roles')
|
||||
->onDelete('cascade')->onUpdate('cascade');
|
||||
|
||||
$table->primary(['account_id', 'role_id']);
|
||||
});
|
||||
|
||||
// Create table for storing permissions
|
||||
Schema::create('permissions', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('name')->unique();
|
||||
$table->string('display_name', 100);
|
||||
$table->string('description', 255)->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
// Create table for associating permissions to roles (Many-to-Many)
|
||||
Schema::create('role_has_permissions', function (Blueprint $table) {
|
||||
$table->integer('permission_id')->unsigned();
|
||||
$table->integer('role_id')->unsigned();
|
||||
|
||||
$table->foreign('permission_id')->references('id')->on('permissions')
|
||||
->onUpdate('cascade')->onDelete('cascade');
|
||||
$table->foreign('role_id')->references('id')->on('roles')
|
||||
->onUpdate('cascade')->onDelete('cascade');
|
||||
|
||||
$table->primary(['permission_id', 'role_id']);
|
||||
});
|
||||
|
||||
DB::commit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('role_has_permissions');
|
||||
Schema::dropIfExists('permissions');
|
||||
Schema::dropIfExists('link_accounts_roles');
|
||||
Schema::dropIfExists('roles');
|
||||
}
|
||||
}
|
|
@ -1,9 +1,10 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateDocumentsTable extends Migration
|
||||
class CreateProjectsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
|
@ -12,10 +13,11 @@ class CreateDocumentsTable extends Migration
|
|||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('documents', function (Blueprint $table) {
|
||||
Schema::create('projects', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('publication_state', 100)->default('draft');;
|
||||
$table->boolean('belongs_to_bibliography')->default('0');
|
||||
$table->string('label', 10);
|
||||
$table->string('name', 255);
|
||||
$table->string('description', 255)->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
@ -27,6 +29,6 @@ class CreateDocumentsTable extends Migration
|
|||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('documents');
|
||||
Schema::dropIfExists('projects');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateDocumentsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('documents', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('contributing_corporation', 50)->nullable();
|
||||
$table->string('creating_corporation', 50);
|
||||
$table->dateTime('embargo_date');
|
||||
$table->integer('project_id')->unsigned()->nullable();
|
||||
$table->foreign('project_id')->references('id')->on('projects');
|
||||
$table->enum(
|
||||
'type',
|
||||
['analysisdata', 'interpreteddata', 'measurementdata', 'models', 'rawdata', 'supplementarydata', 'mixedtype']
|
||||
);
|
||||
$table->string('language', 10);
|
||||
$table->enum(
|
||||
'server_state',
|
||||
['deleted', 'inprogress', 'published', 'released', 'editor_accepted', 'approved', 'rejected_reviewer', 'rejected_editor', 'reviewed']
|
||||
)->default('inprogress');
|
||||
$table->boolean('belongs_to_bibliography')->default(0);
|
||||
$table->dateTime('created_at');
|
||||
$table->dateTime('server_date_modified');
|
||||
$table->dateTime('server_date_published')->nullable();
|
||||
$table->integer('account_id')->unsigned()->nullable();
|
||||
$table->integer('editor_id')->unsigned()->nullable();
|
||||
$table->integer('reviewer_id')->unsigned()->nullable();
|
||||
$table->string('preferred_reviewer', 25)->nullable();
|
||||
$table->string('preferred_reviewer_email', 50)->nullable();
|
||||
$table->string('reject_editor_note', 255)->nullable();
|
||||
$table->string('reject_reviewer_note', 255)->nullable();
|
||||
$table->boolean('reviewer_note_visible')->default(false);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('documents');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreatePersonsTable 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', ['author', 'contributor', 'other'])
|
||||
->default('other');
|
||||
$table->tinyInteger('sort_order');
|
||||
$table->boolean('allow_email_contact')->default(0);
|
||||
$table->primary(['person_id', 'document_id', 'role']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('link_documents_persons');
|
||||
Schema::dropIfExists('persons');
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateLicencesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('document_licences', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->boolean('active')->default(true);
|
||||
$table->string('comment_internal', 4000)->nullable();
|
||||
$table->string('desc_markup', 4000)->nullable();
|
||||
$table->string('desc_text', 4000)->nullable();
|
||||
$table->string('language', 3)->nullable();
|
||||
$table->string('link_licence', 200);
|
||||
$table->string('link_logo', 200)->nullable();
|
||||
$table->string('link_sign', 200)->nullable();
|
||||
$table->string('mime_type', 30)->nullable();
|
||||
$table->string('name_long', 100);
|
||||
$table->boolean('pod_allowed')->default(false);
|
||||
$table->tinyInteger('sort_order');
|
||||
});
|
||||
|
||||
Schema::create('link_documents_licences', function (Blueprint $table) {
|
||||
// $table->increments('id');
|
||||
|
||||
$table->unsignedInteger('licence_id')->index();
|
||||
$table->foreign('licence_id')
|
||||
->references('id')->on('document_licences')
|
||||
->onDelete('no action')->onUpdate('no action'); //detach the relation via code
|
||||
|
||||
$table->unsignedInteger('document_id')->index();
|
||||
$table->foreign('document_id')
|
||||
->references('id')->on('documents')
|
||||
->onDelete('cascade')->onUpdate('cascade');
|
||||
|
||||
$table
|
||||
->enum('role', ['author', 'contributor', 'other'])
|
||||
->default('other');
|
||||
$table->primary(['licence_id', 'document_id']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('link_documents_licences');
|
||||
Schema::dropIfExists('document_licences');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
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')
|
||||
->onUpdate('cascade')->onDelete('cascade');
|
||||
$table->boolean('visible')->default(1);
|
||||
$table->boolean('visible_publish')->default(1);
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create('link_documents_collections', function (Blueprint $table) {
|
||||
// $table->increments('id');
|
||||
|
||||
$table->unsignedInteger('collection_id')->index();
|
||||
$table->foreign('collection_id')
|
||||
->references('id')->on('collections')
|
||||
->onDelete('cascade')->onUpdate('cascade'); //detach the relation via code
|
||||
|
||||
$table->unsignedInteger('document_id')->index();
|
||||
$table->foreign('document_id')
|
||||
->references('id')->on('documents')
|
||||
->onDelete('cascade')->onUpdate('cascade');
|
||||
|
||||
$table->primary(['collection_id', 'document_id']);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('link_documents_collections');
|
||||
Schema::dropIfExists('collections');
|
||||
}
|
||||
}
|
54
database/migrations/2019_08_28_160330_create_pages_table.php
Normal file
54
database/migrations/2019_08_28_160330_create_pages_table.php
Normal file
|
@ -0,0 +1,54 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreatePagesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('pages', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
//$table->string('title', 191);
|
||||
$table->string('page_slug', 191)->unique();
|
||||
//$table->text('description')->nullable();
|
||||
$table->string('cannonical_link', 191)->nullable();
|
||||
$table->string('seo_title', 191)->nullable();
|
||||
$table->string('seo_keyword', 191)->nullable();
|
||||
$table->text('seo_description')->nullable();
|
||||
$table->boolean('status')->default(true);
|
||||
$table->integer('created_by');
|
||||
$table->integer('updated_by')->nullable();
|
||||
$table->dateTime('created_at')->unsigned();
|
||||
$table->dateTime('updated_at')->unsigned()->nullable();
|
||||
});
|
||||
|
||||
Schema::create('page_translations', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('page_id')->unsigned();
|
||||
$table->unique(['page_id','locale']);
|
||||
$table->foreign('page_id')->references('id')->on('pages')->onDelete('cascade');
|
||||
|
||||
$table->string('locale')->index();
|
||||
$table->string('title');
|
||||
$table->text('description');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('page_translations');
|
||||
Schema::dropIfExists('pages');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateDatasetTitlesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('dataset_titles', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('document_id')->unsigned();
|
||||
|
||||
$table->foreign('document_id')->references('id')->on('documents')
|
||||
->onUpdate('cascade')->onDelete('cascade');
|
||||
|
||||
$table->text('value');
|
||||
$table->string('language', 3);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('dataset_titles');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateDatasetAbstractsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('dataset_abstracts', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('document_id')->unsigned();
|
||||
|
||||
$table->foreign('document_id')->references('id')->on('documents')
|
||||
->onUpdate('cascade')->onDelete('cascade');
|
||||
|
||||
$table->text('value');
|
||||
$table->string('language', 3);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('dataset_abstracts');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateLanguagesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('languages', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('part2_b', 3);
|
||||
$table->string('part2_t', 3);
|
||||
$table->string('part1', 2);
|
||||
$table->string('scope', 20);
|
||||
$table->string('type', 20);
|
||||
$table->string('ref_name', 150);
|
||||
$table->boolean('active')->default(true);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('languages');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateDocumentXmlCacheTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('document_xml_cache', function (Blueprint $table) {
|
||||
$table->integer('id')->primary();
|
||||
$table->integer('xml_version');
|
||||
$table->string('server_date_modified', 50)->nullable();
|
||||
$table->string('xml_data')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('document_xml_cache');
|
||||
}
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreatePagesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('pages', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('title', 191);
|
||||
$table->string('page_slug', 191)->unique();
|
||||
$table->text('description', 65535)->nullable();
|
||||
$table->string('cannonical_link', 191)->nullable();
|
||||
$table->string('seo_title', 191)->nullable();
|
||||
$table->string('seo_keyword', 191)->nullable();
|
||||
$table->text('seo_description', 65535)->nullable();
|
||||
$table->boolean('status')->default(1);
|
||||
$table->integer('created_by')->unsigned();
|
||||
$table->integer('updated_by')->unsigned()->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('pages');
|
||||
}
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
<?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');
|
||||
}
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
<?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');
|
||||
}
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
<?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');
|
||||
}
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreatePageTranslationsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('page_translations', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('page_id')->unsigned();
|
||||
$table->string('locale')->index();
|
||||
|
||||
$table->string('title');
|
||||
$table->text('description');
|
||||
|
||||
$table->unique(['page_id','locale']);
|
||||
$table->foreign('page_id')->references('id')->on('pages')->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('page_translations');
|
||||
}
|
||||
}
|
Loading…
Add table
editor.link_modal.header
Reference in a new issue