private static function createUserTable() { $db = self::getInstance('app'); $userProperties = CommonFunction::getUserProperties(); $propertySQL = []; foreach ($userProperties as $property => $propertyType) { switch ($propertyType) { case 'string': $dataType = 'VARCHAR(255)'; break; case 'int': $dataType = 'INT(6)'; break; case 'float': $dataType = 'FLOAT(28,8)'; break; case 'bool': $dataType = 'BIT'; break; default: $dataType = 'VARCHAR(255)'; } if ($property == 'Id') { $dataType .= ' UNSIGNED AUTO_INCREMENT PRIMARY KEY'; } $property = strtolower($property); $propertySQL[] = "{$property} {$dataType}"; } $propertyQuery = implode(', ', $propertySQL); $query = "\r\n CREATE TABLE if not EXISTS users (\r\n " . $propertyQuery . "\r\n )\r\n "; $result = $db->prepare($query); $result->execute([':fields' => $propertyQuery]); if ($result->rowCount() > 0) { return true; } }