3 from south.db import db
4 from south.v2 import SchemaMigration
5 from django.db import models
8 class Migration(SchemaMigration):
10 def forwards(self, orm):
13 db.create_table('catalogue_book', (
14 ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
15 ('title', self.gf('django.db.models.fields.CharField')(max_length=255, db_index=True)),
16 ('slug', self.gf('django.db.models.fields.SlugField')(unique=True, max_length=128, db_index=True)),
17 ('gallery', self.gf('django.db.models.fields.CharField')(max_length=255, blank=True)),
18 ('parent', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='children', null=True, to=orm['catalogue.Book'])),
19 ('parent_number', self.gf('django.db.models.fields.IntegerField')(db_index=True, null=True, blank=True)),
21 db.send_create_signal('catalogue', ['Book'])
23 # Adding model 'Chunk'
24 db.create_table('catalogue_chunk', (
25 ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
26 ('creator', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='created_documents', null=True, to=orm['auth.User'])),
27 ('user', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'], null=True, blank=True)),
28 ('book', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['catalogue.Book'])),
29 ('number', self.gf('django.db.models.fields.IntegerField')()),
30 ('slug', self.gf('django.db.models.fields.SlugField')(max_length=50, db_index=True)),
31 ('title', self.gf('django.db.models.fields.CharField')(max_length=255, blank=True)),
32 ('stage', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['catalogue.ChunkTag'], null=True, blank=True)),
33 ('head', self.gf('django.db.models.fields.related.ForeignKey')(default=None, to=orm['catalogue.ChunkChange'], null=True, blank=True)),
35 db.send_create_signal('catalogue', ['Chunk'])
37 # Adding unique constraint on 'Chunk', fields ['book', 'number']
38 db.create_unique('catalogue_chunk', ['book_id', 'number'])
40 # Adding unique constraint on 'Chunk', fields ['book', 'slug']
41 db.create_unique('catalogue_chunk', ['book_id', 'slug'])
43 # Adding model 'ChunkTag'
44 db.create_table('catalogue_chunktag', (
45 ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
46 ('name', self.gf('django.db.models.fields.CharField')(max_length=64)),
47 ('slug', self.gf('django.db.models.fields.SlugField')(db_index=True, max_length=64, unique=True, null=True, blank=True)),
48 ('ordering', self.gf('django.db.models.fields.IntegerField')()),
50 db.send_create_signal('catalogue', ['ChunkTag'])
52 # Adding model 'ChunkChange'
53 db.create_table('catalogue_chunkchange', (
54 ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
55 ('author', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'], null=True, blank=True)),
56 ('author_name', self.gf('django.db.models.fields.CharField')(max_length=128, null=True, blank=True)),
57 ('author_email', self.gf('django.db.models.fields.CharField')(max_length=128, null=True, blank=True)),
58 ('data', self.gf('django.db.models.fields.files.FileField')(max_length=100)),
59 ('revision', self.gf('django.db.models.fields.IntegerField')(db_index=True)),
60 ('parent', self.gf('django.db.models.fields.related.ForeignKey')(default=None, related_name='children', null=True, blank=True, to=orm['catalogue.ChunkChange'])),
61 ('merge_parent', self.gf('django.db.models.fields.related.ForeignKey')(default=None, related_name='merge_children', null=True, blank=True, to=orm['catalogue.ChunkChange'])),
62 ('description', self.gf('django.db.models.fields.TextField')(default='', blank=True)),
63 ('created_at', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime.now, db_index=True)),
64 ('publishable', self.gf('django.db.models.fields.BooleanField')(default=False)),
65 ('tree', self.gf('django.db.models.fields.related.ForeignKey')(related_name='change_set', to=orm['catalogue.Chunk'])),
67 db.send_create_signal('catalogue', ['ChunkChange'])
69 # Adding unique constraint on 'ChunkChange', fields ['tree', 'revision']
70 db.create_unique('catalogue_chunkchange', ['tree_id', 'revision'])
72 # Adding M2M table for field tags on 'ChunkChange'
73 db.create_table('catalogue_chunkchange_tags', (
74 ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
75 ('chunkchange', models.ForeignKey(orm['catalogue.chunkchange'], null=False)),
76 ('chunktag', models.ForeignKey(orm['catalogue.chunktag'], null=False))
78 db.create_unique('catalogue_chunkchange_tags', ['chunkchange_id', 'chunktag_id'])
80 # Adding model 'BookPublishRecord'
81 db.create_table('catalogue_bookpublishrecord', (
82 ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
83 ('book', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['catalogue.Book'])),
84 ('timestamp', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)),
85 ('user', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'])),
87 db.send_create_signal('catalogue', ['BookPublishRecord'])
89 # Adding model 'ChunkPublishRecord'
90 db.create_table('catalogue_chunkpublishrecord', (
91 ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
92 ('book_record', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['catalogue.BookPublishRecord'])),
93 ('change', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['catalogue.ChunkChange'])),
95 db.send_create_signal('catalogue', ['ChunkPublishRecord'])
98 from django.core.management import call_command
99 call_command("loaddata", "stages.json")
102 def backwards(self, orm):
104 # Removing unique constraint on 'ChunkChange', fields ['tree', 'revision']
105 db.delete_unique('catalogue_chunkchange', ['tree_id', 'revision'])
107 # Removing unique constraint on 'Chunk', fields ['book', 'slug']
108 db.delete_unique('catalogue_chunk', ['book_id', 'slug'])
110 # Removing unique constraint on 'Chunk', fields ['book', 'number']
111 db.delete_unique('catalogue_chunk', ['book_id', 'number'])
113 # Deleting model 'Book'
114 db.delete_table('catalogue_book')
116 # Deleting model 'Chunk'
117 db.delete_table('catalogue_chunk')
119 # Deleting model 'ChunkTag'
120 db.delete_table('catalogue_chunktag')
122 # Deleting model 'ChunkChange'
123 db.delete_table('catalogue_chunkchange')
125 # Removing M2M table for field tags on 'ChunkChange'
126 db.delete_table('catalogue_chunkchange_tags')
128 # Deleting model 'BookPublishRecord'
129 db.delete_table('catalogue_bookpublishrecord')
131 # Deleting model 'ChunkPublishRecord'
132 db.delete_table('catalogue_chunkpublishrecord')
137 'Meta': {'object_name': 'Group'},
138 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
139 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
140 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
143 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
144 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
145 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
146 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
147 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
150 'Meta': {'object_name': 'User'},
151 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
152 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
153 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
154 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
155 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
156 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
157 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
158 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
159 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
160 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
161 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
162 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
163 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
166 'Meta': {'ordering': "['parent_number', 'title']", 'object_name': 'Book'},
167 'gallery': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),
168 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
169 'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': "orm['catalogue.Book']"}),
170 'parent_number': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
171 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '128', 'db_index': 'True'}),
172 'title': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'})
174 'catalogue.bookpublishrecord': {
175 'Meta': {'ordering': "['-timestamp']", 'object_name': 'BookPublishRecord'},
176 'book': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.Book']"}),
177 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
178 'timestamp': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
179 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"})
182 'Meta': {'ordering': "['number']", 'unique_together': "[['book', 'number'], ['book', 'slug']]", 'object_name': 'Chunk'},
183 'book': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.Book']"}),
184 'title': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),
185 'creator': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'created_documents'", 'null': 'True', 'to': "orm['auth.User']"}),
186 'head': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': "orm['catalogue.ChunkChange']", 'null': 'True', 'blank': 'True'}),
187 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
188 'number': ('django.db.models.fields.IntegerField', [], {}),
189 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'db_index': 'True'}),
190 'stage': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.ChunkTag']", 'null': 'True', 'blank': 'True'}),
191 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'})
193 'catalogue.chunkchange': {
194 'Meta': {'ordering': "('created_at',)", 'unique_together': "(['tree', 'revision'],)", 'object_name': 'ChunkChange'},
195 'author': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}),
196 'author_email': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}),
197 'author_name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}),
198 'created_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'db_index': 'True'}),
199 'data': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}),
200 'description': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}),
201 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
202 'merge_parent': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'related_name': "'merge_children'", 'null': 'True', 'blank': 'True', 'to': "orm['catalogue.ChunkChange']"}),
203 'parent': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'related_name': "'children'", 'null': 'True', 'blank': 'True', 'to': "orm['catalogue.ChunkChange']"}),
204 'publishable': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
205 'revision': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}),
206 'tags': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'change_set'", 'symmetrical': 'False', 'to': "orm['catalogue.ChunkTag']"}),
207 'tree': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'change_set'", 'to': "orm['catalogue.Chunk']"})
209 'catalogue.chunkpublishrecord': {
210 'Meta': {'object_name': 'ChunkPublishRecord'},
211 'book_record': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.BookPublishRecord']"}),
212 'change': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.ChunkChange']"}),
213 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
215 'catalogue.chunktag': {
216 'Meta': {'ordering': "['ordering']", 'object_name': 'ChunkTag'},
217 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
218 'name': ('django.db.models.fields.CharField', [], {'max_length': '64'}),
219 'ordering': ('django.db.models.fields.IntegerField', [], {}),
220 'slug': ('django.db.models.fields.SlugField', [], {'db_index': 'True', 'max_length': '64', 'unique': 'True', 'null': 'True', 'blank': 'True'})
222 'contenttypes.contenttype': {
223 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
224 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
225 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
226 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
227 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
231 complete_apps = ['catalogue']