Opened 9 years ago
Last modified 8 years ago
#26781 closed Bug
Bug with migrate appears if you try to change the db_table value — at Version 2
Reported by: | lao zzzi | Owned by: | nobody |
---|---|---|---|
Component: | Migrations | Version: | dev |
Severity: | Normal | Keywords: | migrate sqlite case |
Cc: | Shai Berger | Triage Stage: | Ready for checkin |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
Problem appears after renaming db_table, if you try to rename, for example "Article" to "article" or "Blog" to "blog" or to "bLoG", etc. and migrate this changes to database
Example:
Step 1. Create model:
class Article (models.Model): class Meta(): db_table="Article" title = models.CharField(max_length=200) body = models.TextField() date_cr = models.DateTimeField()
Step 2. make migrations & migrate
Step 3. change the value of db_table from "Article" to "article"
class Article (models.Model): class Meta(): db_table="article" title = models.CharField(max_length=200) body = models.TextField() date_cr = models.DateTimeField()
Step 4. make migrations
Step 5. migrate -- here you'll see errors
.....
django.db.utils.OperationalError: there is already another table or index with this name: article
This error appears any time later, if you try to do something with model and use migrate. Even if you delete the Article model and start "make migrations & migrate" you'll see such error.
Change History (2)
comment:1 by , 9 years ago
Description: | modified (diff) |
---|
comment:2 by , 9 years ago
Description: | modified (diff) |
---|