Use JSONField with database proxy?
No, that's not really do-able, as each database tends to require it's own form of syntax and operations. You could try to apply a hook when the database proxy is initialized, which at that point would add the correct Json field to the model instance, I guess? Digging into `peewee` code, I came across https://github.com/coleifer/peewee/blob/master/peewee.py#L4904-L4928 which seems to have a different behavior depending on the database in use.

Wouldn't it be possible to somehow unify https://github.com/coleifer/peewee/blob/master/playhouse/sqlite_ext.py#L122-L194 and https://github.com/coleifer/peewee/blob/master/playhouse/postgres_ext.py#L294-L320 in a single `JSONField` class with a similar approach, with actual implementation depending on the database object?

Beyond the quick and dirty hack, I guess this would require either moving this code from Playhouse to Peewee core or making a super `*Database` class in Playhouse which would supercede the `*Database` classes from Peewee.


This is something I regularly need and the usual way to fix this is to create from scratch and naive `JSONField` (no knowledge of the JSON structure, just encoded/decoded from text field). If something generic as described above is achievable here in a robust way, I can definitely help write and test it.
Hi,

I see that Playhouse extensions have dedicated `JSONField` for each database implementation. However, I did not find an abstract `JSONField` which could be used in a database proxy scenario.

For instance, I am using something like:

```python
import peewee
from playhouse.db_url import connect

database_proxy = peewee.DatabaseProxy()
database_proxy.initialize(
    connect(os.environ.get('DATABASE', 'sqlite:///data.db'))
)

class BaseModel(Model):
    class Meta:
        database = database_proxy
    
    field = JSONField()  # <-- where JSONField is either the JSONField from sqlite_ext, postgres_ext or mysql_ext depending on the `connect` URI.
```

Is something like this achievable easily?

Thanks!
Best,