(NC-140) Add aggregate-column sql util.

Like aggregate-submap-by, but instead of aggregating two columns into
a map under a new key, just aggregates one column into a sequence under
a new key.
(maint) sql aggregation utils preserve row order.

Due to the use of group-by, the aggregate-* sql utils did not preserve
the order of the rows passed in if there were more than eight groups,
since this is the point at which clojure switches from using an ArrayMap
(which preserves insertion order) to a HashMap (which does not). Since
none of our tests exceeded this threshold, it was not noticed before.

Add ordered-group-by to the sql-utils ns, which is similar to group-by,
but adds the first index that a member of the group was seen at to the
beginning of the vector with the group members, and returns a seq of map
entries sorted by this index (rather than a map).

Augment the aggregate-column test so it has enough data to overflow the
ArrayMap size and use a HashMap, which will mess up ordering if we're
not careful.
(NC-140) Rules are a field of groups.

Change rules from being standalone entities that are linked to zero or
more groups to being conceptually part of a group (and therefore linked
only to that group). This involves changes to the database tables,
schemas, storage protocol & postgres implementation thereof, rules, and
the HTTP layer.

Remove the rule_groups join table, and instead add a `group_id` column
to the rules table.

Add a :rules field to the Group schema, remove the :groups field from
the Rule schema, and add an optional :group-id field to the Rule schema.

Remove the `create-rule` method from the Storage protocol as that
operation will be done as part of creating a group. Add rules to the big
group selection & join, and also order the results of the selection to
preserve rule order.

The apply-rule function requires the rule its given to have a :group-id
field, and returns that (rather than the old group name vector under
:groups) if the node matches the rule.

Remove the rules endpoint from the http handler, and change the
classified endpoint slightly to handle the new output from apply-rule
(i.e. a single group-id rather than a vector of group names).
(NC-140) Groups can have only one rule.

Rule conditions can be arbitrary boolean expressions anyways, so this
doesn't remove any functionality, it just simplifies classification
since the user doesn't have to wonder whether multiple rules are ANDed
or ORred together; instead they just explicitly make the rule
a conjuction or disjunction as desired.
(NC-140) Update group rule using delta.

The semantics of updating the rule are the same as updating the
environment: if the key is in the delta, its value replaces the old
wholesale; otherwise, the rule is left alone.
(NC-140) Update docs to reflect changes.

The rules endpoint is gone, so get rid of that doc page.

Add notes on rule grammar to the groups page, and talk about being able
to change environment & rule in the section on updating groups.
Merge pull request #30 from aperiodic/nc-140-group-rules

(NC-140) Each group has a rule, each rule a group.