title: What's the difference/relationship between CreateIndex and HasIndex
body: <p>I can't seem to find any documentation on this, at least not on docs.microsoft, although I've Googled enough to no avail.</p>
  
  <p>I'm seeing the following two pieces of code below:</p>
  
  <pre><code>// In a migration Up
  migrationBuilder.CreateIndex
                   (
                     name: "IX_UserQualificationEndorsement_UserId_QualificationId_InstitutionId",
                     table: "UserQualificationEndorsement",
                     columns: new[] { "UserId", "QualificationId", "InstitutionId" },
                     unique: true
                   );
  
  // In DbContext.OnModelCreating
  modelBuilder.Entity&lt;UserQualificationEndorsement&gt;()
              .HasIndex
              (
                 userQualificationEndorsement =&gt; new
                 {
                   userQualificationEndorsement.UserId,
                   userQualificationEndorsement. QualificationId,
                   userQualificationEndorsement. InstitutionId
                 }
              )
              .IsUnique();
  </code></pre>
  
  <p><br/>
  <strong>Suspicion:</strong> My knowledge of Fluent API is not that great, but as far as I can tell, <code>HasIndex</code> is used to automatically scaffold <code>CreateIndex</code> instructions in the next migration that's added.</p>
  
  <p><strong>Question:</strong> Is my suspicion above correct and if so, does <code>HasIndex</code> serve any other purpose?</p>