- 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
|
@ -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');
|
||||
}
|
||||
}
|
Loading…
Add table
editor.link_modal.header
Reference in a new issue