summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/migration/user-profile.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/tools/migration/user-profile.js b/tools/migration/user-profile.js
new file mode 100644
index 0000000000..e6666319e1
--- /dev/null
+++ b/tools/migration/user-profile.js
@@ -0,0 +1,18 @@
+db.users.find({}).forEach(function(user) {
+ print(user._id);
+ db.users.update({ _id: user._id }, {
+ $rename: {
+ bio: 'description'
+ },
+ $unset: {
+ location: '',
+ birthday: ''
+ },
+ $set: {
+ profile: {
+ location: user.location || null,
+ birthday: user.birthday || null
+ }
+ }
+ }, false, false);
+});