c37abf526c3b1212df6dc2b8b825dc8f0ae42c27
[wolnelektury.git] / apps / libraries / migrations / 0002_auto__add_catalog__add_field_library_catalog.py
1 # -*- coding: utf-8 -*-
2 import datetime
3 from south.db import db
4 from south.v2 import SchemaMigration
5 from django.db import models
6
7
8 class Migration(SchemaMigration):
9
10     def forwards(self, orm):
11         # Adding model 'Catalog'
12         db.create_table(u'libraries_catalog', (
13             (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
14             ('name', self.gf('django.db.models.fields.CharField')(max_length=120)),
15             ('slug', self.gf('django.db.models.fields.SlugField')(unique=True, max_length=120)),
16         ))
17         db.send_create_signal(u'libraries', ['Catalog'])
18
19         # Adding field 'Library.catalog'
20         db.add_column(u'libraries_library', 'catalog',
21                       self.gf('django.db.models.fields.related.ForeignKey')(default=None, related_name='libraries', on_delete=models.PROTECT, to=orm['libraries.Catalog']),
22                       keep_default=False)
23
24
25     def backwards(self, orm):
26         # Deleting model 'Catalog'
27         db.delete_table(u'libraries_catalog')
28
29         # Deleting field 'Library.catalog'
30         db.delete_column(u'libraries_library', 'catalog_id')
31
32
33     models = {
34         u'libraries.catalog': {
35             'Meta': {'object_name': 'Catalog'},
36             u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
37             'name': ('django.db.models.fields.CharField', [], {'max_length': '120'}),
38             'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '120'})
39         },
40         u'libraries.library': {
41             'Meta': {'object_name': 'Library'},
42             'catalog': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'libraries'", 'on_delete': 'models.PROTECT', 'to': u"orm['libraries.Catalog']"}),
43             'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
44             u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
45             'name': ('django.db.models.fields.CharField', [], {'max_length': '120', 'blank': 'True'}),
46             'url': ('django.db.models.fields.CharField', [], {'max_length': '120', 'blank': 'True'})
47         }
48     }
49
50     complete_apps = ['libraries']