'Peewee How to change order of fields which are declared in a BaseModel?

In my BaseModel I like to add creation_date and last_updated_date so I don't have to type it on every model:

class BaseModel(Model):
    creation_date = DateTimeField(default=datetime.now)
    last_updated_date = DateTimeField(default=datetime.now)

    class Meta:
        database = db

class User(BaseModel):
    email = CharField(max_length=64)

db.create_tables([User])

The problem with this is that it will create the table with the creation_date/last_updated_date columns first.

create table user(id serial, creation_date timestamp, last_updated_date timestamp, email varchar2(64));

This becomes a minor inconvenience when you use psql or an IDE to query your data. I prefer the non-ID metadata to be on the right most side of the screen, not the left.

Is there anyway to override this behavior such that I can have the creation_date/last_updated_date columns created last?

create table user(id serial, email varchar2(64), creation_date timestamp, last_updated_date timestamp);


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source