120.sql (9794B)
1 -- +migrate Up 2 3 create table users_tmp ( 4 id INTEGER not null primary key, 5 username VARCHAR(50) not null COLLATE NOCASE unique, 6 password VARCHAR(255) not null, 7 two_factor_secret BLOB, 8 two_factor_recovery BLOB, 9 gpg_public_key TEXT, 10 token VARCHAR(255) unique, 11 role VARCHAR(30) default 'member' not null, 12 lang VARCHAR(10) default '' not null, 13 chat_color VARCHAR(20) default '#000000' not null, 14 api_key VARCHAR(50) default '' not null, 15 created_at DATETIME default CURRENT_TIMESTAMP not null, 16 deleted_at DATETIME, 17 updated_at DATETIME default CURRENT_TIMESTAMP, 18 is_admin TINYINT(1) default 0 not null, 19 is_hellbanned TINYINT(1) default 0 not null, 20 verified TINYINT(1) default 0 not null, 21 chat_font INTEGER default 1 not null, 22 chat_bold TINYINT default 0 not null, 23 chat_italic TINYINT default 0 not null, 24 refresh_rate INTEGER default 5 not null, 25 login_attempts INTEGER default 0 not null, 26 temp TINYINT(1) default 0 not null, 27 notify_new_message TINYINT(1) default 1 not null, 28 notify_tagged TINYINT(1) default 1 not null, 29 notify_pmmed TINYINT(1) default 1 not null, 30 notify_new_message_sound INTEGER default 1 not null, 31 notify_tagged_sound INTEGER default 1 not null, 32 notify_pmmed_sound INTEGER default 1 not null, 33 avatar BLOB, 34 email VARCHAR(255), 35 website VARCHAR(255), 36 is_club_member TINYINT(1) default 0 not null, 37 last_seen_at DATETIME default 0 not null, 38 display_hellbanned TINYINT(1) default 0 not null, 39 chat_tutorial INTEGER default 0 not null, 40 chat_tutorial_time DATETIME, 41 chat_read_marker_enabled TINYINT(1) default 1 not null, 42 chat_read_marker_color VARCHAR(50) default '#4e7597' not null, 43 chat_read_marker_size INTEGER default 1 not null, 44 can_upload_file TINYINT(1) default 1, 45 display_pms INTEGER default 0 not null, 46 display_ignored TINYINT(1) default 0 not null, 47 can_use_forum TINYINT(1) default 1, 48 gpg_two_factor_enabled TINYINT(1) default 0, 49 display_kick_button TINYINT(1) default 0 not null, 50 display_moderators TINYINT(1) default 1 not null, 51 hide_ignored_users_from_list TINYINT(1) default 0 not null, 52 registration_duration INTEGER default 0, 53 last_seen_public TINYINT(1) default 1 not null, 54 vetted TINYINT(1) default 0 not null, 55 terminate_all_sessions_on_logout TINYINT(1) default 1 not null, 56 age_public_key VARCHAR(255) default '' not null, 57 can_change_username TINYINT(1) default 1 not null, 58 pm_mode INTEGER default 0 not null, 59 hide_right_column TINYINT(1) default 0 not null, 60 date_format INTEGER default 0 not null, 61 can_use_multiline TINYINT(1) default 0 not null, 62 signup_metadata TEXT default '' not null, 63 karma INTEGER default 0 not null, 64 duress_password VARCHAR(255) default '' not null, 65 is_under_duress TINYINT(1) default 0 not null, 66 secret_phrase BLOB, 67 display_hellban_button TINYINT(1) default 1 not null, 68 display_delete_button TINYINT(1) default 1 not null, 69 can_change_color TINYINT(1) default 1 not null, 70 is_incognito TINYINT(1) default 0 not null, 71 block_new_users_pm TINYINT(1) default 0 not null, 72 collect_metadata TINYINT(1) default 0 not null, 73 captcha_required TINYINT(1) default 0 not null, 74 can_see_hellbanned TINYINT(1) default 0 not null, 75 theme INTEGER default 0 not null, 76 afk TINYINT(1) default 0 not null, 77 notify_chess_move TINYINT(1) default 0 not null, 78 chat_bar_at_bottom TINYINT(1) default 0 not null, 79 notify_chess_games TINYINT(1) default 0 not null, 80 autocomplete_commands_enabled TINYINT(1) default 1 not null, 81 general_messages_count INTEGER default 0 not null, 82 afk_indicator_enabled TINYINT(1) default 0 not null, 83 gpg_two_factor_mode TINYINT(1) default 0, 84 spellcheck_enabled TINYINT(1) default 0 not null, 85 can_use_uppercase TINYINT(1) default 1 not null 86 ); 87 88 INSERT INTO users_tmp ( 89 id, 90 username, 91 password, 92 two_factor_secret, 93 two_factor_recovery, 94 gpg_public_key, 95 token, 96 role, 97 lang, 98 chat_color, 99 api_key, 100 created_at, 101 deleted_at, 102 updated_at, 103 is_admin, 104 is_hellbanned, 105 verified, 106 chat_font, 107 chat_bold, 108 chat_italic, 109 refresh_rate, 110 login_attempts, 111 temp, 112 notify_new_message, 113 notify_tagged, 114 notify_pmmed, 115 notify_new_message_sound, 116 notify_tagged_sound, 117 notify_pmmed_sound, 118 avatar, 119 email, 120 website, 121 is_club_member, 122 last_seen_at, 123 display_hellbanned, 124 chat_tutorial, 125 chat_tutorial_time, 126 chat_read_marker_enabled, 127 chat_read_marker_color, 128 chat_read_marker_size, 129 can_upload_file, 130 display_pms, 131 display_ignored, 132 can_use_forum, 133 gpg_two_factor_enabled, 134 display_kick_button, 135 display_moderators, 136 hide_ignored_users_from_list, 137 registration_duration, 138 last_seen_public, 139 vetted, 140 terminate_all_sessions_on_logout, 141 age_public_key, 142 can_change_username, 143 pm_mode, 144 hide_right_column, 145 date_format, 146 can_use_multiline, 147 signup_metadata, 148 karma, 149 duress_password, 150 is_under_duress, 151 secret_phrase, 152 display_hellban_button, 153 display_delete_button, 154 can_change_color, 155 is_incognito, 156 block_new_users_pm, 157 collect_metadata, 158 captcha_required, 159 can_see_hellbanned, 160 theme, 161 afk, 162 notify_chess_move, 163 chat_bar_at_bottom, 164 notify_chess_games, 165 autocomplete_commands_enabled, 166 general_messages_count, 167 afk_indicator_enabled, 168 gpg_two_factor_mode, 169 spellcheck_enabled, 170 can_use_uppercase) 171 SELECT 172 id, 173 username, 174 password, 175 two_factor_secret, 176 two_factor_recovery, 177 gpg_public_key, 178 token, 179 role, 180 lang, 181 chat_color, 182 api_key, 183 created_at, 184 deleted_at, 185 updated_at, 186 is_admin, 187 is_hellbanned, 188 verified, 189 chat_font, 190 chat_bold, 191 chat_italic, 192 refresh_rate, 193 login_attempts, 194 temp, 195 notify_new_message, 196 notify_tagged, 197 notify_pmmed, 198 notify_new_message_sound, 199 notify_tagged_sound, 200 notify_pmmed_sound, 201 avatar, 202 email, 203 website, 204 is_club_member, 205 last_seen_at, 206 display_hellbanned, 207 chat_tutorial, 208 chat_tutorial_time, 209 chat_read_marker_enabled, 210 chat_read_marker_color, 211 chat_read_marker_size, 212 can_upload_file, 213 display_pms, 214 display_ignored, 215 can_use_forum, 216 gpg_two_factor_enabled, 217 display_kick_button, 218 display_moderators, 219 hide_ignored_users_from_list, 220 registration_duration, 221 last_seen_public, 222 vetted, 223 terminate_all_sessions_on_logout, 224 age_public_key, 225 can_change_username, 226 pm_mode, 227 hide_right_column, 228 date_format, 229 can_use_multiline, 230 signup_metadata, 231 karma, 232 duress_password, 233 is_under_duress, 234 secret_phrase, 235 display_hellban_button, 236 display_delete_button, 237 can_change_color, 238 is_incognito, 239 block_new_users_pm, 240 collect_metadata, 241 captcha_required, 242 can_see_hellbanned, 243 theme, 244 afk, 245 notify_chess_move, 246 chat_bar_at_bottom, 247 notify_chess_games, 248 autocomplete_commands_enabled, 249 general_messages_count, 250 afk_indicator_enabled, 251 gpg_two_factor_mode, 252 spellcheck_enabled, 253 can_use_uppercase FROM users; 254 255 DROP TABLE users; 256 257 ALTER TABLE users_tmp RENAME TO users; 258 259 create index users_api_key_idx on users (api_key); 260 create index users_is_admin_idx on users (is_admin); 261 create index users_is_club_idx on users (is_club_member); 262 create index users_is_hellbanned_idx on users (is_hellbanned); 263 create index users_notify_chess_games_idx on users (notify_chess_games); 264 create index users_verified_idx on users (verified); 265 create index users_vetted_idx on users (vetted); 266 267 268 -- +migrate Down