title: Index of same name in two different domains
body: <p>I have two domain <code>Favorite</code> and <code>Post</code> and want to add <code>index</code> on these two domain. Following is the way I am dong this:</p>
  
  <pre><code>class Favorite {
      String name
      static mapping = {
          name column: 'name', index: 'name'
      }
  }
  </code></pre>
  
  <p>and </p>
  
  <pre><code>class Post {
      String name
      Integer nbrOfFavorites
      static mapping = {
          name column: 'name', index: 'name'
      }
  }
  </code></pre>
  
  <p>And when running the application I am getting following error in console:</p>
  
  <pre><code>ERROR hbm2ddl.SchemaExport - HHH000389: Unsuccessful: create index name on post (name)
  ERROR hbm2ddl.SchemaExport - Index "NAME" already exists; SQL statement: create index name on post (name) [42111-176]
  </code></pre>
  
  <p>This code is crating index successfully for first domain (Favorite) but not for second domain (Post). </p>
  
  <p>I searched for this and <a href="https://stackoverflow.com/questions/7352055/same-index-name-for-two-tables">as per this post</a> we can have same index name for different tables. <strong>Then why I am getting this error?</strong></p>
  
  <p><strong>How can I create index of same name in different domains?</strong></p>
  
  <ul>
  <li>Grails version: 2.3.9 (also tried with v2.4.4)</li>
  <li>Database: H2</li>
  </ul>
  
  <p>Ref# <a href="http://grails.org/doc/latest/guide/GORM.html#databaseIndices" rel="nofollow noreferrer">Database Indices</a></p>