title: How to implement schema migration for PostgreSQL database
body: <p>I need to implement schema migration mechanism for PostgreSQL. 
  Just to remove ambiguity: with schema-migration I mean that I need upgrade my database structures to the latest version regardless of their current state on particular server instance. </p>
  
  <p>For example in version one I created some tables, then in version two I renamed some columns and in version three I removed one table and created another one. I have multiple servers and on some of them I have version one on some version three etc.</p>
  
  <p>My idea:</p>
  
  <ul>
  <li>Generate hash for output produced by </li>
  </ul>
  
  <blockquote>
    <p>pg_dump --schema-only</p>
  </blockquote>
  
  <p>every time before I change my database schema. This will be a reliable way to identify database version in the future to which the patch should apply.</p>
  
  <ul>
  <li>Contain a list of patches with the associated hashed to which they should apply.</li>
  <li>When I need to upgrade my database I will run an application that will search for hash that corresponds to current database structure (by calculating hash of local database and comparing it with hash set that I have) and apply associated patch.</li>
  <li>Repeat until next hash is not found.</li>
  </ul>
  
  <p>Could you please point any weak sides of this approach?</p>