3 from south.db import db
4 from south.v2 import SchemaMigration
5 from django.db import models
7 class Migration(SchemaMigration):
9 def forwards(self, orm):
12 db.create_table('catalogue_book', (
13 ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
14 ('title', self.gf('django.db.models.fields.CharField')(max_length=255, db_index=True)),
15 ('slug', self.gf('django.db.models.fields.SlugField')(unique=True, max_length=128, db_index=True)),
16 ('gallery', self.gf('django.db.models.fields.CharField')(max_length=255, blank=True)),
17 ('parent', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='children', null=True, to=orm['catalogue.Book'])),
18 ('parent_number', self.gf('django.db.models.fields.IntegerField')(db_index=True, null=True, blank=True)),
19 ('_short_html', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
20 ('_single', self.gf('django.db.models.fields.NullBooleanField')(db_index=True, null=True, blank=True)),
21 ('_new_publishable', self.gf('django.db.models.fields.NullBooleanField')(null=True, blank=True)),
22 ('_published', self.gf('django.db.models.fields.NullBooleanField')(null=True, blank=True)),
24 db.send_create_signal('catalogue', ['Book'])
26 # Adding model 'Chunk'
27 db.create_table('catalogue_chunk', (
28 ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
29 ('creator', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='created_documents', null=True, to=orm['auth.User'])),
30 ('user', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'], null=True, blank=True)),
31 ('book', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['catalogue.Book'])),
32 ('number', self.gf('django.db.models.fields.IntegerField')()),
33 ('slug', self.gf('django.db.models.fields.SlugField')(max_length=50, db_index=True)),
34 ('title', self.gf('django.db.models.fields.CharField')(max_length=255, blank=True)),
35 ('_short_html', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
36 ('_hidden', self.gf('django.db.models.fields.NullBooleanField')(null=True, blank=True)),
37 ('_changed', self.gf('django.db.models.fields.NullBooleanField')(null=True, blank=True)),
38 ('stage', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['catalogue.ChunkTag'], null=True, blank=True)),
39 ('head', self.gf('django.db.models.fields.related.ForeignKey')(default=None, to=orm['catalogue.ChunkChange'], null=True, blank=True)),
41 db.send_create_signal('catalogue', ['Chunk'])
43 # Adding unique constraint on 'Chunk', fields ['book', 'number']
44 db.create_unique('catalogue_chunk', ['book_id', 'number'])
46 # Adding unique constraint on 'Chunk', fields ['book', 'slug']
47 db.create_unique('catalogue_chunk', ['book_id', 'slug'])
49 # Adding model 'ChunkTag'
50 db.create_table('catalogue_chunktag', (
51 ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
52 ('name', self.gf('django.db.models.fields.CharField')(max_length=64)),
53 ('slug', self.gf('django.db.models.fields.SlugField')(db_index=True, max_length=64, unique=True, null=True, blank=True)),
54 ('ordering', self.gf('django.db.models.fields.IntegerField')()),
56 db.send_create_signal('catalogue', ['ChunkTag'])
58 # Adding model 'ChunkChange'
59 db.create_table('catalogue_chunkchange', (
60 ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
61 ('author', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'], null=True, blank=True)),
62 ('author_name', self.gf('django.db.models.fields.CharField')(max_length=128, null=True, blank=True)),
63 ('author_email', self.gf('django.db.models.fields.CharField')(max_length=128, null=True, blank=True)),
64 ('revision', self.gf('django.db.models.fields.IntegerField')(db_index=True)),
65 ('parent', self.gf('django.db.models.fields.related.ForeignKey')(default=None, related_name='children', null=True, blank=True, to=orm['catalogue.ChunkChange'])),
66 ('merge_parent', self.gf('django.db.models.fields.related.ForeignKey')(default=None, related_name='merge_children', null=True, blank=True, to=orm['catalogue.ChunkChange'])),
67 ('description', self.gf('django.db.models.fields.TextField')(default='', blank=True)),
68 ('created_at', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime.now, db_index=True)),
69 ('publishable', self.gf('django.db.models.fields.BooleanField')(default=False)),
70 ('tree', self.gf('django.db.models.fields.related.ForeignKey')(related_name='change_set', to=orm['catalogue.Chunk'])),
71 ('data', self.gf('django.db.models.fields.files.FileField')(max_length=100)),
73 db.send_create_signal('catalogue', ['ChunkChange'])
75 # Adding unique constraint on 'ChunkChange', fields ['tree', 'revision']
76 db.create_unique('catalogue_chunkchange', ['tree_id', 'revision'])
78 # Adding M2M table for field tags on 'ChunkChange'
79 db.create_table('catalogue_chunkchange_tags', (
80 ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
81 ('chunkchange', models.ForeignKey(orm['catalogue.chunkchange'], null=False)),
82 ('chunktag', models.ForeignKey(orm['catalogue.chunktag'], null=False))
84 db.create_unique('catalogue_chunkchange_tags', ['chunkchange_id', 'chunktag_id'])
86 # Adding model 'BookPublishRecord'
87 db.create_table('catalogue_bookpublishrecord', (
88 ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
89 ('book', self.gf('django.db.models.fields.related.ForeignKey')(related_name='publish_log', to=orm['catalogue.Book'])),
90 ('timestamp', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)),
91 ('user', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'])),
93 db.send_create_signal('catalogue', ['BookPublishRecord'])
95 # Adding model 'ChunkPublishRecord'
96 db.create_table('catalogue_chunkpublishrecord', (
97 ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
98 ('book_record', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['catalogue.BookPublishRecord'])),
99 ('change', self.gf('django.db.models.fields.related.ForeignKey')(related_name='publish_log', to=orm['catalogue.ChunkChange'])),
101 db.send_create_signal('catalogue', ['ChunkPublishRecord'])
104 def backwards(self, orm):
106 # Removing unique constraint on 'ChunkChange', fields ['tree', 'revision']
107 db.delete_unique('catalogue_chunkchange', ['tree_id', 'revision'])
109 # Removing unique constraint on 'Chunk', fields ['book', 'slug']
110 db.delete_unique('catalogue_chunk', ['book_id', 'slug'])
112 # Removing unique constraint on 'Chunk', fields ['book', 'number']
113 db.delete_unique('catalogue_chunk', ['book_id', 'number'])
115 # Deleting model 'Book'
116 db.delete_table('catalogue_book')
118 # Deleting model 'Chunk'
119 db.delete_table('catalogue_chunk')
121 # Deleting model 'ChunkTag'
122 db.delete_table('catalogue_chunktag')
124 # Deleting model 'ChunkChange'
125 db.delete_table('catalogue_chunkchange')
127 # Removing M2M table for field tags on 'ChunkChange'
128 db.delete_table('catalogue_chunkchange_tags')
130 # Deleting model 'BookPublishRecord'
131 db.delete_table('catalogue_bookpublishrecord')
133 # Deleting model 'ChunkPublishRecord'
134 db.delete_table('catalogue_chunkpublishrecord')
139 'Meta': {'object_name': 'Group'},
140 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
141 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
142 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
145 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
146 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
147 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
148 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
149 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
152 'Meta': {'object_name': 'User'},
153 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
154 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
155 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
156 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
157 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
158 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
159 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
160 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
161 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
162 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
163 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
164 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
165 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
168 'Meta': {'ordering': "['parent_number', 'title']", 'object_name': 'Book'},
169 '_new_publishable': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
170 '_published': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
171 '_short_html': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
172 '_single': ('django.db.models.fields.NullBooleanField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
173 'gallery': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),
174 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
175 'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': "orm['catalogue.Book']"}),
176 'parent_number': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
177 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '128', 'db_index': 'True'}),
178 'title': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'})
180 'catalogue.bookpublishrecord': {
181 'Meta': {'ordering': "['-timestamp']", 'object_name': 'BookPublishRecord'},
182 'book': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'publish_log'", 'to': "orm['catalogue.Book']"}),
183 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
184 'timestamp': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
185 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"})
188 'Meta': {'ordering': "['number']", 'unique_together': "[['book', 'number'], ['book', 'slug']]", 'object_name': 'Chunk'},
189 '_changed': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
190 '_hidden': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
191 '_short_html': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
192 'book': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.Book']"}),
193 'creator': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'created_documents'", 'null': 'True', 'to': "orm['auth.User']"}),
194 'head': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': "orm['catalogue.ChunkChange']", 'null': 'True', 'blank': 'True'}),
195 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
196 'number': ('django.db.models.fields.IntegerField', [], {}),
197 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'db_index': 'True'}),
198 'stage': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.ChunkTag']", 'null': 'True', 'blank': 'True'}),
199 'title': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),
200 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'})
202 'catalogue.chunkchange': {
203 'Meta': {'ordering': "('created_at',)", 'unique_together': "(['tree', 'revision'],)", 'object_name': 'ChunkChange'},
204 'author': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}),
205 'author_email': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}),
206 'author_name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}),
207 'created_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'db_index': 'True'}),
208 'data': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}),
209 'description': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}),
210 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
211 'merge_parent': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'related_name': "'merge_children'", 'null': 'True', 'blank': 'True', 'to': "orm['catalogue.ChunkChange']"}),
212 'parent': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'related_name': "'children'", 'null': 'True', 'blank': 'True', 'to': "orm['catalogue.ChunkChange']"}),
213 'publishable': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
214 'revision': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}),
215 'tags': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'change_set'", 'symmetrical': 'False', 'to': "orm['catalogue.ChunkTag']"}),
216 'tree': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'change_set'", 'to': "orm['catalogue.Chunk']"})
218 'catalogue.chunkpublishrecord': {
219 'Meta': {'object_name': 'ChunkPublishRecord'},
220 'book_record': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.BookPublishRecord']"}),
221 'change': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'publish_log'", 'to': "orm['catalogue.ChunkChange']"}),
222 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
224 'catalogue.chunktag': {
225 'Meta': {'ordering': "['ordering']", 'object_name': 'ChunkTag'},
226 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
227 'name': ('django.db.models.fields.CharField', [], {'max_length': '64'}),
228 'ordering': ('django.db.models.fields.IntegerField', [], {}),
229 'slug': ('django.db.models.fields.SlugField', [], {'db_index': 'True', 'max_length': '64', 'unique': 'True', 'null': 'True', 'blank': 'True'})
231 'contenttypes.contenttype': {
232 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
233 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
234 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
235 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
236 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
240 complete_apps = ['catalogue']