b6194f08

By: Tom Sydney Kerckhove <syd@cs-syd.eu>

sqitch-postgres: deploy migrations into a random non-public schema

The harness deployed (and snapshotted) migrations in the public schema, so a
migration that hardcodes a schema in an information_schema lookup -- a deploy
guard or verify with table_schema = 'public' -- passed unnoticed even though
it silently misbehaves (a skipped ALTER, a verify that finds nothing) when
deployed into a non-default schema.

Deploy into a fresh, randomly-named non-public schema instead, created and
dropped (CASCADE) via a SetupFunc so tests leave nothing behind. sqitch
connections are scoped to it via PGOPTIONS search_path; pooled actions via
useTestSchema; and the schema snapshots now follow current_schema(). A
migration that hardcodes a schema now fails the existing deploy --verify
checks (a new toy-sqitch-hardcoded-public negative fixture exercises this).

New API: randomSchemaSetupFunc (generates the name and supplies it),
schemaSetupFunc (takes a name; for sharing one schema across two databases),
randomSchemaName, useTestSchema. Breaking: sqitchTargetFromOptions now takes
the schema as its first argument. Both packages -> 0.1.0.0.

Suite timing

Time to Start Worker time Duration Time to finish Idle
Config 0s 8s 8s 8s 0s
Eval 8s 2m27s 2m27s 2m36s 0s
Build 1m55s 2m33s 2m16s 4m11s 0s
Suite 0s 5m09s 4m11s 4m11s 0s

Timeline

0s20s40s1m1m20s1m40s2m2m20s2m40s3m3m20s3m40s4m