pythonmysqlormponyorm

"ALTER TABLE" to add a database column with Pony ORM


I try to update an SQL database using Pony ORM, but I didn't found how to ALTER an SQL table to add a column.

What i want to do is:

ALTER TABLE USER ADD COLUMN sex char(1);

Could someone help me?


Solution

  • You can use migration tool from orm-migrations branch. It is not officially released yet.

    Alternatively, if the database does not contains useful data yet, you can drop all tables and re-create them from scratch:

    db.drop_all_tables(with_all_data=True)
    db.create_tables()