Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Add South migration.

  • Loading branch information...
commit c5cb1d171f1b1b24f661426bd3c005e0cc2de38e 1 parent f6da3a8
authored October 31, 2012
67  csp/migrations/0001_initial.py
... ...
@@ -0,0 +1,67 @@
  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 'Group'
  12
+        db.create_table('csp_group', (
  13
+            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
  14
+            ('name', self.gf('django.db.models.fields.CharField')(max_length=200)),
  15
+            ('identifier', self.gf('django.db.models.fields.CharField')(unique=True, max_length=40)),
  16
+        ))
  17
+        db.send_create_signal('csp', ['Group'])
  18
+
  19
+        # Adding model 'Report'
  20
+        db.create_table('csp_report', (
  21
+            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
  22
+            ('group', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['csp.Group'], null=True, blank=True)),
  23
+            ('document_uri', self.gf('django.db.models.fields.URLField')(max_length=400, db_index=True)),
  24
+            ('blocked_uri', self.gf('django.db.models.fields.CharField')(db_index=True, max_length=400, null=True, blank=True)),
  25
+            ('referrer', self.gf('django.db.models.fields.URLField')(max_length=400, null=True, blank=True)),
  26
+            ('violated_directive', self.gf('django.db.models.fields.CharField')(db_index=True, max_length=1000, null=True, blank=True)),
  27
+            ('original_policy', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
  28
+            ('source_file', self.gf('django.db.models.fields.CharField')(max_length=400, null=True, blank=True)),
  29
+            ('line_number', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True)),
  30
+            ('script_sample', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
  31
+            ('reported', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime.now, db_index=True)),
  32
+        ))
  33
+        db.send_create_signal('csp', ['Report'])
  34
+
  35
+
  36
+    def backwards(self, orm):
  37
+        # Deleting model 'Group'
  38
+        db.delete_table('csp_group')
  39
+
  40
+        # Deleting model 'Report'
  41
+        db.delete_table('csp_report')
  42
+
  43
+
  44
+    models = {
  45
+        'csp.group': {
  46
+            'Meta': {'object_name': 'Group'},
  47
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
  48
+            'identifier': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '40'}),
  49
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '200'})
  50
+        },
  51
+        'csp.report': {
  52
+            'Meta': {'object_name': 'Report'},
  53
+            'blocked_uri': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '400', 'null': 'True', 'blank': 'True'}),
  54
+            'document_uri': ('django.db.models.fields.URLField', [], {'max_length': '400', 'db_index': 'True'}),
  55
+            'group': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['csp.Group']", 'null': 'True', 'blank': 'True'}),
  56
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
  57
+            'line_number': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
  58
+            'original_policy': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
  59
+            'referrer': ('django.db.models.fields.URLField', [], {'max_length': '400', 'null': 'True', 'blank': 'True'}),
  60
+            'reported': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'db_index': 'True'}),
  61
+            'script_sample': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
  62
+            'source_file': ('django.db.models.fields.CharField', [], {'max_length': '400', 'null': 'True', 'blank': 'True'}),
  63
+            'violated_directive': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '1000', 'null': 'True', 'blank': 'True'})
  64
+        }
  65
+    }
  66
+
  67
+    complete_apps = ['csp']
0  csp/migrations/__init__.py
No changes.
6  docs/installation.rst
Source Rendered
@@ -40,7 +40,13 @@ And finally include the urlconf::
40 40
         # ...
41 41
     )
42 42
 
  43
+If you're using the default report processor, you'll need to run
  44
+``syncdb`` or ``migrate``, if you're using South_, or else create the
  45
+database tables another way.
  46
+
43 47
 That should do it! Go on to `configuring CSP <configuration-chapter>`_.
44 48
 
45 49
 .. [#] Strictly speaking, ``csp`` only needs to be in your installed apps
46 50
    if you plan to use the built-in report feature.
  51
+
  52
+.. _South: http://south.aeracode.org/

0 notes on commit c5cb1d1

Please sign in to comment.
Something went wrong with that request. Please try again.