diff options
| author | Ran Guin <[email protected]> | 2021-08-24 13:43:11 -0700 |
|---|---|---|
| committer | Ran Guin <[email protected]> | 2021-08-24 13:43:11 -0700 |
| commit | bdbe93b70d05d7f882f9b00cd563ebebb79bf086 (patch) | |
| tree | 85374be92a1d443a6487e23a5d0e24108b721680 /db/migrations | |
| parent | 3e76226c024c97d8e91b3e4cfc90b47efba38cb0 (diff) | |
| download | coinos-server-bdbe93b70d05d7f882f9b00cd563ebebb79bf086.tar.gz coinos-server-bdbe93b70d05d7f882f9b00cd563ebebb79bf086.zip | |
add fix to cull usernames
Diffstat (limited to 'db/migrations')
| -rw-r--r-- | db/migrations/20210821013757_cull_usernames.js | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/db/migrations/20210821013757_cull_usernames.js b/db/migrations/20210821013757_cull_usernames.js new file mode 100644 index 00000000..a4a48f21 --- /dev/null +++ b/db/migrations/20210821013757_cull_usernames.js @@ -0,0 +1,11 @@ + +exports.up = function(knex) { + return Promise.all([ + knex.raw("UPDATE users SET username = REPLACE(username, ' ', '') WHERE username like '% '"), // just in case valid users have trailing spaces in their username + knex.raw("DELETE FROM users WHERE !(username REGEXP '^[a-zA-Z0-9\.\_\@\-]{3,32}$'"), + ]) +}; + +exports.down = function(knex) { + +}; |
