Upgrade to Pro — share decks privately, control downloads, hide ads and more …

South: Migrations for Django

South: Migrations for Django

The very first public presentation of South, at the Schema Evolution panel at DjangoCon 2008. Video at https://www.youtube.com/watch?v=VSq8m00p1FM

Andrew Godwin

September 07, 2008
Tweet

More Decks by Andrew Godwin

Other Decks in Programming

Transcript

  1. south migrations for django Why? 1. Migrations are essential. 2.

    Branched development/ missing migrations 3. Inter-app dependencies 4. Database abstraction needed too!
  2. south migrations for django syncdb dropdb syncdb time create initial

    models add new fields create create create syncdb create create create
  3. south migrations for django syncdb dropdb syncdb time create initial

    models add new fields create create create syncdb create create create south createmigration --initial migrate create create create write new migration migrate alter alter alter
  4. south migrations for django database independence class Migration: def forwards(self):

    # Model 'Category' db.create_table('aeblog_category', ( ('id', models.AutoField( verbose_name='ID', primary_key=True, auto_created=True, )), ('title', models.CharField(max_length=255)), ('slug', models.SlugField()) ))
  5. south migrations for django missing migrations 001_foo 002_bar 003_baz 004_phou

    001_foo 002_bar 003_baz 001_foo 002_bar 003_baz 004_phou 001_foo 002_bar 003_baz 004_fizz 001_foo 002_bar 003_baz 004_fizz 001_foo 002_bar 003_baz > > > > >
  6. south migrations for django missing migrations 004_phou 001_foo 002_bar 003_baz

    004_fizz 001_foo 002_bar 003_baz > 004_fizz 001_foo 002_bar 003_baz 004_phou > south: problem detected, --merge fixes it global number (e.g. rails): problem never found
  7. south migrations for django dependencies 001_forum 002_post 003_add_date have to

    migrate in correct order 004_pictures 001_initial 002_add_code 003_pictures
  8. south migrations for django dependencies 001_forum 002_post 003_add_date have to

    migrate in correct order 004_pictures 001_initial 002_add_code 003_pictures 1 2 3 4 5 6 7