 
 module.exports = (callback = ->) ->
   return callback new Error('No GRAVITY_MONGO_URL') unless GRAVITY_MONGO_URL?
+  setup (err) ->
+    return callback err if err
+    async.parallel [updateSyncedArticleSlugs, migrateOldPosts], callback
 
+setup = (callback) ->
   # Load the Positron & Gravity databases
   db = require './db'
   gravity = mongojs GRAVITY_MONGO_URL, ['posts', 'post_artist_features',
     'post_artwork_features', 'artworks']
-
   debug "Connecting to databases and beginning migrate..."
-
   # Make sure both databases are a go first before dropping previously migrated
   # posts.
   async.parallel [

      queries.push (cb) -> gravity.artworks.find { _id: $in: artworkIds }, cb
    async.parallel queries, (err, results) ->
      [artistFeatures, artworkFeatures, artworks] = results

      # Map Gravity data into a Positron schema
      data =
        _id: post._id

        featured_artist_ids: (f.artist_id for f in artistFeatures)
        featured_artwork_ids: (f.artwork_id for f in artworkFeatures)
        gravity_id: post._id
      # Callback with mapped data
      debug "Mapped #{_.last post._slugs}"
      callback? null, data
  ), (err, articles) ->
    return callback(err) if err
    # Bulk update the mapped articles into Positron
    bulk = db.articles.initializeOrderedBulkOp()
    bulk.insert(article) for article in articles
