Hardcoded things in migrations

Could you tell me why Django hardcodes the business logic into migrations?

We can formulate the question the other way. Let's have a look at valitadors and upload_to. These all is hardcoded into migrations.

But if we show SQL that a migration produces, no validators or upload_to will be there.

So, why are they hardcoded? Validators and upload_to are already mentioned in models. DRY principle is violated.

Any change in the code ruins migrations. For example renaming of upload_to will result in the project's blowing up.

Validators and upload_to are just examples. There are more things of the kind. Anyway, they don't influence the database. So, why do we need them in migrations?

Could you comment?

Back to Top