~lifeless/python-oops-tools/bug-881400

« back to all changes in this revision

Viewing changes to src/oopstools/oops/migrations/0002_initial.py

  • Committer: Robert Collins
  • Date: 2011-10-13 20:18:51 UTC
  • Revision ID: robertc@robertcollins.net-20111013201851-ym8jmdhoeol3p83s
Export of cruft-deleted tree.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright 2005-2011 Canonical Ltd.  All rights reserved.
 
2
#
 
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.
 
7
#
 
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.
 
12
#
 
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/>.
 
15
 
 
16
# encoding: utf-8
 
17
import datetime
 
18
from south.db import db
 
19
from south.v2 import SchemaMigration
 
20
from django.db import models
 
21
 
 
22
class Migration(SchemaMigration):
 
23
 
 
24
    def forwards(self, orm):
 
25
 
 
26
        # Adding model 'AppInstance'
 
27
        db.create_table('oops_appinstance', (
 
28
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
 
29
            ('title', self.gf('django.db.models.fields.CharField')(unique=True, max_length=50)),
 
30
        ))
 
31
        db.send_create_signal('oops', ['AppInstance'])
 
32
 
 
33
        # Adding model 'Prefix'
 
34
        db.create_table('oops_prefix', (
 
35
            ('appinstance', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['oops.AppInstance'])),
 
36
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
 
37
            ('value', self.gf('django.db.models.fields.CharField')(unique=True, max_length=20)),
 
38
        ))
 
39
        db.send_create_signal('oops', ['Prefix'])
 
40
 
 
41
        # Adding model 'Infestation'
 
42
        db.create_table('oops_infestation', (
 
43
            ('exception_type', self.gf('django.db.models.fields.CharField')(max_length=100)),
 
44
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
 
45
            ('exception_value', self.gf('django.db.models.fields.CharField')(max_length=1000)),
 
46
            ('bug', self.gf('django.db.models.fields.PositiveIntegerField')(null=True)),
 
47
        ))
 
48
        db.send_create_signal('oops', ['Infestation'])
 
49
 
 
50
        # Adding unique constraint on 'Infestation', fields ['exception_type', 'exception_value']
 
51
        db.create_unique('oops_infestation', ['exception_type', 'exception_value'])
 
52
 
 
53
        # Adding model 'Classification'
 
54
        db.create_table('oops_classification', (
 
55
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
 
56
            ('title', self.gf('django.db.models.fields.CharField')(unique=True, max_length=100)),
 
57
        ))
 
58
        db.send_create_signal('oops', ['Classification'])
 
59
 
 
60
        # Adding model 'DBOopsRootDirectory'
 
61
        db.create_table('oops_dboopsrootdirectory', (
 
62
            ('last_date', self.gf('django.db.models.fields.DateField')(null=True)),
 
63
            ('last_oops', self.gf('django.db.models.fields.CharField')(max_length=200, null=True)),
 
64
            ('root_dir', self.gf('django.db.models.fields.CharField')(unique=True, max_length=200)),
 
65
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
 
66
        ))
 
67
        db.send_create_signal('oops', ['DBOopsRootDirectory'])
 
68
 
 
69
        # Adding model 'Oops'
 
70
        db.create_table('oops_oops', (
 
71
            ('classification', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['oops.Classification'], null=True)),
 
72
            ('oopsid', self.gf('django.db.models.fields.CharField')(unique=True, max_length=200)),
 
73
            ('prefix', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['oops.Prefix'])),
 
74
            ('time_is_estimate', self.gf('django.db.models.fields.NullBooleanField')(null=True)),
 
75
            ('duration', self.gf('django.db.models.fields.FloatField')(null=True)),
 
76
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
 
77
            ('oopsinfestation', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['oops.Infestation'])),
 
78
            ('statements_count', self.gf('django.db.models.fields.PositiveIntegerField')()),
 
79
            ('appinstance', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['oops.AppInstance'])),
 
80
            ('pageid', self.gf('django.db.models.fields.CharField')(max_length=500)),
 
81
            ('most_expensive_statement', self.gf('django.db.models.fields.CharField')(max_length=200, null=True, db_index=True)),
 
82
            ('is_bot', self.gf('django.db.models.fields.NullBooleanField')(null=True, db_index=True)),
 
83
            ('is_local_referrer', self.gf('django.db.models.fields.NullBooleanField')(null=True, db_index=True)),
 
84
            ('total_time', self.gf('django.db.models.fields.PositiveIntegerField')()),
 
85
            ('date', self.gf('django.db.models.fields.DateTimeField')(db_index=True)),
 
86
            ('url', self.gf('django.db.models.fields.URLField')(max_length=500, null=True, db_index=True)),
 
