diff options
| author | Ran Guin <[email protected]> | 2021-08-24 13:43:11 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2021-08-30 16:04:48 -0700 |
| commit | 8198ea6beec15f33015483cb911a58a0bc8f0d2e (patch) | |
| tree | a858e1bbd5f6c4211344c334468bf3a2f579237c /db | |
| parent | f6a80b3b79557a7d0f3deb14c1264a30502e0fa3 (diff) | |
| download | coinos-server-8198ea6beec15f33015483cb911a58a0bc8f0d2e.tar.gz coinos-server-8198ea6beec15f33015483cb911a58a0bc8f0d2e.zip | |
add fix to cull usernames
Diffstat (limited to 'db')
| -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) { + +}; |
