FEATURE: move blog module into own repository
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
class CreateComments extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('comments', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
$table->integer('user_id')
|
||||
->nullable(true)
|
||||
->default(null)
|
||||
->comment('When comment was inserted by logged user, save his ID here');
|
||||
$table->integer('content_id');
|
||||
$table->string('email');
|
||||
$table->string('name');
|
||||
$table->text('content');
|
||||
$table->boolean('approved');
|
||||
|
||||
$table->foreign('content_id')
|
||||
->references('id')
|
||||
->on('contents')
|
||||
->onDelete('cascade')
|
||||
->onUpdate('cascade');
|
||||
|
||||
$table->foreign('user_id')
|
||||
->references('id')
|
||||
->on('users')
|
||||
->onDelete('set null')
|
||||
->onUpdate('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('comments');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use App\Models\Module;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
class UpdateAliasForSubdomodules extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Module::where('alias', 'blog-articlelist')
|
||||
->update(['alias' => 'articlelist']);
|
||||
Module::where('alias', 'blog-article')
|
||||
->update(['alias' => 'article']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Module::where('alias', 'articlelist')
|
||||
->update(['alias' => 'blog-articlelist']);
|
||||
Module::where('alias', 'article')
|
||||
->update(['alias' => 'blog-article']);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user