   func columnNameForAttribute(_ attr: Attribute) -> String {
     // could also do a translation when missing
     return attr.columnName ?? attr.name
-  }
-  
-  fileprivate func contraintKeyForRelationship(_ rs: Relationship) -> String? {
-    guard !rs.joins.isEmpty else { return nil }
-
-    func keyForJoin(_ join: Join) -> String {
-      return (join.sourceName ?? "_") + "=>" + (join.destinationName ?? "_")
-    }
-    
-    if rs.joins.count == 1 { return keyForJoin(rs.joins[0]) }
-    
-    let sortedJoins = rs.joins.map(keyForJoin).sorted()
-    return sortedJoins.joined(separator: ",")
   }
   
   func createTableStatementsForEntityGroup(_ entities: [ Entity ],

    sb += expr.statement
  }
  
  func extractEntityGroups<T: Sequence>(_ entities: T) -> [ [ Entity ] ]
                           where T.Iterator.Element == Entity
  {
    var nameToIndex  = [ String : Int ]()
    var entityGroups = [ [ Entity ] ]()
    
    for entity in entities {
      if let key = entity.externalName, !key.isEmpty {
        if let idx = nameToIndex[key] {
          entityGroups[idx].append(entity)
        }
        else {
          nameToIndex[key] = entityGroups.count
          entityGroups.append([ entity ])
        }
      }
      else {
        entityGroups.append([ entity ])
      }
    }
    
    return entityGroups
  }
  
  func schemaCreationStatementsForEntities(_ entities: [ Entity ],
                                           options: SchemaGenerationOptions)
       -> [ SQLExpression ]

    var statements = [ SQLExpression ]()
    statements.reserveCapacity(entities.count * 2)
    
    let entityGroups = entities.extractEntityGroups()
    
    if options.dropTables {
      for group in entityGroups {
