3 ms·
> And with comments! Explaining why a certain index or constraint exist! You can put comments in Python files... > With constraints named meaningfully, availa
by kissgyorgy 6y ago
> And with comments! Explaining why a certain index or constraint exist!
You can put comments in Python files...
> With constraints named meaningfully, available for manipulation, not auth_group_permissions_group_id_b120cbf9_fk_auth_group_id.
You can name your migrations with:
manage.py makemigrations --name "prettier_name"
> In my opinion, if there is something less likely to happen than writing a complex app to run on interchangeable databases, it's the need to repeat the same history of migrations.
Maybe he never worked in a team? Or wrote any integration tests at all? Or implemented rollback? Because those are pretty much basic things for every serious project.
> I have a patch_db.py script that I have used, with small variations, in several projects.
So you are basically wrote your own schema migrations tool, but inconsistent across projects, and you maintain it yourself. Not a good idea IMO.
- dvarrazzo 6y ago> You can put comments in Python files... only if the comment pertains to a django feature, not to a schema feature that cannot be expressed in django (e.g. a partial index designed for a specific query). > You can name your migrations with: In the example there is a foreign key name, not a migration name. It is persisted in the database, it's not ephemeral like a migration name, for which choosing a meaningful name has only a temporary value. Just two factual corrections; for the rest our experiences diverge, that's fine.
- kissgyorgy 6y ago> for the rest our experiences diverge, that's fine. https://twitter.com/kissgyorgy/status/1291609448809627649 https://twitter.com/kissgyorgy/status/1291609448809627649