recreate the old table structure

This commit is contained in:
Alexander Yakovlev 2022-10-23 13:43:26 +06:00
parent f16dbca012
commit fb0393561b

View file

@ -0,0 +1,50 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class RecreateOldTables extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
if (!Schema::hasTable('posts')) {
Schema::create('posts', function (Blueprint $table) {
$table->id();
$table->integer('active')->unsigned()->default(2);
$table->string('title')->nullable();
$table->text('content')->nullable();
$table->text('tags')->nullable();
$table->timestamps();
});
}
if (!Schema::hasTable('pages')) {
Schema::create('pages', function (Blueprint $table) {
$table->id();
$table->integer('active')->unsigned()->default(2);
$table->string('title')->nullable();
$table->text('content')->nullable();
$table->string('slug')->nullable()->unique();
$table->tinyInteger('order')->unsigned()->nullable();
$table->bigInteger('parent')->unsigned()->nullable();
$table->timestamps();
});
}
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('posts');
Schema::dropIfExists('pages');
}
}