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 3s 3s 3s 0s
Eval 3s 1m56s 1m56s 1m59s 0s
Build 1m15s 2m52s 2m40s 3m55s 5s
Suite 0s 4m52s 3m55s 3m55s 5s

Timeline

0s20s40s1m1m20s1m40s2m20s2m40s3m3m20s3m40s