<?php

namespace GemBoards\Database;

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

use GemBoards\Utils\Helper;

class CreateBoardsTable {

	public static function up( $prefix, $charset_collate ) {
		$table_name = $prefix . Helper::BOARDS_TABLE_NAME;
		$sql        = "CREATE TABLE $table_name (
            id BIGINT(20) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
            project_id BIGINT(20) UNSIGNED NOT NULL,
            folder_id BIGINT(20) UNSIGNED DEFAULT NULL,
            board_type VARCHAR(20),
            board_status VARCHAR(20) DEFAULT 'active',
            title VARCHAR(255),
            icon_color VARCHAR(20),
            is_private BOOLEAN DEFAULT FALSE,
            owner_id BIGINT(20) UNSIGNED,
            settings LONGTEXT,
            created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
            updated_at DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
        ) $charset_collate;";
		dbDelta( $sql );
	}

}
