Django1.6 version of PG database definition manual Upgrade

Source: Internet
Author: User

Django1.7 added the migration feature later, the database-defined upgrade is fully automated, and was previously done through a "South" app. This article discusses the manual update upgrade under 1.6.

1, table create and table delete operation, fortunately Django even the old version, its table add Delete, its syncdb command can also be identified.

2, field Add and field remove these two operations have to manually come. The basic properties of the name, type, non-null are generally defined, because the Django model adds the primary key by default, so the troublesome definition of a sequence like a primary key field does not have to be a self-contained one, but a foreign key constraint, an index, or something that sometimes needs to be added manually. The name of the foreign KEY constraint and the name of the index are best referenced by the Django naming method to prevent naming conflicts within the database.

3, modify the primary key sequence, for table increment ID primary key to establish a separate sequence is the practice of PG database, this sequence can be modified, the most important modification I think may be the current maximum ID value, that is, the current value of the sequence, sometimes, like some configuration data modification, may need to modify this sequence.

Django1.6 version of PG database definition manual Upgrade

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.