[Fixed]-Django won't create a table for one model of many in an app

1πŸ‘

βœ…

It seems as though the store table was dropped from the database and migrations cannot figure out how to add it back. You could always recreate the table in dbshell:

sqlite> .tables
auth_group                   django_migrations         
auth_group_permissions       django_session            
auth_permission              products_building            
auth_user                    products_category            
auth_user_groups             products_product             
auth_user_user_permissions   products_product_categories  
django_admin_log             products_variant             
django_content_type

sqlite> PRAGMA foreign_key s=OFF;
sqlite> BEGIN TRANSACTION;
sqlite> CREATE TABLE "products_store" ("id" integer NOT NULL PRIMARY KEY   AUTOINCREMENT, "name" varchar(120) NOT NULL, "description" text NULL);
sqlite> COMMIT;

sqlite> .tables
auth_group                  django_migrations         
auth_group_permissions      django_session            
auth_permission             products_building            
auth_user                   products_category            
auth_user_groups            products_product             
auth_user_user_permissions  products_product_categories  
django_admin_log            products_store               
django_content_type         products_variant 
πŸ‘€ChrisFreeman

Leave a comment