Opened 5 years ago

Closed 3 years ago

Last modified 18 months ago

#14305 closed New feature (fixed)

inspectdb should output unmanaged model definitions

Reported by: ikelly Owned by: nobody
Component: Core (Management commands) Version: master
Severity: Normal Keywords: inspectdb unmanaged
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: yes
Needs tests: yes Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I'm a little surprised that this hasn't been brought up before, but I couldn't find any existing tickets or discussion.

inspectdb should automatically set managed = False on the model definitions it creates. Since these are preexisting tables, the user almost certainly does not want Django attempting to drop them when a reset is run.

Attachments (1)

inspectdb-unmanaged.diff (439 bytes) - added by ikelly 5 years ago.

Download all attachments as: .zip

Change History (11)

Changed 5 years ago by ikelly

comment:1 Changed 5 years ago by ramiro

  • Has patch set
  • Needs documentation set
  • Needs tests set
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

Accepting on the basis this could mean user data is at risk and it is better to go with the safe choice. The additional work for the developer to remove the managed=False line would serve as an explicit opt in about allowing Django to handle the table.

Last edited 3 years ago by ramiro (previous) (diff)

comment:2 Changed 4 years ago by gabrielhurley

  • Component changed from django-admin.py inspectdb to Core (Management commands)

comment:3 Changed 4 years ago by julien

  • Severity set to Normal
  • Type set to New feature

comment:4 Changed 4 years ago by jacob

  • milestone 1.3 deleted

Milestone 1.3 deleted

comment:11 Changed 4 years ago by aaugustin

  • UI/UX unset

Change UI/UX from NULL to False.

comment:12 Changed 4 years ago by aaugustin

  • Easy pickings unset

Change Easy pickings from NULL to False.

comment:13 Changed 3 years ago by Ramiro Morales <cramm0@…>

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

In 08dc90bccf7c4ffa8b04064d74b54c1150af5ff9:

Fixed #14305 -- Switched inspectdb to create unmanaged models.

Thanks Ian Kelly for the report and initial patch.

comment:14 Changed 18 months ago by Tim Graham <timograham@…>

In 9b7ba8af1b4ddb539cd69cbec9645cd873db7624:

Fixed #22322 -- Fixed incorrect explanation of what managed=False does.

refs #14305.

Thanks Adrian Klaver for the report.

comment:15 Changed 18 months ago by Tim Graham <timograham@…>

In c0a9c2f72ac289b2ba8313c6a2c56be5ed94f01d:

[1.6.x] Fixed #22322 -- Fixed incorrect explanation of what managed=False does.

refs #14305.

Thanks Adrian Klaver for the report.

Backport of 9b7ba8af1b4ddb539cd69cbec9645cd873db7624 from master

comment:16 Changed 18 months ago by Tim Graham <timograham@…>

In 7eaf329ad38ff7ea6b47f1b0a3c20ca7a5ad079b:

[1.7.x] Fixed #22322 -- Fixed incorrect explanation of what managed=False does.

refs #14305.

Thanks Adrian Klaver for the report.

Backport of 9b7ba8af1b from master

Note: See TracTickets for help on using tickets.
Back to Top