Skip to content
This repository has been archived by the owner on Aug 26, 2022. It is now read-only.

Commit

Permalink
Convert django-taggit to be covered by South migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
lmorchard committed May 27, 2011
1 parent cf3036f commit 382142c
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 0 deletions.
4 changes: 4 additions & 0 deletions migrations/06-taggit-convert-to-south.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
--
-- Taggit app converted to use South, simulate --fake to skip first migration
--
INSERT INTO `south_migrationhistory` VALUES (null,'taggit','0001_initial','2011-05-27 10:00:00');
Empty file added migrations/__init__.py
Empty file.
Empty file added migrations/south/__init__.py
Empty file.
61 changes: 61 additions & 0 deletions migrations/south/taggit/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models

class Migration(SchemaMigration):

def forwards(self, orm):

# Adding model 'Tag'
db.create_table('taggit_tag', (
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('name', self.gf('django.db.models.fields.CharField')(max_length=100)),
('slug', self.gf('django.db.models.fields.SlugField')(unique=True, max_length=100, db_index=True)),
))
db.send_create_signal('taggit', ['Tag'])

# Adding model 'TaggedItem'
db.create_table('taggit_taggeditem', (
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('tag', self.gf('django.db.models.fields.related.ForeignKey')(related_name='taggit_taggeditem_items', to=orm['taggit.Tag'])),
('object_id', self.gf('django.db.models.fields.IntegerField')()),
('content_type', self.gf('django.db.models.fields.related.ForeignKey')(related_name='tagged_items', to=orm['contenttypes.ContentType'])),
))
db.send_create_signal('taggit', ['TaggedItem'])


def backwards(self, orm):

# Deleting model 'Tag'
db.delete_table('taggit_tag')

# Deleting model 'TaggedItem'
db.delete_table('taggit_taggeditem')


models = {
'contenttypes.contenttype': {
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
},
'taggit.tag': {
'Meta': {'object_name': 'Tag'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '100', 'db_index': 'True'})
},
'taggit.taggeditem': {
'Meta': {'object_name': 'TaggedItem'},
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'tagged_items'", 'to': "orm['contenttypes.ContentType']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'object_id': ('django.db.models.fields.IntegerField', [], {}),
'tag': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'taggit_taggeditem_items'", 'to': "orm['taggit.Tag']"})
}
}

complete_apps = ['taggit']
Empty file.
8 changes: 8 additions & 0 deletions settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -699,5 +699,13 @@ def read_only_mode(env):
# Base URL from where files uploaded for demos will be linked and served
DEMO_UPLOADS_URL = '/media/uploads/demos/'

# Make sure South stays out of the way during testing
SOUTH_TESTS_MIGRATE = False
SKIP_SOUTH_TESTS = True

# Provide migrations for third-party vendor apps
# TODO: Move migrations for our apps here, rather than living with the app?
SOUTH_MIGRATION_MODULES = {
'taggit': 'migrations.south.taggit',
}

0 comments on commit 382142c

Please sign in to comment.