Changes between Initial Version and Version 1 of Ticket #35813, comment 4


Ignore:
Timestamp:
Dec 20, 2024, 7:46:37 AM (42 hours ago)
Author:
Tim Graham

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #35813, comment 4

    initial v1  
    44A mismatch between your code and the database structure may result from this behavior, especially if the model is altered after the initial transfer.
    55
    6 Unmanaged Model:
    76Consider you have two models in Django: one is unmanaged and the other is managed.
     7{{{#!python
    88class UnmanagedThing(models.Model):
    99    id = models.IntegerField(db_column="thingID", primary_key=True)
     
    1616        db_table = "some_table_name"
    1717
    18 Managemed Model
     18
    1919class ManagedThing(models.Model):
    2020    id = models.IntegerField(db_column="thingID", primary_key=True)
     
    2525    class Meta:
    2626        managed = True  # This tells Django to manage the table's structure.
    27 
     27}}}
    2828Anticipated Conduct: First Migration: Django creates a migration file that records the construction of the managed and unmanaged models when you execute makemigrations for the first time.
    2929Modifications to the Managed Model: Django recognizes when you change the thing_name in the managed model from a CharField to an IntegerField and generates a migration that takes into account the field change.
Back to Top