#26781: Bug with migrate appears if you try to change the db_table value ----------------------------+-------------------------------------- Reporter: laozzzi | Owner: nobody Type: Bug | Status: new Component: Migrations | Version: 1.9 Severity: Normal | Resolution: Keywords: migrate | Triage Stage: Unreviewed Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 ----------------------------+-------------------------------------- Description changed by laozzzi:
Old description: > 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" > > 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. New description: 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. -- -- Ticket URL: <https://code.djangoproject.com/ticket/26781#comment:2> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/065.7a026de4013264e95298bf29081e0716%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.