title: Entity Framework migration and product versioning
body: <p><strong>Scenario:</strong></p>
  
  <p>I'm using EF6 with one of our software product (network base web application) and we've different versions of products installed on customer machines. All customers have support period of x months so they are running on different versions of product and their respective databases are on different EF migrations.</p>
  
  <p>I have a few other colleagues helping me with support of the product and they regularly deal with support phone calls from customer for different versions of product.</p>
  
  <p><strong>Problem:</strong></p>
  
  <p>Product only supports upgrading EF database and downgrading is not supported due to data loss concerns. So when we need to support an older version we use an internal tool to up/down-grade EF database. Problem is my colleagues are not aware about which database migration goes with what version of our product.</p>
  
  <p>So my question: is there a way to attach our product version to migration history row?</p>
  
  <p>What I've considered so far:</p>
  
  <ol>
  <li><p>Embed product version in the name of the migration.</p>
  
  <p>This is doable but I need to train other devs to make sure to include product version in the migration.</p></li>
  <li><p>Create an empty migration with each major release of the product.</p>
  
  <p>This one has the same issue as approach 1. I can automate this into the product release script but that involves too much effort and not to mention possible issues.</p></li>
  </ol>
  
  <p><strong>What I want:</strong></p>
  
  <p>I'm planing to attach product version with migration itself. Meaning, I want to add a new column to the <code>MigrationHistory</code> table which will hold this information (will be deriving my new class from <code>HistoryRow</code>).</p>
  
  <p>What I'm not sure about is, how to intercept database migration template so that I can embed product version (assembly version) to the migration and I don't have to remember to do it manually.</p>
  
  <p>I'm sure one of you must have feel this pain and possibly there is a better solution out there. Any ideas/suggestions?</p>