| 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 |
| 362 | getting 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 | |
| 364 | We 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 | |
| 368 | Correct, 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 | |
| 372 | The biggest missing piece I believe to be changing column types. For instance, say you currently have: |
| 373 | |
| 374 | {{{ |
| 375 | ssn = models.IntegerField() |
| 376 | }}} |
| 377 | |
| 378 | Which you want to change into: |
| 379 | |
| 380 | {{{ |
| 381 | ssn = models.CharField(maxlength=12) |
| 382 | }}} |
| 383 | |
| 384 | Schema 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 | |