title: Entity Framework Code first making a column non-nullable
body: <p>I am using EF code first for my project. I have following code in my DataModel</p>
  
  <pre><code>[HiddenInput(DisplayValue = false)]        
  public DateTime? PasswordDate { get; set; }
  </code></pre>
  
  <p>To make this non-nullable I removed '?' and ran Add-Migration command from Package manager console. following migration file was generated.</p>
  
  <pre><code>  public partial class PasswordDate : DbMigration
  {
      public override void Up()
      {
          AlterColumn("dbo.CertificateInfoes", "PasswordDate", c =&gt; c.DateTime(nullable: false));
      }
  
      public override void Down()
      {
          AlterColumn("dbo.CertificateInfoes", "PasswordDate", c =&gt; c.DateTime());
      }
  }
  </code></pre>
  
  <p>But when I run Update-Database command:</p>
  
  <pre><code>Update-Database -SourceMigration 201309020721215_PasswordDate
  </code></pre>
  
  <p>I get following error: Cannot insert the value NULL into column 'PasswordDate', table ''; column does not allow nulls. UPDATE fails.
  The statement has been terminated.</p>
  
  <p>Kindly suggest the solutions.</p>