1
# Copyright 2005-2011 Canonical Ltd. All rights reserved.
3
# This program is free software: you can redistribute it and/or modify
4
# it under the terms of the GNU Affero General Public License as published by
5
# the Free Software Foundation, either version 3 of the License, or
6
# (at your option) any later version.
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
# GNU Affero General Public License for more details.
13
# You should have received a copy of the GNU Affero General Public License
14
# along with this program. If not, see <http://www.gnu.org/licenses/>.
16
from south.v2 import DataMigration
19
class Migration(DataMigration):
21
def forwards(self, orm):
22
"""Data migration for the AppInstance model.
24
This data migration adds AppInstance objects into the database.
29
for appinstance in appinstances:
30
# If the appinstance doesn't exist in the database, then add it.
31
# This is to cope with the data already in the database added by
32
# the previous mechanism using initial_data.json
34
a = orm.AppInstance.objects.get(title=appinstance)
35
except orm.AppInstance.DoesNotExist:
36
a = orm.AppInstance(title=appinstance)
39
def backwards(self, orm):
40
raise RuntimeError("Can not reverse this migration.")
44
'Meta': {'object_name': 'AppInstance'},
45
'id': ('django.db.models.fields.AutoField', [],
46
{'primary_key': 'True'}),
47
'title': ('django.db.models.fields.CharField', [],
48
{'unique': 'True', 'max_length': '50'})
50
'oops.classification': {
51
'Meta': {'object_name': 'Classification'},
52
'id': ('django.db.models.fields.AutoField', [],
53
{'primary_key': 'True'}),
54
'title': ('django.db.models.fields.CharField', [],
55
{'unique': 'True', 'max_length': '100'})
57
'oops.dboopsrootdirectory': {
58
'Meta': {'object_name': 'DBOopsRootDirectory'},
59
'id': ('django.db.models.fields.AutoField', [],
60
{'primary_key': 'True'}),
61
'last_date': ('django.db.models.fields.DateField', [],
63
'last_oops': ('django.db.models.fields.CharField', [],
64
{'max_length': '200', 'null': 'True'}),
65
'root_dir': ('django.db.models.fields.CharField', [],
66
{'unique': 'True', 'max_length': '200'})
69
'Meta': {'unique_together':
70
"(('exception_type', 'exception_value'),)",
71
'object_name': 'Infestation'},
72
'bug': ('django.db.models.fields.PositiveIntegerField', [],
74
'exception_type': ('django.db.models.fields.CharField', [],
75
{'max_length': '100'}),
76
'exception_value': ('django.db.models.fields.CharField', [],
77
{'max_length': '1000'}),
78
'id': ('django.db.models.fields.AutoField', [],
79
{'primary_key': 'True'}),
82
'Meta': {'object_name': 'Oops'},
83
'appinstance': ('django.db.models.fields.related.ForeignKey', [],
84
{'to': "orm['oops.AppInstance']"}),
85
'classification': ('django.db.models.fields.related.ForeignKey', [],
86
{'to': "orm['oops.Classification']", 'null': 'True'}),
87
'date': ('django.db.models.fields.DateTimeField', [],
88
{'db_index': 'True'}),
89
'duration': ('django.db.models.fields.FloatField', [],
91
'http_method': ('django.db.models.fields.CharField', [],
92
{'max_length': '10', 'null': 'True'}),
93
'id': ('django.db.models.fields.AutoField', [],
94
{'primary_key': 'True'}),
95
'informational': ('django.db.models.fields.NullBooleanField', [],
97
'is_bot': ('django.db.models.fields.NullBooleanField', [],
98
{'null': 'True', 'db_index': 'True'}),
99
'is_local_referrer': ('django.db.models.fields.NullBooleanField', [],
100
{'null': 'True', 'db_index': 'True'}),
101
'most_expensive_statement': ('django.db.models.fields.CharField', [],
102
{'max_length': '200', 'null': 'True', 'db_index': 'True'}),
103
'oopsid': ('django.db.models.fields.CharField', [],
104
{'unique': 'True', 'max_length': '200'}),
105
'oopsinfestation': ('django.db.models.fields.related.ForeignKey', [],
106
{'to': "orm['oops.Infestation']"}),
107
'pageid': ('django.db.models.fields.CharField', [],
108
{'max_length': '500'}),
109
'pathname': ('django.db.models.fields.CharField', [],
110
{'unique': 'True', 'max_length': '200'}),
111
'prefix': ('django.db.models.fields.related.ForeignKey', [],
112
{'to': "orm['oops.Prefix']"}),
113
'referrer': ('django.db.models.fields.URLField', [],
114
{'max_length': '500', 'null': 'True'}),
115
'statements_count': ('django.db.models.fields.PositiveIntegerField', [],
117
'time_is_estimate': ('django.db.models.fields.NullBooleanField', [],
119
'total_time': ('django.db.models.fields.PositiveIntegerField', [],
121
'url': ('django.db.models.fields.URLField', [],
122
{'max_length': '500', 'null': 'True', 'db_index': 'True'}),
123
'user_agent': ('django.db.models.fields.CharField', [],
124
{'max_length': '200', 'null': 'True'})
127
'Meta': {'object_name': 'Prefix'},
128
'appinstance': ('django.db.models.fields.related.ForeignKey', [],
129
{'to': "orm['oops.AppInstance']"}),
130
'id': ('django.db.models.fields.AutoField', [],
131
{'primary_key': 'True'}),
132
'value': ('django.db.models.fields.CharField', [],
133
{'unique': 'True', 'max_length': '20'})
136
'Meta': {'object_name': 'Project'},
137
'id': ('django.db.models.fields.AutoField', [],
138
{'primary_key': 'True'}),
139
'title': ('django.db.models.fields.CharField', [],
140
{'unique': 'True', 'max_length': '200'})
144
complete_apps = ['oops']