<?php require_once "../framework2/Walkntrade.php"; class DataMigration extends Walkntrade { public function __construct() { parent::__construct(); } public function genThreadIndices() { if (!($stmt = $this->getUserConnection()->prepare("SELECT id FROM `users`;"))) { echo "prepare failed"; return; } $stmt->execute(); $stmt->bind_result($uid); while ($stmt->fetch()) { if ($createInboxSTMT = $this->getThread_indexConnection()->prepare("\n\t\t\t\t\tCREATE TABLE `wtonline_thread_index`.`{$uid}` (\n\t\t\t\t `thread_id` VARCHAR(20) NOT NULL,\n\t\t\t\t `last_message` VARCHAR(100) NOT NULL,\n\t\t\t\t `last_user_id` INT(50) NOT NULL,\n\t\t\t\t `post_id` VARCHAR(45) NOT NULL,\n\t\t\t\t `post_title` VARCHAR(100) NULL,\n\t\t\t\t `datetime` DATETIME NOT NULL,\n\t\t\t\t `new_messages` INT(2) NOT NULL,\n\t\t\t\t `associated_with` INT(50) NOT NULL,\n\t\t\t\t `locked` BIT NOT NULL,\n\t\t\t\t `hidden` BIT NOT NULL,\n\t\t\t\t PRIMARY KEY (`thread_id`),\n\t\t\t\t UNIQUE INDEX `thread_id_UNIQUE` (`thread_id` ASC));\n\t\t\t\t")) { $createInboxSTMT->execute(); $createInboxSTMT->close(); } } echo "generated thread indices for each user!"; } } $dm = new DataMigration(); $dm->genThreadIndices();