This commit is contained in:
2023-11-24 20:49:19 +08:00
parent ca5219cb93
commit be14f5fdb1
65 changed files with 1991 additions and 2214 deletions

View File

@@ -16,6 +16,8 @@ public function up(): void
$table->string('name');
$table->string('slug')->unique();
$table->string('i18n')->unique();
$table->string('country_iso');
$table->string('lang');
$table->boolean('enabled')->default(false);
$table->softDeletes();
$table->timestamps();

View File

@@ -1,6 +1,5 @@
<?php
use App\Models\CountryLocale;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
@@ -14,10 +13,13 @@ public function up(): void
{
Schema::create('categories', function (Blueprint $table) {
$table->id();
$table->foreignIdFor(CountryLocale::class);
$table->enum('type', ['review', 'launch', 'deals'])->default('review');
$table->foreignId('country_locale_id');
$table->string('country_locale_slug')->default('my');
$table->string('name')->nullable();
$table->string('short_name')->nullable();
$table->string('slug')->nullable();
$table->mediumText('description')->nullable();
$table->boolean('enabled')->default(true);
$table->boolean('is_top')->default(true);
$table->nestedSet();
@@ -25,6 +27,8 @@ public function up(): void
$table->timestamps();
$table->foreign('country_locale_id')->references('id')->on('country_locales');
$table->foreign('country_locale_slug')->references('slug')->on('country_locales');
});
}

View File

@@ -1,29 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('categories', function (Blueprint $table) {
$table->string('country_locale_slug')->after('country_locale_id')->default('my');
$table->foreign('country_locale_slug')->references('slug')->on('country_locales');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('categories', function (Blueprint $table) {
$table->dropColumn('country_locale_slug');
});
}
};

View File

@@ -1,30 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('country_locales', function (Blueprint $table) {
$table->string('country_iso')->after('i18n');
$table->string('lang')->after('i18n');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('country_locales', function (Blueprint $table) {
$table->dropColumn('country_iso');
$table->dropColumn('lang');
});
}
};

View File

@@ -1,28 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('categories', function (Blueprint $table) {
$table->mediumText('description')->after('slug')->nullable();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('categories', function (Blueprint $table) {
$table->dropColumn('description');
});
}
};

View File

@@ -15,11 +15,13 @@ public function up(): void
$table->id();
$table->string('title')->nullable();
$table->string('slug')->nullable();
$table->text('cliffhanger')->nullable();
$table->mediumText('excerpt')->nullable();
$table->foreignId('author_id')->nullable();
$table->datetime('publish_date')->nullable();
$table->boolean('featured')->default(false);
$table->string('featured_image')->nullable();
$table->enum('editor', ['editorjs'])->default('editorjs');
$table->enum('editor', ['editorjs', 'markdown'])->default('editorjs');
$table->json('body')->nullable();
$table->enum('post_format', ['standard'])->default('standard');
$table->integer('comment_count')->default(0);

View File

@@ -1,28 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('posts', function (Blueprint $table) {
$table->datetime('publish_date')->nullable()->after('author_id');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('posts', function (Blueprint $table) {
$table->dropColumn('publish_date');
});
}
};

View File

@@ -1,28 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('categories', function (Blueprint $table) {
$table->enum('type', ['review', 'launch', 'deals'])->default('review')->after('id');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('categories', function (Blueprint $table) {
$table->dropColumn('type');
});
}
};

View File

@@ -1,28 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('posts', function (Blueprint $table) {
$table->string('cliffhanger')->after('excerpt')->nullable();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('posts', function (Blueprint $table) {
$table->dropColumn('cliffhanger');
});
}
};

View File

@@ -1,28 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up()
{
Schema::table('posts', function (Blueprint $table) {
$table->text('cliffhanger')->after('excerpt')->nullable()->change();
});
}
/**
* Reverse the migrations.
*/
public function down()
{
Schema::table('posts', function (Blueprint $table) {
$table->string('cliffhanger')->after('excerpt')->nullable()->change();
});
}
};

View File

@@ -1,24 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
DB::statement("ALTER TABLE posts CHANGE COLUMN editor editor ENUM('editorjs', 'markdown') NOT NULL DEFAULT 'editorjs'");
}
/**
* Reverse the migrations.
*/
public function down(): void
{
DB::statement("ALTER TABLE posts CHANGE COLUMN editor editor ENUM('editorjs') NOT NULL DEFAULT 'editorjs'");
}
};