Changes between Version 1 and Version 2 of SchemaEvolutionDocumentation


Ignore:
Timestamp:
Jul 31, 2007, 12:02:04 PM (17 years ago)
Author:
public@…
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • SchemaEvolutionDocumentation

    v1 v2  
    357357}}}
    358358
     359== Criticisms ==
     360
     361''I _really_ don't like the aka representations in the model. The models file should always be a clean statement of the current state of the model. Migration is about
     362getting an old database to match the currently required models - if I don't have a legacy database, I don't really want the cruft hanging around in my models. Migration plans or historical models really should be kept out of the core model file, IMHO.''
     363
     364We currently store all sorts of non-DB related metadata in the model that arguably should not be there, including presentation information.  We do this for clarity and convenience - you would have to duplicate a lot of information otherwise in multiple locations without any obvious direct connection.  So which paradigm is more critical here, DRY or MVC?  Or do we continue with the status-quo of a common-sense balance?  As far as cruft, if you don't have a legacy database, you wouldn't have any aka fields to begin with.  And as you phase out legacy support, simply delete them.
     365
     366''Unless I'm missing something, the aka approach doesn't track exactly which name versions correlate with other versions. Consider; your aka chain for one field could indicate a rename from 'foo' to 'bar' to 'foo' to 'bar'; a second field could indicate renames from 'whiz' to 'foo' to 'whiz', etc. A tuple of historical names doesn't tell me which sets of names were in use concurrently; so if I find a database with a field called 'foo' which requires migration, is 'foo' the first field or the second?''
     367
     368Correct, however I thought this to be a highly unlikely scenario, not warranting the extra notational complexity.  But just as we support strings and tuples, there is nothing to say we can extend it to support say a mapping of historical names to date ranges, if the need arises.
     369
     370== Future Work ==
     371
     372The biggest missing piece I believe to be changing column types.  For instance, say you currently have:
     373
     374{{{
     375    ssn = models.IntegerField()
     376}}}
     377
     378Which you want to change into:
     379
     380{{{
     381    ssn = models.CharField(maxlength=12)
     382}}}
     383
     384Schema evolution should generate SQL to add the new column, push the data from the old to the new column, then delete the old column.  Warnings should be provided for completely incompatible types or other loss-of-information scenarios.
     385
    359386== Conclusion ==
    360387
Back to Top