title: OrchardCMS - Adding a column to table using Migrations.cs
body: <p>I'm still fairly new to OrchardCMS development and I was able to create a table and a few columns using the Migrations.cs file. Shortly after the new table and columns were created, it dawned on me that I actually needed a couple more columns added to the same table.</p>
  
  <p>For my initial Migrations.cs, I have something similar to below (irrelevant parts of code not shown for brevity):</p>
  
  <pre><code>// some code above
  SchemaBuilder.CreateTable("ProductPartRecord", table =&gt; table
      .ContentPartRecord()
      .Column&lt;decimal&gt;("UnitPrice")
      .Column&lt;string&gt;("Sku", column =&gt; column.WithLength(50))
      );
  return 1;
  // some code below
  </code></pre>
  
  <p>To add additional column(s), I would need to create a class as follows based on my limited knowledge:</p>
  
  <pre><code>public int UpdateFrom1()
  {
      SchemaBuilder.AlterTable("ProductPartRecord", table =&gt; table
          .AddColumn&lt;string&gt;("UnitColor", c =&gt; c.Nullable())
      );
      return 2;
  }
  </code></pre>
  
  <p>But, here comes the question: Why couldn't I simply modify the initial <code>CreateTable</code> method by inserting something like: <code>.Column&lt;string&gt;("UnitColor")</code> instead of creating the <code>UpdateFrom1()</code> class? </p>
  
  <p>Furthermore, let's say the software requirement changes later and now I need to add yet another column to the same table. Would I then create yet another class? (e.g., UpdateFrom2() and so on...) Seems rather odd and I'd like to think there's a better/clever way but maybe it's just a Orchard thing.</p>
  
  <p>Thanks in advance for any tips/advice!</p>