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
"""Add Classification objects into the database."""
25
"Time Outs", "Soft Time Outs", "Informational Only Errors",
26
"User Generated Errors", "Unauthorized Errors", "Pages Not Found",
27
"Remote Checkwatches Warnings", "Remote Errors")
28
for classification in classifications:
29
# If the classification doesn't exist in the database, then add it.
30
# This is to cope with the data already in the database added by
31
# the previous mechanism using initial_data.json
33
c = orm.Classification.objects.get(title=classification)
34
except orm.Classification.DoesNotExist:
35
c = orm.Classification(title=classification)
38
def backwards(self, orm):
39
raise RuntimeError("Can not reverse this migration.")
43
'Meta': {'object_name': 'AppInstance'},
44
'id': ('django.db.models.fields.AutoField', [],
45
{'primary_key': 'True'}),
46
'title': ('django.db.models.fields.CharField', [],
47
{'unique': 'True', 'max_length': '50'})
49
'oops.classification': {
50
'Meta': {'object_name': 'Classification'},
51
'id': ('django.db.models.fields.AutoField', [],
52
{'primary_key': 'True'}),
53
'title': ('django.db.models.fields.CharField', [],
54
{'unique': 'True', 'max_length': '100'})
56
'oops.dboopsrootdirectory': {
57
'Meta': {'object_name': 'DBOopsRootDirectory'},
58
'id': ('django.db.models.fields.AutoField', [],
59
{'primary_key': 'True'}),
60
'last_date': ('django.db.models.fields.DateField', [],
62
'last_oops': ('django.db.models.fields.CharField', [],
63
{'max_length': '200', 'null': 'True'}),
64
'root_dir': ('django.db.models.fields.CharField', [],
65
{'unique': 'True', 'max_length': '200'})
68
'Meta': {'unique_together':
69
"(('exception_type', 'exception_value'),)",
70
'object_name': 'Infestation'},
71
'bug': ('django.db.models.fields.PositiveIntegerField', [],
73
'exception_type': ('django.db.models.fields.CharField', [],
74
{'max_length': '100'}),
75
'exception_value': ('django.db.models.fields.CharField', [],
76
{'max_length': '1000'}),
77
'id': ('django.db.models.fields.AutoField', [],
78
{'primary_key': 'True'}),
81
'Meta': {'object_name': 'Oops'},
82
'appinstance': ('django.db.models.fields.related.ForeignKey', [],
83
{'to': "orm['oops.AppInstance']"}),
84
'classification': ('django.db.models.fields.related.ForeignKey', [],
85
{'to': "orm['oops.Classification']", 'null': 'True'}),
86
'date': ('django.db.models.fields.DateTimeField', [],
87
{'db_index': 'True'}),
88
'duration': ('django.db.models.fields.FloatField', [],
90
'http_method': ('django.db.models.fields.CharField', [],
91
{'max_length': '10', 'null': 'True'}),
92
'id': ('django.db.models.fields.AutoField', [],
93
{'primary_key': 'True'}),
94
'informational': ('django.db.models.fields.NullBooleanField', [],
96
'is_bot': ('django.db.models.fields.NullBooleanField', [],
97
{'null': 'True', 'db_index': 'True'}),
98
'is_local_referrer': ('django.db.models.fields.NullBooleanField', [],
99
{'null': 'True', 'db_index': 'True'}),
100
'most_expensive_statement': ('django.db.models.fields.CharField', [],
101
{'max_length': '200', 'null': 'True', 'db_index': 'True'}),
102
'oopsid': ('django.db.models.fields.CharField', [],
103
{'unique': 'True', 'max_length': '200'}),
104
'oopsinfestation': ('django.db.models.fields.related.ForeignKey', [],
105
{'to': "orm['oops.Infestation']"}),
106
'pageid': ('django.db.models.fields.CharField', [],
107
{'max_length': '500'}),
108
'pathname': ('django.db.models.fields.CharField', [],
109
{'unique': 'True', 'max_length': '200'}),
110
'prefix': ('django.db.models.fields.related.ForeignKey', [],
111
{'to': "orm['oops.Prefix']"}),
112
'referrer': ('django.db.models.fields.URLField', [],
113
{'max_length': '500', 'null': 'True'}),
114
'statements_count': ('django.db.models.fields.PositiveIntegerField', [],
116
'time_is_estimate': ('django.db.models.fields.NullBooleanField', [],
118
'total_time': ('django.db.models.fields.PositiveIntegerField', [],
120
'url': ('django.db.models.fields.URLField', [],
121
{'max_length': '500', 'null': 'True', 'db_index': 'True'}),
122
'user_agent': ('django.db.models.fields.CharField', [],
123
{'max_length': '200', 'null': 'True'})
126
'Meta': {'object_name': 'Prefix'},
127
'appinstance': ('django.db.models.fields.related.ForeignKey', [],
128
{'to': "orm['oops.AppInstance']"}),
129
'id': ('django.db.models.fields.AutoField', [],
130
{'primary_key': 'True'}),
131
'value': ('django.db.models.fields.CharField', [],
132
{'unique': 'True', 'max_length': '20'})
135
'Meta': {'object_name': 'Project'},
136
'id': ('django.db.models.fields.AutoField', [],
137
{'primary_key': 'True'}),
138
'title': ('django.db.models.fields.CharField', [],
139
{'unique': 'True', 'max_length': '200'})
143
complete_apps = ['oops']