When you don't succeed with Django's migrate ....

Source: Internet
Author: User

url:http://my.oschina.net/u/862582/blog/355421

Because the operation of SQL database is not standardized, or when multiple people develop synchronization problems, it may lead to formal migrate can not be completed.

It is better to run after generating SQL directly than it has modified.

Remember the grammar ...

Python manage.py sqlmigrate app 0002_auto_20141212_1323 (SQL numbered file not executed)

~~~~~~~~~~~~~~

django>=1.7 Database Migration only three commands

Migrate, used to migrate the database.

Usage: Migrate App

Makemigrations, used to detect database changes and generate database migration files.

Usage: Makemigratioins app

Sqlmigrate, used to convert a database migration file into a database language (displays the SQL statements for a migratioin.)

Usage: Sqlmigrate app migration, such as makemigrations generated 0001_initial.py, just use Sqlmigrate app 0001_intial, here 0001_ Initial is the migration parameter.

Generally, if a migration uses sqlmigrate without prompting for errors, it can succeed at migrate.

When you don't succeed with Django's migrate ....

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.