Ticket #312 (closed defect: fixed)

Opened 5 years ago

Last modified 2 years ago

South deletes table that has: managed = False

Reported by: astraforever@… Owned by: andrew
Priority: critical Milestone: 0.7
Component: commands Version: 0.6.2
Keywords: Cc:

Description

in class Meta for one of my models I have:
managed = False

when I run startmigration .. --auto and then migrate, south deletes the table of this model from the database!

Change History

comment:1 Changed 5 years ago by andrew

  • Status changed from new to assigned
  • Milestone set to 0.7

Did you use south to create the model, and _then_ add managed=False? That would look to South's internals like you'd removed the model, and so it would try to delete it.

comment:2 Changed 5 years ago by astraforever@…

No I didn't use south to create the model.
I used the sql script in the database to paste the table.

Besides south tries to delete this table with every next migration (with --auto), though it has already deleted it in previous migration.

comment:3 Changed 5 years ago by andrew

Alright, I'll see if I can replicate it.

comment:4 Changed 5 years ago by gvangool

Just my 2 cents, South also tries to create a Model which has managed = False .

comment:5 Changed 5 years ago by vasily.ivanov@…

same issue here

./manage.py convert_to_south creates db.create_table and db.delete_table statements for managed=False models

comment:6 Changed 5 years ago by andrew

  • Status changed from assigned to closed
  • Resolution set to fixed

Fixed in [516b011fe68c].

comment:7 Changed 3 years ago by vinuta@…

I am using South 0.7.3 but I still see this problem. If this is fixed how do I tell South to not use models with managed=False

comment:8 Changed 3 years ago by andrew

I would start by using the latest release, 0.7.4, and then if that doesn't work, open a new bug report containing a full traceback, your models file, and other code samples that might be needed.

comment:9 Changed 2 years ago by shai@…

I just reviewed the code, and it seems that while the problem is solved for adding/deleting tables, it is not solved for changing tables (which is the case where I've just run into it).

I'll try to provide a test and fix.

comment:10 follow-up: ↓ 11 Changed 2 years ago by shai@…

Fixed in [198275dac219].

comment:11 in reply to: ↑ 10 Changed 2 years ago by anonymous

Replying to shai@…:

Fixed in [198275dac219].

Has this change been put into a published version of South yet? If not, when might that happen.

comment:12 Changed 2 years ago by andrew

It's in 0.7.5.

Note: See TracTickets for help on using tickets.