Last active
May 29, 2017 18:54
-
-
Save chrisfosterelli/2b91f13ff5b20116154b2bfc5582753f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Update records to clear UTF8 characters | |
* May 29th, 2017 | |
*/ | |
const r = require('./server/r') | |
function run(cb) { | |
r.table('Student') | |
.replace(student => { | |
const replace = str => str.split('\u001d').reduce((l, r) => l.add(r)) | |
const first = replace(student('name')('first')) | |
const last = replace(student('name')('last')) | |
const name = student('name').merge({ first, last }) | |
return student.merge({ name }) | |
}) | |
.then(rslt => { | |
console.log('Updated', rslt.replaced, 'students') | |
process.exit(0) | |
}) | |
} | |
run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment