Migrations

flock of migrating canada geese birds flying at sunset

Yes, migration! I would like some too! Who doesn’t love to travel?

PK Shiu has an amazing explanation of how South’s migration works here.

looking at my wagweb migrations, I realise:

from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
 # Adding model 'BlogPage'
 db.create_table(u'wagweb_blogpage', (
 (u'page_ptr', self.gf('django.db.models.fields.related.OneToOneField')(to=orm['wagtailcore.Page'], unique=True, primary_key=True)),
 ('body', self.gf('wagtail.wagtailcore.fields.RichTextField')()),
 ('date', self.gf('django.db.models.fields.DateField')()),
 ))
 db.send_create_signal(u'wagweb', ['BlogPage'])

 

There’s BlogPage. Probably why BlogPage is working fine. But where’s my BlogIndexPage?

okay, time to make them migrate that:

[~/website/wagtailweb]# ./manage.py schemamigration wagweb --auto
 + Added model wagweb.BlogIndexPageRelatedLink
 + Added model wagweb.BlogIndexPage
Created 0002_auto__add_blogindexpagerelatedlink__add_blogindexpage.py. You can now apply this migration with: ./manage.py migrate wagweb

Boom!

Following which I will follow instructions and migrate again:

Running migrations for wagweb:
 - Migrating forwards to 0002_auto__add_blogindexpagerelatedlink__add_blogindexpage.
 > wagweb:0002_auto__add_blogindexpagerelatedlink__add_blogindexpage
 - Loading initial data for wagweb.
Installed 0 object(s) from 0 fixture(s)

Andd………?

 

IT WORKS!

bimo

I swear BMO is shouting DJANGO in her heart.

 

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s