Merge branch 'template_support' into dev
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class SaveTemplatesIntoModulesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('modules', function (Blueprint $table){
|
||||
$table->boolean('is_template')->default(false)->comment('Templates can be treated as modules.');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('modules', function (Blueprint $table){
|
||||
$table->dropColumn('is_template');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddTemplateSupportToWidgets extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('widget_types', function (Blueprint $table) {
|
||||
$table->integer('template_id')
|
||||
->comment('Commes this widget with template?')
|
||||
->after('handler')
|
||||
->nullable(true)
|
||||
->default(null);
|
||||
$table->integer('module_id')
|
||||
->comment('Commes this widget with some module?')
|
||||
->after('template_id')
|
||||
->nullable(true)
|
||||
->default(null);
|
||||
|
||||
$table->foreign('template_id')
|
||||
->references('id')
|
||||
->on('modules')
|
||||
->onDelete('cascade')
|
||||
->onUpdate('cascade');
|
||||
|
||||
$table->foreign('module_id')
|
||||
->references('id')
|
||||
->on('modules')
|
||||
->onDelete('cascade')
|
||||
->onUpdate('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('widget_types', function (Blueprint $table) {
|
||||
$table->dropForeign('widget_types_module_id_foreign');
|
||||
$table->dropForeign('widget_types_template_id_foreign');
|
||||
$table->dropColumn(['template_id', 'module_id']);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class MakeWidgetsAndWidgetAreasNotDeletable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('widgets', function (Blueprint $table) {
|
||||
$table->boolean('deletable')
|
||||
->default(true)
|
||||
->comment('Can this widget be deleted?');
|
||||
});
|
||||
|
||||
Schema::table('widget_areas', function (Blueprint $table) {
|
||||
$table->boolean('deletable')
|
||||
->default(true)
|
||||
->comment('Can this widget area be deleted?');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('widgets', function (Blueprint $table) {
|
||||
$table->dropColumn('deletable');
|
||||
});
|
||||
|
||||
Schema::table('widget_areas', function (Blueprint $table) {
|
||||
$table->dropColumn('deletable');
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user