Skip to content
Discussion options

You must be logged in to vote

When you rename a model's db_table or change its schema, Peewee's create_table(safe=True) will only create the table if it does not already exist—it will not rename or update an existing table. If user_tenant_kb already exists in your database (even with a different schema), create_table will skip creation and log that the table exists. If the schema is outdated, you need to manually migrate (ALTER TABLE) or drop and recreate the table if possible.

Also, make sure your model is imported before init_database_tables runs, or it won't be detected for table creation. Check your logs for any errors during table creation—migration failures or unsynchronized schemas can also block creation, and…

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
1 reply
@guiweit
Comment options

Comment options

You must be logged in to vote
2 replies
@dosubot
Comment options

Answer selected by guiweit
@guiweit
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant