Generalize Pipelines to Workflows.

I’ve tried to make this PR as small as possible – containing only the changes necessary for the Workflow conversion. It’s still pretty big.
Should be `<=`. http://www.postgresql.org/docs/9.2/static/functions-comparison.html