Djangosaur
SQL update for your django models, old school style

Let’s say you have added a new field to the profile model.

Use sqlall <app> to generate the SQL.

./manage.py sqlall profile
BEGIN;
CREATE TABLE `profile` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `user_id` integer NOT NULL UNIQUE,
    `new_field` integer UNSIGNED NOT NULL
)
;
ALTER TABLE `profile` ADD CONSTRAINT `user_id_refs_id_59efa1d8` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`);
COMMIT;

Using the output on line number 5, we fall back to SQL and edit the ALTER TABLE command to update the table model.

./manage.py dbshell
ALTER TABLE `profile` ADD
`new_field` integer UNSIGNED NOT NULL;

With django_extensions

If you have installed django_extensions, it is event easier.

./manage.py sqldiff profile
BEGIN;
-- Application: profile
-- Model: UserProfile
ALTER TABLE `profile`
	ADD `new_field` integer UNSIGNED;
COMMIT;