FEATURE: add possibilityy to upload and assign files to content pages
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AssignFilesToPages extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('contents_has_files', function (Blueprint $table) {
|
||||
$table->integer('content_id');
|
||||
$table->integer('file_id');
|
||||
$table->primary(['content_id', 'file_id']);
|
||||
|
||||
$table->foreign('content_id')
|
||||
->references('id')
|
||||
->on('contents')
|
||||
->onDelete('cascade')
|
||||
->onUpdate('cascade');
|
||||
|
||||
$table->foreign('file_id')
|
||||
->references('id')
|
||||
->on('files')
|
||||
->onDelete('cascade')
|
||||
->onUpdate('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('contents_has_files');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user