40 lines
1.1 KiB
PHP
40 lines
1.1 KiB
PHP
<?php
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
class CreatePostsTable extends Migration
|
|
{
|
|
/**
|
|
* Run the migrations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function up()
|
|
{
|
|
Schema::create('posts', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->foreignId('user_id')->constrained()->cascadeOnDelete();
|
|
$table->foreignId('category_id')->constrained()->cascadeOnDelete();
|
|
$table->unsignedTinyInteger('privacy')->comment('1:Public, 2:Private')->default(1);
|
|
$table->unsignedTinyInteger('status')->comment('1:Draft, 2:Publish')->default(1);
|
|
$table->text('description')->nullable();
|
|
$table->bigInteger('created_by')->nullable()->length(20);
|
|
$table->bigInteger('updated_by')->nullable()->length(20);
|
|
$table->text('location')->nullable();
|
|
$table->timestamps();
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function down()
|
|
{
|
|
Schema::dropIfExists('posts');
|
|
}
|
|
}
|