Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion SETUP/db_schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@ CREATE TABLE `users` (
`navbar_activity_menu` tinyint NOT NULL DEFAULT '1',
PRIMARY KEY (`username`),
UNIQUE KEY `api_key` (`api_key`),
KEY `u_id` (`u_id`),
UNIQUE KEY `u_id` (`u_id`),
KEY `last_login` (`last_login`),
KEY `t_last_activity` (`t_last_activity`),
KEY `api_key_username` (`api_key`,`username`),
Expand Down
22 changes: 22 additions & 0 deletions SETUP/upgrade/25/20260603_make_users_u_id_unique.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php
$relPath = '../../../pinc/';
include_once($relPath.'base.inc');

header('Content-type: text/plain');

// ------------------------------------------------------------

echo "Making u_id INDEX in users UNIQUE..\n";
$sql = "
ALTER TABLE users
DROP INDEX u_id,
ADD UNIQUE INDEX u_id (u_id);
";

echo "$sql\n";

mysqli_query(DPDatabase::get_connection(), $sql) or die(mysqli_error(DPDatabase::get_connection()));

// ------------------------------------------------------------

echo "\nDone!\n";