mirror of
https://github.com/Unleash/unleash.git
synced 2025-10-18 11:14:57 +02:00
Adding email_hash column to users table. We will update all existing users to have hashed email. All new users will also get the hash. We are fine to use md5, because we just need uniqueness. We have emails in events table stored anyways, so it is not sensitive.
19 lines
325 B
JavaScript
19 lines
325 B
JavaScript
exports.up = (db, cb) => {
|
|
db.runSql(`
|
|
ALTER TABLE users
|
|
ADD COLUMN IF NOT EXISTS email_hash VARCHAR(32);
|
|
|
|
UPDATE users
|
|
SET email_hash = md5(email::text);
|
|
`, cb);
|
|
|
|
};
|
|
|
|
exports.down = (db, cb) => {
|
|
db.runSql(`
|
|
ALTER TABLE users
|
|
DROP COLUMN IF EXISTS email_hash;
|
|
`, cb);
|
|
};
|
|
|