pwiz generates non-auto_increment primary key field as AutoField
I gather you're using MySQL.

For what it's worth, the first example where `user_id` is `AutoField` -- the `info.user_id` stored in the database is still "10" in both cases. The reason "0" gets assigned, however, is because Peewee thinks this is an auto-increment integer field. So it is trying to read the new pk value from the cursor -- and since this is *not* actually an autoincrement field, this is returned as 0.

You can verify that the correct value is still stored in either case, however:

```python
###
### Here UserInfo.user_id is an AutoField() instance.
###

In [2]: u = UserInfo.create(user_id=10, name='bar')                                                      

In [3]: UserInfo.get().user_id                                                                           
Out[3]: 10

In [4]: u.user_id                                                                                        
Out[4]: 0
```

In this case, you should probably go back through the auto-generated code and change the `AutoField()` to `IntegerField(primary_key=True)` where applicable. You can see #2124 for some additional discussion. > You can see #2124 for some additional discussion.

Thanks.
I use pwiz to generate model codes, and I got `AutoField` rather than `IntegerField(primaty_key=True)` when the primary key field is not auto_increment, this will cause different results.
for example:
```py
"""
create table user_info (
  user_id int unsigned not null,
  name varchar(20) not null,
  primary key (user_id)
);
"""

class UserInfo(BaseModel):
  user_id = AutoField()
  name = CharField()

info = UserInfo.create(user_id=10, name='xxx')
print(info.user_id)  # 0

# result is different while using IntegerField

class UserInfo(BaseModel):
  user_id = IntegerField(primary_key=True)
  name = CharField()

info = UserInfo.create(user_id=10, name='xxx')
print(info.user_id)  # 10
```