87
            ('referrer', self.gf('django.db.models.fields.URLField')(max_length=500, null=True)),
 
88
            ('http_method', self.gf('django.db.models.fields.CharField')(max_length=10, null=True)),
 
89
            ('pathname', self.gf('django.db.models.fields.CharField')(unique=True, max_length=200)),
 
90
            ('user_agent', self.gf('django.db.models.fields.CharField')(max_length=200, null=True)),
 
91
            ('informational', self.gf('django.db.models.fields.NullBooleanField')(null=True)),
 
92
        ))
 
93
        db.send_create_signal('oops', ['Oops'])
 
94
 
 
95
 
 
96
    def backwards(self, orm):
 
97
 
 
98
        # Deleting model 'AppInstance'
 
99
        db.delete_table('oops_appinstance')
 
100
 
 
101
        # Deleting model 'Prefix'
 
102
        db.delete_table('oops_prefix')
 
103
 
 
104
        # Deleting model 'Infestation'
 
105
        db.delete_table('oops_infestation')
 
106
 
 
107
        # Removing unique constraint on 'Infestation', fields ['exception_type', 'exception_value']
 
108
        db.delete_unique('oops_infestation', ['exception_type', 'exception_value'])
 
109
 
 
110
        # Deleting model 'Classification'
 
111
        db.delete_table('oops_classification')
 
112
 
 
113
        # Deleting model 'DBOopsRootDirectory'
 
114
        db.delete_table('oops_dboopsrootdirectory')
 
115
 
 
116
        # Deleting model 'Oops'
 
117
        db.delete_table('oops_oops')
 
118
 
 
119
 
 
120
    models = {
 
121
        'oops.appinstance': {
 
122
            'Meta': {'object_name': 'AppInstance'},
 
123
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
 
124
            'title': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '50'})
 
125
        },
 
126
        'oops.classification': {
 
127
            'Meta': {'object_name': 'Classification'},
 
128
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
 
129
            'title': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'})
 
130
        },
 
131
        'oops.dboopsrootdirectory': {
 
132
            'Meta': {'object_name': 'DBOopsRootDirectory'},
 
133
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
 
134
            'last_date': ('django.db.models.fields.DateField', [], {'null': 'True'}),
 
135
            'last_oops': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True'}),
 
136
            'root_dir': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '200'})
 
137
        },
 
138
        'oops.infestation': {
 
139
            'Meta': {'unique_together': "(('exception_type', 'exception_value'),)", 'object_name': 'Infestation'},
 
140
            'bug': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True'}),
 
141
            'exception_type': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
 
142
            'exception_value': ('django.db.models.fields.CharField', [], {'max_length': '1000'}),
 
143
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
 
144
        },
 
145
        'oops.oops': {
 
146
            'Meta': {'object_name': 'Oops'},
 
147
            'appinstance': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['oops.AppInstance']"}),
 
148
            'classification': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['oops.Classification']", 'null': 'True'}),
 
149
            'date': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True'}),
 
150
            'duration': ('django.db.models.fields.FloatField', [], {'null': 'True'}),
 
151
            'http_method': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True'}),
 
152
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
 
153
            'informational': ('django.db.models.fields.NullBooleanField', [], {'null': 'True'}),
 
154
            'is_bot': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'db_index': 'True'}),
 
155
            'is_local_referrer': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'db_index': 'True'}),
 
156
            'most_expensive_statement': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'db_index': 'True'}),
 
157
            'oopsid': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '200'}),
 
158
            'oopsinfestation': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['oops.Infestation']"}),
 
159
            'pageid': ('django.db.models.fields.CharField', [], {'max_length': '500'}),
 
160
            'pathname': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '200'}),
 
161
            'prefix': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['oops.Prefix']"}),
 
162
            'referrer': ('django.db.models.fields.URLField', [], {'max_length': '500', 'null': 'True'}),
 
163
            'statements_count': ('django.db.models.fields.PositiveIntegerField', [], {}),
 
164
            'time_is_estimate': ('django.db.models.fields.NullBooleanField', [], {'null': 'True'}),
 
165
            'total_time': ('django.db.models.fields.PositiveIntegerField', [], {}),
 
166
            'url': ('django.db.models.fields.URLField', [], {'max_length': '500', 'null': 'True', 'db_index': 'True'}),
 
167
            'user_agent': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True'})
 
168
        },
 
169
        'oops.prefix': {
 
170
            'Meta': {'object_name': 'Prefix'},
 
171
            'appinstance': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['oops.AppInstance']"}),
 
172
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
 
173
            'value': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '20'})
 
174
        },
 
175
    }
 
176
 
 
177
    complete_apps = ['oops']