'Overridden to ensure Foreign Keys use same column type as the primary
key they point to.'

def get_db_field(self):

    if (not isinstance(self.to_field, PrimaryKeyField)):
        return self.to_field.get_db_field()
    return super(ForeignKeyField, self).get_db_field()
