Made timestamps be at the end of the users table like every other table.
This commit is contained in:
parent
372797c564
commit
7f85abba6e
4 changed files with 30 additions and 17 deletions
database
public-legacy/settings
src/Users
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
use Index\Db\DbConnection;
|
||||
use Index\Db\Migration\DbMigration;
|
||||
|
||||
final class RearrangedSomeFieldsInTheUsersTable_20250208_232136 implements DbMigration {
|
||||
public function migrate(DbConnection $conn): void {
|
||||
$conn->execute(<<<SQL
|
||||
ALTER TABLE msz_users
|
||||
CHANGE COLUMN user_title user_title VARCHAR(64) NULL DEFAULT NULL COLLATE 'utf8mb4_unicode_520_ci' AFTER user_colour,
|
||||
CHANGE COLUMN user_display_role_id user_display_role_id INT(10) UNSIGNED NULL DEFAULT NULL AFTER user_title;
|
||||
SQL);
|
||||
}
|
||||
}
|
|
@ -151,7 +151,7 @@ if(isset($_POST['action']) && is_string($_POST['action'])) {
|
|||
$tmpFiles[] = db_to_zip($archive, $userInfo, 'profile_backgrounds', ['user_id:s', 'bg_attach:s', 'bg_blend:i', 'bg_slide:i']);
|
||||
$tmpFiles[] = db_to_zip($archive, $userInfo, 'profile_fields_values', ['field_id:s', 'user_id:s', 'format_id:s', 'field_value:s']);
|
||||
$tmpFiles[] = db_to_zip($archive, $userInfo, 'sessions', ['session_id:s', 'user_id:s', 'session_key:n', 'session_remote_addr_first:a', 'session_remote_addr_last:a:n', 'session_user_agent:s', 'session_country:s', 'session_expires:t', 'session_expires_bump:b', 'session_created:t', 'session_active:t:n']);
|
||||
$tmpFiles[] = db_to_zip($archive, $userInfo, 'users', ['user_id:s', 'user_name:s', 'user_password:n', 'user_email:s', 'user_remote_addr_first:a', 'user_remote_addr_last:a', 'user_super:b', 'user_country:s', 'user_colour:i:n', 'user_created:t', 'user_active:t:n', 'user_deleted:t:n', 'user_display_role_id:s:n', 'user_title:s:n']);
|
||||
$tmpFiles[] = db_to_zip($archive, $userInfo, 'users', ['user_id:s', 'user_name:s', 'user_password:n', 'user_email:s', 'user_remote_addr_first:a', 'user_remote_addr_last:a', 'user_super:b', 'user_country:s', 'user_colour:i:n', 'user_title:s:n', 'user_display_role_id:s:n', 'user_created:t', 'user_active:t:n', 'user_deleted:t:n']);
|
||||
$tmpFiles[] = db_to_zip($archive, $userInfo, 'users_bans', ['ban_id:s', 'user_id:s', 'mod_id:n', 'ban_severity:i', 'ban_reason_public:s', 'ban_reason_private:s', 'ban_created:t', 'ban_expires:t:n']);
|
||||
$tmpFiles[] = db_to_zip($archive, $userInfo, 'users_birthdates', ['user_id:s', 'birth_year:i:n', 'birth_month:i', 'birth_day:i']);
|
||||
$tmpFiles[] = db_to_zip($archive, $userInfo, 'users_password_resets', ['reset_id:s', 'user_id:s', 'reset_remote_addr:a', 'reset_requested:t', 'reset_code:n']);
|
||||
|
|
|
@ -16,11 +16,11 @@ class UserInfo {
|
|||
public private(set) bool $super,
|
||||
public private(set) string $countryCode,
|
||||
public private(set) ?int $colourRaw,
|
||||
public private(set) ?string $title,
|
||||
public private(set) ?string $displayRoleId,
|
||||
public private(set) int $createdTime,
|
||||
public private(set) ?int $lastActiveTime,
|
||||
public private(set) ?int $deletedTime,
|
||||
public private(set) ?string $displayRoleId,
|
||||
public private(set) ?string $title,
|
||||
) {}
|
||||
|
||||
public static function fromResult(DbResult $result): self {
|
||||
|
@ -34,11 +34,11 @@ class UserInfo {
|
|||
super: $result->getBoolean(6),
|
||||
countryCode: $result->getString(7),
|
||||
colourRaw: $result->getIntegerOrNull(8),
|
||||
createdTime: $result->getInteger(9),
|
||||
lastActiveTime: $result->getIntegerOrNull(10),
|
||||
deletedTime: $result->getIntegerOrNull(11),
|
||||
displayRoleId: $result->getStringOrNull(12),
|
||||
title: $result->getString(13),
|
||||
title: $result->getString(9),
|
||||
displayRoleId: $result->getStringOrNull(10),
|
||||
createdTime: $result->getInteger(11),
|
||||
lastActiveTime: $result->getIntegerOrNull(12),
|
||||
deletedTime: $result->getIntegerOrNull(13),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -168,10 +168,10 @@ class UsersData {
|
|||
SELECT u.user_id, u.user_name, u.user_password, u.user_email,
|
||||
INET6_NTOA(u.user_remote_addr_first), INET6_NTOA(u.user_remote_addr_last),
|
||||
u.user_super, u.user_country, u.user_colour,
|
||||
u.user_title, u.user_display_role_id,
|
||||
UNIX_TIMESTAMP(u.user_created),
|
||||
UNIX_TIMESTAMP(u.user_active),
|
||||
UNIX_TIMESTAMP(u.user_deleted),
|
||||
u.user_display_role_id, u.user_title
|
||||
UNIX_TIMESTAMP(u.user_deleted)
|
||||
FROM msz_users AS u
|
||||
SQL;
|
||||
if($hasRoleInfo)
|
||||
|
@ -274,10 +274,10 @@ class UsersData {
|
|||
SELECT user_id, user_name, user_password, user_email,
|
||||
INET6_NTOA(user_remote_addr_first), INET6_NTOA(user_remote_addr_last),
|
||||
user_super, user_country, user_colour,
|
||||
user_title, user_display_role_id,
|
||||
UNIX_TIMESTAMP(user_created),
|
||||
UNIX_TIMESTAMP(user_active),
|
||||
UNIX_TIMESTAMP(user_deleted),
|
||||
user_display_role_id, user_title
|
||||
UNIX_TIMESTAMP(user_deleted)
|
||||
FROM msz_users
|
||||
SQL;
|
||||
if($selectId) {
|
||||
|
@ -387,16 +387,16 @@ class UsersData {
|
|||
$values[] = $colour->inherits ? null : Colour::toMisuzu($colour);
|
||||
}
|
||||
|
||||
if($displayRoleInfo !== null) {
|
||||
$fields[] = 'user_display_role_id = ?';
|
||||
$values[] = $displayRoleInfo;
|
||||
}
|
||||
|
||||
if($title !== null) {
|
||||
$fields[] = 'user_title = ?';
|
||||
$values[] = $title;
|
||||
}
|
||||
|
||||
if($displayRoleInfo !== null) {
|
||||
$fields[] = 'user_display_role_id = ?';
|
||||
$values[] = $displayRoleInfo;
|
||||
}
|
||||
|
||||
if(empty($fields))
|
||||
return;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue