<?php

namespace GemBoards\Database;

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

class CreateUserInvitationTable {

	public static function up( $prefix, $charset_collate ) {
		$table_name = $prefix . 'gemboards_user_invitations';
		$sql        = "CREATE TABLE $table_name (
            id BIGINT(20) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
            object_id BIGINT(20) UNSIGNED NOT NULL,
            object_type VARCHAR(20) DEFAULT NULL,
            email VARCHAR(255) NOT NULL,
            hash VARCHAR(200) NOT NULL,
            email_sent_count BIGINT(20) UNSIGNED DEFAULT 0,
            created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
            expired_at DATETIME DEFAULT NULL
        ) $charset_collate;";
		dbDelta( $sql );
	}

}
