<?php

namespace GemBoards\Database;

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

use GemBoards\Utils\Helper;

class CreateTaskAttachmentsTable {
	public static function up( $prefix, $charset_collate ) {
		$table_name = $prefix . Helper::BOARD_ATTACHMENTS_TABLE_NAME;
		$sql        = "CREATE TABLE IF NOT EXISTS $table_name (
			id BIGINT(20) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
			task_id BIGINT(20) UNSIGNED NOT NULL,
			user_id BIGINT(20) UNSIGNED NOT NULL,
			file_url TEXT NOT NULL,
			file_name VARCHAR(255),
			file_type VARCHAR(100),
			file_size INT,
			created_at DATETIME DEFAULT CURRENT_TIMESTAMP
		) $charset_collate;";
		dbDelta( $sql );
	}
}
