<?php
register_activation_hook(__FILE__, 'create_nurses_db');
function create_nurses_db() {
global $wpdb;
$charset_collate = $wpdb->get_charset_collate();
$table_name = $wpdb->prefix . 'nurses';
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
$sql = "CREATE TABLE IF NOT EXISTS " . $table_name . " (
id INT NOT NULL AUTO_INCREMENT,
post_id INT NOT NULL,
user_id INT NOT NULL,
admin_switched_id INT NOT NULL,
user_email VARCHAR(25) NOT NULL,
admin_email_switched VARCHAR(25) NOT NULL,
admin_user_name_switched VARCHAR(30) NOT NULL,
admin_role_switched VARCHAR(15) NOT NULL,
PRIMARY KEY (id)
) " . $charset_collate . ";";
dbDelta($sql);
}
?>