pankrat / pankrat.github.io Goto Github PK
View Code? Open in Web Editor NEWStatic pages
Static pages
Nice article on django migrations!
A missing major item is adding foreign key constraints. Adding them on a large table can cause havoc on both the base and foreign table. It'd be great to add a section about this to your post.
Awesome django migrations article !
But I have a quesiton . In "Add the default to the database schema" section , Why you said " Adding a default to an existing column also doesn’t require an expensive table rewrite. "
When Postgres exec ALTER TABLE users ALTER COLUMN blocked SET DEFAULT false
, will It not traverse the whole table ?
Hello @Pankrat, I wanted to reach out to let you know that you might be interested in https://github.com/charettes/django-syzygy which implements the last missing point on your Django wishlish from your 2015 posts.
I've been actively contributing to Django's migration framework over the years and plan on trying to eventually get the concept of pre and post deployment migrations into core once I received appropriate feedback on the idea.
I know it's been a while but I figured you might be interested in learning about the development on the topic.
Hi,
Thanks for sharing this blog post. I just wanted to point out one issue. In the post, you state
As Django migrations are idempotent
This statement is misleading and not accurate. It's fair to say that under certain happy path conditions Django's migration commands are idempotent, but the migrations themselves are not. For example, you cannot re-run a specific migration that creates a table because the compiled SQL code uses CREATE TABLE
. If the migration itself were idempotent, it would use CREATE TABLE IF NOT EXISTS
and so on.
Moreover, Django migrations are stateful (state is tracked in thedjango_migrations
table) and IMO statelessness is an important property of an idempotent system.
Thanks,
Michael
Keep it up!
https://docs.djangoproject.com/en/1.11/howto/writing-migrations/#non-atomic-migrations
On databases that support DDL transactions (SQLite and PostgreSQL), migrations will run inside a transaction by default. For use cases such as performing data migrations on large tables, you may want to prevent a migration from running in a transaction by setting the atomic attribute to False:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.