14 use Illuminate\Database\Migrations\Migration;
15 use Illuminate\Database\Schema\Builder;
16 use Illuminate\Database\Schema\Blueprint;
17 use Illuminate\Database\Capsule\Manager as Capsule;
24 public function up() {
26 Capsule::schema()->create(
'categories',
function (Blueprint $table) {
27 $table->bigInteger(
'category_id')->autoIncrement();
28 $table->bigInteger(
'context_id');
29 $table->bigInteger(
'parent_id');
30 $table->bigInteger(
'seq')->nullable();
31 $table->string(
'path', 255);
32 $table->text(
'image')->nullable();
33 $table->index([
'context_id',
'parent_id'],
'category_context_id');
34 $table->unique([
'context_id',
'path'],
'category_path');
38 Capsule::schema()->create(
'category_settings',
function (Blueprint $table) {
39 $table->bigInteger(
'category_id');
40 $table->string(
'locale', 14)->
default(
'');
41 $table->string(
'setting_name', 255);
42 $table->text(
'setting_value')->nullable();
43 $table->string(
'setting_type', 6)->comment(
'(bool|int|float|string|object)');
44 $table->unique([
'category_id',
'locale',
'setting_name'],
'category_settings_pkey');
48 Capsule::schema()->create(
'publication_categories',
function (Blueprint $table) {
49 $table->bigInteger(
'publication_id');
50 $table->bigInteger(
'category_id');
51 $table->unique([
'publication_id',
'category_id'],
'publication_categories_id');
61 Capsule::schema()->drop(
'categories');
62 Capsule::schema()->drop(
'category_settings');
63 Capsule::schema()->drop(
'publication_categories');