<?php
namespace GemBoards\Database;

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

use GemBoards\Utils\Helper;

class CreateCardAssigneesTable {

	public static function up( $prefix, $charset_collate ) {
		$table_name = $prefix . Helper::CARD_ASSIGNEES_TABLE_NAME;
		$sql        = "CREATE TABLE $table_name (
		    id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
		    card_id bigint(20) unsigned NOT NULL,
		    user_id bigint(20) unsigned NOT NULL,
		    updated_at datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
		    PRIMARY KEY  (id),
		    KEY `card_id` (`card_id`),
		    KEY `user_id` (`user_id`),
		    KEY `card_user` (`card_id`, `user_id`)
		) $charset_collate;";
		dbDelta( $sql );
	}

}
