<?php
namespace GemBoards\Database;

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

use GemBoards\Utils\Helper;

class CreateProjectsTable {

	public static function up( $prefix, $charset_collate ) {
		$table_name = $prefix . Helper::PROJECTS_TABLE_NAME;
		$sql        = "CREATE TABLE $table_name (
            id BIGINT(20) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
            owner_id BIGINT(20) UNSIGNED,
            title VARCHAR(255) NOT NULL,
            slug VARCHAR(200),
            project_status VARCHAR(20) DEFAULT 'active',
            description TEXT,
            icon VARCHAR(100) DEFAULT NULL,
            color VARCHAR(7) DEFAULT NULL,
            settings LONGTEXT,
            created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
            updated_at DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
        ) $charset_collate;";
		dbDelta( $sql );
	}

}
