Files
sam-api/database/migrations/2025_07_26_051643_create_posts_table.php
kent b436b635c2 fix : 테이블 추가 및 수정 신규로 작성 (generator 설치)
composer require --dev kitloong/laravel-migrations-generator
php artisan migrate:generate
2025-07-26 05:22:58 +09:00

42 lines
1.6 KiB
PHP

<?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::create('posts', function (Blueprint $table) {
$table->bigIncrements('id')->comment('게시글 고유번호');
$table->unsignedBigInteger('tenant_id')->comment('테넌트 고유번호');
$table->unsignedBigInteger('board_id')->index('posts_board_id_foreign')->comment('게시판 고유번호');
$table->unsignedBigInteger('user_id')->nullable()->comment('작성자 고유번호');
$table->string('title')->comment('제목');
$table->longText('content')->comment('내용');
$table->string('editor_type', 20)->default('wysiwyg')->comment('에디터 유형');
$table->string('ip_address', 45)->nullable()->comment('작성자 IP');
$table->boolean('is_notice')->default(false)->comment('공지글 여부');
$table->boolean('is_secret')->default(false)->comment('비밀글 여부');
$table->integer('views')->default(0)->comment('조회수');
$table->string('status', 20)->default('active')->index()->comment('상태');
$table->timestamps();
$table->softDeletes()->comment('삭제일시(Soft Delete)');
$table->index(['tenant_id', 'board_id']);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('posts');
}
};