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 'User'
12
+ db .create_table (u'api_user' , (
13
+ (u'id' , self .gf ('django.db.models.fields.AutoField' )(primary_key = True )),
14
+ ('password' , self .gf ('django.db.models.fields.CharField' )(max_length = 128 )),
15
+ ('last_login' , self .gf ('django.db.models.fields.DateTimeField' )(default = datetime .datetime .now )),
16
+ ('is_superuser' , self .gf ('django.db.models.fields.BooleanField' )(default = False )),
17
+ ('username' , self .gf ('django.db.models.fields.CharField' )(unique = True , max_length = 30 )),
18
+ ('first_name' , self .gf ('django.db.models.fields.CharField' )(max_length = 30 , blank = True )),
19
+ ('last_name' , self .gf ('django.db.models.fields.CharField' )(max_length = 30 , blank = True )),
20
+ ('email' , self .gf ('django.db.models.fields.EmailField' )(max_length = 75 , blank = True )),
21
+ ('is_staff' , self .gf ('django.db.models.fields.BooleanField' )(default = False )),
22
+ ('is_active' , self .gf ('django.db.models.fields.BooleanField' )(default = True )),
23
+ ('date_joined' , self .gf ('django.db.models.fields.DateTimeField' )(default = datetime .datetime .now )),
24
+ ))
25
+ db .send_create_signal (u'api' , ['User' ])
26
+
27
+ # Adding M2M table for field groups on 'User'
28
+ m2m_table_name = db .shorten_name (u'api_user_groups' )
29
+ db .create_table (m2m_table_name , (
30
+ ('id' , models .AutoField (verbose_name = 'ID' , primary_key = True , auto_created = True )),
31
+ ('user' , models .ForeignKey (orm [u'api.user' ], null = False )),
32
+ ('group' , models .ForeignKey (orm [u'auth.group' ], null = False ))
33
+ ))
34
+ db .create_unique (m2m_table_name , ['user_id' , 'group_id' ])
35
+
36
+ # Adding M2M table for field user_permissions on 'User'
37
+ m2m_table_name = db .shorten_name (u'api_user_user_permissions' )
38
+ db .create_table (m2m_table_name , (
39
+ ('id' , models .AutoField (verbose_name = 'ID' , primary_key = True , auto_created = True )),
40
+ ('user' , models .ForeignKey (orm [u'api.user' ], null = False )),
41
+ ('permission' , models .ForeignKey (orm [u'auth.permission' ], null = False ))
42
+ ))
43
+ db .create_unique (m2m_table_name , ['user_id' , 'permission_id' ])
44
+
45
+ # Adding M2M table for field followers on 'User'
46
+ m2m_table_name = db .shorten_name (u'api_user_followers' )
47
+ db .create_table (m2m_table_name , (
48
+ ('id' , models .AutoField (verbose_name = 'ID' , primary_key = True , auto_created = True )),
49
+ ('from_user' , models .ForeignKey (orm [u'api.user' ], null = False )),
50
+ ('to_user' , models .ForeignKey (orm [u'api.user' ], null = False ))
51
+ ))
52
+ db .create_unique (m2m_table_name , ['from_user_id' , 'to_user_id' ])
53
+
54
+ # Adding model 'Post'
55
+ db .create_table (u'api_post' , (
56
+ (u'id' , self .gf ('django.db.models.fields.AutoField' )(primary_key = True )),
57
+ ('author' , self .gf ('django.db.models.fields.related.ForeignKey' )(to = orm ['api.User' ])),
58
+ ('title' , self .gf ('django.db.models.fields.CharField' )(max_length = 255 )),
59
+ ('body' , self .gf ('django.db.models.fields.TextField' )(null = True , blank = True )),
60
+ ))
61
+ db .send_create_signal (u'api' , ['Post' ])
62
+
63
+ # Adding model 'Photo'
64
+ db .create_table (u'api_photo' , (
65
+ (u'id' , self .gf ('django.db.models.fields.AutoField' )(primary_key = True )),
66
+ ('post' , self .gf ('django.db.models.fields.related.ForeignKey' )(related_name = 'photos' , to = orm ['api.Post' ])),
67
+ ('image' , self .gf ('django.db.models.fields.files.ImageField' )(max_length = 100 )),
68
+ ))
69
+ db .send_create_signal (u'api' , ['Photo' ])
70
+
71
+
72
+ def backwards (self , orm ):
73
+ # Deleting model 'User'
74
+ db .delete_table (u'api_user' )
75
+
76
+ # Removing M2M table for field groups on 'User'
77
+ db .delete_table (db .shorten_name (u'api_user_groups' ))
78
+
79
+ # Removing M2M table for field user_permissions on 'User'
80
+ db .delete_table (db .shorten_name (u'api_user_user_permissions' ))
81
+
82
+ # Removing M2M table for field followers on 'User'
83
+ db .delete_table (db .shorten_name (u'api_user_followers' ))
84
+
85
+ # Deleting model 'Post'
86
+ db .delete_table (u'api_post' )
87
+
88
+ # Deleting model 'Photo'
89
+ db .delete_table (u'api_photo' )
90
+
91
+
92
+ models = {
93
+ u'api.photo' : {
94
+ 'Meta' : {'object_name' : 'Photo' },
95
+ u'id' : ('django.db.models.fields.AutoField' , [], {'primary_key' : 'True' }),
96
+ 'image' : ('django.db.models.fields.files.ImageField' , [], {'max_length' : '100' }),
97
+ 'post' : ('django.db.models.fields.related.ForeignKey' , [], {'related_name' : "'photos'" , 'to' : u"orm['api.Post']" })
98
+ },
99
+ u'api.post' : {
100
+ 'Meta' : {'object_name' : 'Post' },
101
+ 'author' : ('django.db.models.fields.related.ForeignKey' , [], {'to' : u"orm['api.User']" }),
102
+ 'body' : ('django.db.models.fields.TextField' , [], {'null' : 'True' , 'blank' : 'True' }),
103
+ u'id' : ('django.db.models.fields.AutoField' , [], {'primary_key' : 'True' }),
104
+ 'title' : ('django.db.models.fields.CharField' , [], {'max_length' : '255' })
105
+ },
106
+ u'api.user' : {
107
+ 'Meta' : {'object_name' : 'User' },
108
+ 'date_joined' : ('django.db.models.fields.DateTimeField' , [], {'default' : 'datetime.datetime.now' }),
109
+ 'email' : ('django.db.models.fields.EmailField' , [], {'max_length' : '75' , 'blank' : 'True' }),
110
+ 'first_name' : ('django.db.models.fields.CharField' , [], {'max_length' : '30' , 'blank' : 'True' }),
111
+ 'followers' : ('django.db.models.fields.related.ManyToManyField' , [], {'related_name' : "'followees'" , 'symmetrical' : 'False' , 'to' : u"orm['api.User']" }),
112
+ 'groups' : ('django.db.models.fields.related.ManyToManyField' , [], {'to' : u"orm['auth.Group']" , 'symmetrical' : 'False' , 'blank' : 'True' }),
113
+ u'id' : ('django.db.models.fields.AutoField' , [], {'primary_key' : 'True' }),
114
+ 'is_active' : ('django.db.models.fields.BooleanField' , [], {'default' : 'True' }),
115
+ 'is_staff' : ('django.db.models.fields.BooleanField' , [], {'default' : 'False' }),
116
+ 'is_superuser' : ('django.db.models.fields.BooleanField' , [], {'default' : 'False' }),
117
+ 'last_login' : ('django.db.models.fields.DateTimeField' , [], {'default' : 'datetime.datetime.now' }),
118
+ 'last_name' : ('django.db.models.fields.CharField' , [], {'max_length' : '30' , 'blank' : 'True' }),
119
+ 'password' : ('django.db.models.fields.CharField' , [], {'max_length' : '128' }),
120
+ 'user_permissions' : ('django.db.models.fields.related.ManyToManyField' , [], {'to' : u"orm['auth.Permission']" , 'symmetrical' : 'False' , 'blank' : 'True' }),
121
+ 'username' : ('django.db.models.fields.CharField' , [], {'unique' : 'True' , 'max_length' : '30' })
122
+ },
123
+ u'auth.group' : {
124
+ 'Meta' : {'object_name' : 'Group' },
125
+ u'id' : ('django.db.models.fields.AutoField' , [], {'primary_key' : 'True' }),
126
+ 'name' : ('django.db.models.fields.CharField' , [], {'unique' : 'True' , 'max_length' : '80' }),
127
+ 'permissions' : ('django.db.models.fields.related.ManyToManyField' , [], {'to' : u"orm['auth.Permission']" , 'symmetrical' : 'False' , 'blank' : 'True' })
128
+ },
129
+ u'auth.permission' : {
130
+ 'Meta' : {'ordering' : "(u'content_type__app_label', u'content_type__model', u'codename')" , 'unique_together' : "((u'content_type', u'codename'),)" , 'object_name' : 'Permission' },
131
+ 'codename' : ('django.db.models.fields.CharField' , [], {'max_length' : '100' }),
132
+ 'content_type' : ('django.db.models.fields.related.ForeignKey' , [], {'to' : u"orm['contenttypes.ContentType']" }),
133
+ u'id' : ('django.db.models.fields.AutoField' , [], {'primary_key' : 'True' }),
134
+ 'name' : ('django.db.models.fields.CharField' , [], {'max_length' : '50' })
135
+ },
136
+ u'contenttypes.contenttype' : {
137
+ 'Meta' : {'ordering' : "('name',)" , 'unique_together' : "(('app_label', 'model'),)" , 'object_name' : 'ContentType' , 'db_table' : "'django_content_type'" },
138
+ 'app_label' : ('django.db.models.fields.CharField' , [], {'max_length' : '100' }),
139
+ u'id' : ('django.db.models.fields.AutoField' , [], {'primary_key' : 'True' }),
140
+ 'model' : ('django.db.models.fields.CharField' , [], {'max_length' : '100' }),
141
+ 'name' : ('django.db.models.fields.CharField' , [], {'max_length' : '100' })
142
+ }
143
+ }
144
+
145
+ complete_apps = ['api' ]
0 commit comments