     public init(_ qualifiedType: String, properties:[MetaItem]){
 
         let schemaItems = properties.filter{$0 is SchemaItem}.map{ $0 as! SchemaItem}
+
         let relationshipList = properties.filter{$0 is Relationship}.map{ $0 as! Relationship }
         let nameParts = qualifiedType.unicodeScalars
                        .split{ $0 == "." }


        type = qualifiedType
        label = nameParts[1]
        table = Table(tableName, metadata: ORMModel.metadata, items: schemaItems)

        relationshipList.forEach{tmpRelationships[$0.label] = $0}

        table.sortedColumns.forEach{ value -> () in
            if value.foreignKey != nil{
                // foreign keys will have column names like:
                // `foo_id`, but the relationship will be something
                // like `foo` for selectRelated in the QuerySet,
                // so we strip off the _id
                let parts = value.label.unicodeScalars.split{ $0 == "_" }
                    .map(String.init)

                tmpForeignKeys[parts[0]] = value
            } else {
                tmpColumns.append(value)
                if value.primaryKey {
                    tmpPrimaryKey = value
                }
            }
        }


        relationships = tmpRelationships

        AmigoModel.amigoModelIndex[qualifiedType] = self
        table.model = self
    }

    public var hashValue: Int{
