01-objects.sql (1378B)
1 BEGIN; 2 -- load pgtap - change next line to point to correct path for your system! 3 \i t/00-load.sql.inc 4 5 SELECT plan(10); 6 7 SELECT has_schema( '_v', 'There should be schema _v for versioning to work.' ); 8 SELECT has_table( '_v', 'patches', 'There should be _v.patches table for versioning to work.' ); 9 10 SELECT has_column( '_v', 'patches', 'patch_name', '_v.patches should have patch_name column.' ); 11 SELECT has_column( '_v', 'patches', 'applied_tsz', '_v.patches should have applied_tsz column.' ); 12 SELECT has_column( '_v', 'patches', 'applied_by', '_v.patches should have applied_by column.' ); 13 SELECT has_column( '_v', 'patches', 'requires', '_v.patches should have requires column.' ); 14 SELECT has_column( '_v', 'patches', 'conflicts', '_v.patches should have conflicts column.' ); 15 16 SELECT has_function( '_v', 'register_patch', ARRAY[ 'text', 'text[]', 'text[]' ], 'register_patch(text, text[], text[]) should exist to be able to register patches' ); 17 SELECT has_function( '_v', 'unregister_patch', ARRAY[ 'text' ], 'unregister_patch(text) should exist to be able to unregister patches that are no longer needed' ); 18 19 SELECT is( ( SELECT count(*) FROM _v.patches ), 0::bigint, 'When running tests _v.patches table should be empty to prevent bad interactions between patches and tests.' ); 20 SELECT * FROM finish(); 21 22 ROLLBACK; 23