title: Changing data type of a model property without affecting data
body: <p>We are using Code First approach in one of our ASP.NET MVC Core app. We have a table with lots of data in it and we want to change the data type of one of its column from <code>string</code> to <code>int</code>.</p>
  <p>The column is storing only two integers, being &quot;1&quot; and &quot;2&quot;. How will we do it using Package Manager console command (or something like that) without affecting the data.</p>
  <p>So, in the following model we need to change <code>OrderType</code> from <code>string</code> to <code>int</code> without affecting existing data in the SQL Server database:</p>
  <pre><code>public class Order
  {
      public int OrderId { set; get; }
      public string OrderType { set; get; }
      public int OrderYear { set; get; }
      public string OrderLoc { set; get; }
      ...
      ...
  }
  </code></pre>
  <p><strong>UPDATE</strong></p>
  <p>We're using VS2015 with latest updates. Following may be a better explanation of our question:</p>
  <p>In ASP.NET Core - Code First model sometimes you can make certain changes to a model and run a migration command to keep the changes in sync with the database that was originally created using Code First approach. I'm looking for such a migration command so if data type of a model property is changed to a compatible type the existing data in the corresponding column in the database table remains intact. Please note that in our case since column <code>OrdererType</code> is holding values 1 and 2 as string the existing data type <code>string</code> is compatible to data type <code>int</code>.</p>