Add titles and furls to sites

Sites can already have homepages which differ from their owning organisation's
homepage. Given that the furl attribute is simply a shorter form of the full
URL for a site, it follows that they have furls too.

We are currently inconsistent with how we apply the (new) homepage for a site.
  * If you look at the site in Transition, it says the new homepage is the one
    specified for that site in Redirector.
  * If you visit the old homepage, you get redirected to the site's new
    homepage, which is correct.
  * However, if you visit a page with an archive/unresolved mapping, it links
    to the organisation's new homepage, which is unhelpful or even
    inappropriate.

Therefore, we should change Bouncer's archive behaviour so that it links to the
site's new homepage. To make it consistent, we then need to make it use the
furl (if any) and a title which describes the site, rather than the
organisation. We need to make these changes to support that.
Shorten the "Successfully importing a large batch of mappings" feature

- This still keeps some of the old steps in `steps %{}` blocks within
  the new more readable and concise ones. Not sure if this is what
  Russell meant at all, but it still works.
Shorten the "Successfully importing a small batch of mappings" feature

- This makes what the behaviour is clearer than the implementation of
  said behaviour.
- This still keeps some of the old steps in `steps %{}` blocks within
  the new more readable and concise ones. Not sure if this is what
  Russell meant at all, but it still works.
Move a step only used in one feature into a feature helper
Merge pull request #358 from alphagov/readable_import_mappings_features

Improve readability of import mappings features
Merge pull request #353 from alphagov/add_titles_and_furls_to_sites

Add titles and furls to sites
Convert config/migrations to PostgreSQL

* Remove structure.sql, add schema.rb, configure appropriately
* Remove mySQL-specific option values from migrations
* Remove fix_collation_woes, as is all mySQL-specific
* Remove mysql2 gem in favour of pg
Explicit TNA timestamp conversion

* mySQL used to implicitly convert this
* We aren't in Kansas any more
Use correct type for http_status

* mySQL would handle this implicitly
* Postgres doesn't, thank $DEITY
Fix list ordering in host/mapping_controller specs

* Used to work by coincidence in mySQL
* We're only interested in the set, not the order
Site#default_host depends on host insert order

* Make that explicit, we got away with it in mySQL
Get everything failing for a reason

* Raise RuntimeErrors with suggestions so we can see what
  class of problem breaks what in specs
* Gives us something to fix. Ignoring features right now,
  concentrating on specs
Postgres: fix organisation sites scope

* Digit boolean becomes boolean literal
* Can't alias the COUNT in the HAVING
* ONE, ah ha ha
* TWO, ah ha ha
Fix hits update

* Add upsert support that was missing from the spike
Fix the import of DailyHitTotal

* Split upsert into two queries
* Be specific about the behaviour the specs are testing
Fix sort by hits

* Postgres requires NULLS LAST on an ORDER DESC, apparently
* We can get away with the GROUP BY primary key trick for the rest
Fix HitsMappingsRelations import

* Straight mySQL -> postgreSQL swap
* INSERT IGNORE simulation and ANSI update style
Fix lack of type conversions

* A couple of dynamic columns used for counts on model scopes
  (usually SUM(something) as attr_name) were coming back as strings
  see https://groups.google.com/forum/#!topic/ruby-pg/egzlYNi2OKk)
* Lay a method on top of the attribute to do the conversion on the fly
* Better suggestions welcomed!
Fix mappings from host paths

* We really need the GROUP BY, and the way we tell Postgres that
  the path is effectively represented by the hash is to use MIN
  as the aggregate. We can no longer use #pluck as this will affect the
  SELECTed field, but we can get the same behaviour by simple #map.
Fix hit scope groupings

* Fall back on MIN for path_hash, mapping_id and host_id when grouping hits