Reputation: 373
class Hero(SQLModel, table=True):
id: int = Field(primary_key=True)
name: str
age: int = Field(default=None)
status:str
I created the table using SQLModel.metadata.create_all(engine)
, when I changed the type of status to str
and run the create_all()
method again the type of status did not change in the database. Is there any way to migrate the database like Django or flask-migrate?
Upvotes: 9
Views: 4014
Reputation: 1035
The fastest way is to drop the table manually and reload the app.
But if you want a more automated and reliable solution check the following link:
https://github.com/tiangolo/sqlmodel/issues/85
Upvotes: 2