title: Strange Foreign Key constraint in fluent mapped SQLite
body: <p>I have a model written using FluentNhibernate and I am trying to create some test data in an in-memory SQLite database.</p>
  
  <pre><code>var fConfig =
                  Fluently.Configure()
                          .Database(config)
                          .Mappings(m =&gt; m.FluentMappings.AddFromAssembly(Assembly.GetAssembly(exampleClass))
                          .Conventions.Add(AutoImport.Never())
                          .Conventions.Add(new SQLiteGeometryTypeConvention())
                           .Conventions.Add(FluentNHibernate.Conventions.Helpers.DefaultLazy.Never()))
                          .ExposeConfiguration(cfg =&gt; configuration = cfg);
  </code></pre>
  
  <p>The problem I am getting is that one of the tables is created like this in the generated sql something like this :</p>
  
  <pre><code> create table myTable (
         myID  integer primary key autoincrement,
         ...{skip normal columns} 
         ForeignTable1ID INT,
         ParentID BIGINT,
         constraint FK1A2E045AFEC6908F foreign key (ForeignTable1ID) references ForeignTable1,
         constraint FK1A2E045ABB4EBD1F foreign key (ParentID) references Parent,
         constraint FKE21911CF6853D06E foreign key (myID) references Parent
  )
  </code></pre>
  
  <p>I don't want that third constraint but don't know what's causing it!
  The effect being that I can only create records in myTable which have valid foreign keys BUT ALSO have a myID value which exists in the Parent table. This is unnecessary, and I can't see what's causing it. </p>
  
  <p>The mapping file looks like this: </p>
  
  <pre><code>Table("dbo.PalslagInventering");
              Id(x =&gt; x.myId).Column("myID");
              References(x =&gt; x.ForeignTable1).Column("ForeignTable1ID");
              References(x =&gt; x.Parent).Column("ParentID");
  
              Map(x =&gt; x.{other columns here});
  
  HasMany(x =&gt; x.Child).KeyColumn("myID");
              HasOne(x =&gt; x.Child2).ForeignKey("MyID");
  
              HasMany(x =&gt; x.Child2).KeyColumn("MyID").ForeignKeyConstraintName("Child2");
              HasMany(x =&gt; x.Child3).KeyColumn("MyID").ForeignKeyConstraintName("Child3");
  </code></pre>
  
  <p>The parent table (being referenced) has a simple</p>
  
  <pre><code>public virtual IList&lt;MyTable&gt; myTableRecords { get; private set; }
  </code></pre>
  
  <p>Type of code mapped as:</p>
  
  <pre><code>HasMany(x =&gt; x.myTableRecords)
                  .KeyColumn("myID")
                  .Inverse();
  </code></pre>
  
  <p>What is causing the "foreign key" reference back to it's own myId?           </p>