Files
sam-api/database/migrations/2025_07_23_132616_create_posts_table.php
hskwon 609ac39ffb feat : 테이블 및 DB 마이그레이션 파일 추가
products
  - common_codes
  - parts
  - products
  - files
  - price_histories
  - boms
  - bom_items

  boards
  - boards
  - board_settings
  - posts
  - board_comments
  - board_files
  - post_custom_field_values

  permissions
  - menus
  - roles
  - user_menu_permissions
  - role_menu_permissions

  tenants
  - tenants
  - plans
  - subscriptions
  - payments
2025-07-23 15:41:01 +09:00

36 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
{
public function up(): void {
Schema::create('posts', function (Blueprint $table) {
$table->id()->comment('게시글 고유번호');
$table->unsignedBigInteger('tenant_id')->comment('테넌트 고유번호');
$table->unsignedBigInteger('board_id')->comment('게시판 고유번호');
$table->unsignedBigInteger('user_id')->nullable()->comment('작성자 고유번호');
$table->string('title', 255)->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')->comment('상태');
$table->timestamps();
$table->softDeletes()->comment('삭제일시(Soft Delete)');
$table->index(['tenant_id', 'board_id']);
$table->index('status');
$table->foreign('tenant_id')->references('id')->on('tenants');
$table->foreign('board_id')->references('id')->on('boards');
});
}
public function down(): void {
Schema::dropIfExists('posts');
}
};