title: How to change index from primary key to another unique column?
body: <p>Here is the domain:</p>
  
  <pre><code>public class Citation
  {
      public Guid Id { get; set; }
      public string CitationNumber { get; set; }
      public DateTime CitationDate { get; set; }
      public decimal Amount { get; set; }
  }
  </code></pre>
  
  <p>and the Fluent API:</p>
  
  <pre><code>ToTable("Citations");
  HasKey(c =&gt; c.Id);
  
  Property(c =&gt; c.Id)
      .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);
  
  Property(c =&gt; c.CitationNumber)
      .HasMaxLength(8)
      .IsRequired();
  
  Property(c =&gt; c.CitationDate)
      .IsRequired();
  
  Property(c =&gt; c.CitationAmount)
      .HasColumnType("Money")
      .IsRequired();
  </code></pre>
  
  <p>By default, an index is added upon the Guid field <code>Id</code>. To improve the performance, I would like to move the index unto <code>CitationNumber</code>, which is also a unique value field.</p>
  
  <p>So the SQL Script should be like:</p>
  
  <pre><code>ALTER TABLE dbo.Citations
  DROP CONSTRAINT [PK_dbo.Citations]
  GO
  
  ALTER TABLE dbo.Citations ADD CONSTRAINT
      [PK_dbo.Citations] PRIMARY KEY NONCLUSTERED (Id)
  
  ALTER TABLE dbo.Citations ADD CONSTRAINT
  IX_Citations_CitationNumber UNIQUE CLUSTERED (CitationNumber DESC)
  </code></pre>
  
  <p>I can add index on <code>CitationNumber</code>:</p>
  
  <pre><code>var indexAttr = new IndexAttribute("IX_Citations_CitationNumber")
      {
      IsClustered = true,
      IsUnique = true,
      Order = 1
      };
  
  Property(c =&gt; c.CitationNumber)
      .HasColumnAnnotation("Index", new IndexAnnotation(indexAttr))
  </code></pre>
  
  <p>But how can I remove the constraint on <code>Id</code>? Is it possible?</p>