Created
July 20, 2020 08:47
-
-
Save BytesCrafter/6550dbbfdb811adcfd3ce3b3d9442453 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function dbhook_activate() { | |
global $wpdb; | |
// #region CREATING TABLE FOR Clusters | |
$usn_cluster_tab = USN_CLUSTER_TAB; | |
if($wpdb->get_var( "SHOW TABLES LIKE '$usn_cluster_tab'" ) != $usn_cluster_tab) { | |
$sql = "CREATE TABLE `".$usn_cluster_tab."` ("; | |
$sql .= "`ID` bigint(20) NOT NULL AUTO_INCREMENT, "; | |
$sql .= "`cluster_name` varchar(120) NOT NULL, "; | |
$sql .= "`cluster_info` varchar(255) NOT NULL, "; | |
$sql .= "`cluster_owner` bigint(20) NOT NULL, "; | |
$sql .= "`cluster_hostname` varchar(120) NOT NULL, "; | |
$sql .= "`cluster_secretkey` varchar(120) NOT NULL, "; | |
$sql .= "`cluster_capacity` int(12) NOT NULL DEFAULT '1000', "; | |
$sql .= "`date_created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, "; | |
$sql .= "PRIMARY KEY (`ID`), "; | |
$sql .= "UNIQUE (`cluster_name`) "; | |
$sql .= ") ENGINE = InnoDB; "; | |
$result = $wpdb->get_results($sql); | |
} | |
// #endregion | |
} | |
add_action( 'activated_plugin', 'dbhook_activate' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment