Skip to content

Instantly share code, notes, and snippets.

@zackify
Created August 31, 2017 22:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zackify/41b2ef522ac36c7601a72f98af7df6b3 to your computer and use it in GitHub Desktop.
Save zackify/41b2ef522ac36c7601a72f98af7df6b3 to your computer and use it in GitHub Desktop.
const beforeInsert = ({ values, state }) => {
if(state.deleted) values.deleted_at = Date.now()
return values
}
const conversions = {
column_one: ({value, setState}) => {
if(value.match(/zz/)) setState({ deleted: true})
return value.replace('zz','')
}
}
export default {
from: 'table',
to: 'newtable',
beforeInsert,
conversions,
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment