//when plugin will be activate
register_activation_hook( __FILE__, 'am_on_activation' );


//When Am plugin activation
function am_on_activation()
{
global $wpdb;
$table_name = $wpdb->prefix . "archive_master";
$charset_collate = $wpdb->get_charset_collate();

$sql = "CREATE TABLE $table_name (
id int(11) NOT NULL AUTO_INCREMENT,
author_id int(11) NOT NULL,
archived_type varchar(10) DEFAULT NULL,
archived_by varchar(15) DEFAULT NULL,
sname varchar(200) NOT NULL,
show_post_count tinyint(4) DEFAULT 0,
before_html varchar(50) DEFAULT NULL,
after_html varchar(50) DEFAULT NULL,
order_by varchar(20) DEFAULT NULL,
post_limit int(11) DEFAULT NULL,
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ,
PRIMARY KEY (id)
) $charset_collate";
$wpdb->query($sql);
}