In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains the causes and solutions of errors in Django database migration, which interested friends may wish to have a look at. The method introduced in this paper is simple, fast and practical. Next, let the editor take you to learn the causes and solutions of errors in Django database migration.
Django performs database migration
Cause: because the migration file is inconsistent with the migration record in the database
Workaround python manage.py migrate app name-the fake migration file name marks the specified migration file as mapped, and the Sql statement for the migration file will not be executed.
If you don't know which migration file has the problem, you can delete all the migration files under the app, then delete all the migration files of the app in the migration file table django_migrations in the database, and then use python manage.py makemigrations app_name to generate a migration file after clearly mapping the fields and classes of the table. Then use python manage.py migrate-- fake-initial to save the migration file of the first table to the database.
Generate the model according to the database
Make python manage.py inspectdb > file path
Needs to be corrected.
The name may be too long, or it may be related to the key word.
The model needs to be put into the relevant app
Tables connected by foreign keys need to be adjusted
Execute marking command
At this point, I believe that everyone on the "Django database migration error causes and solutions" have a deeper understanding, might as well to the actual operation of it! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.