mirror of
https://github.com/DarrenOfficial/dpaste.git
synced 2024-11-15 16:12:51 +11:00
Merge pull request #70 from 747project/feature/django-1.7-migrations
Django 1.7+ migration support
This commit is contained in:
commit
9beb2c3995
8 changed files with 100 additions and 64 deletions
|
@ -1,70 +1,36 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
import datetime
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django.db import models
|
from django.db import models, migrations
|
||||||
from south.db import db
|
|
||||||
from south.v2 import SchemaMigration
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(SchemaMigration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
def forwards(self, orm):
|
dependencies = [
|
||||||
# Adding model 'Snippet'
|
]
|
||||||
db.create_table('dpaste_snippet', (
|
|
||||||
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
|
|
||||||
('secret_id', self.gf('django.db.models.fields.CharField')(max_length=255, blank=True)),
|
|
||||||
('title', self.gf('django.db.models.fields.CharField')(max_length=120, blank=True)),
|
|
||||||
('author', self.gf('django.db.models.fields.CharField')(max_length=30, blank=True)),
|
|
||||||
('content', self.gf('django.db.models.fields.TextField')()),
|
|
||||||
('content_highlighted', self.gf('django.db.models.fields.TextField')(blank=True)),
|
|
||||||
('lexer', self.gf('django.db.models.fields.CharField')(default='python', max_length=30)),
|
|
||||||
('published', self.gf('django.db.models.fields.DateTimeField')(blank=True)),
|
|
||||||
('expires', self.gf('django.db.models.fields.DateTimeField')(blank=True)),
|
|
||||||
('parent', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='children', null=True, to=orm['dpaste.Snippet'])),
|
|
||||||
('lft', self.gf('django.db.models.fields.PositiveIntegerField')(db_index=True)),
|
|
||||||
('rght', self.gf('django.db.models.fields.PositiveIntegerField')(db_index=True)),
|
|
||||||
('tree_id', self.gf('django.db.models.fields.PositiveIntegerField')(db_index=True)),
|
|
||||||
('level', self.gf('django.db.models.fields.PositiveIntegerField')(db_index=True)),
|
|
||||||
))
|
|
||||||
db.send_create_signal('dpaste', ['Snippet'])
|
|
||||||
|
|
||||||
# Adding model 'Spamword'
|
operations = [
|
||||||
db.create_table('dpaste_spamword', (
|
migrations.CreateModel(
|
||||||
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
|
name='Snippet',
|
||||||
('word', self.gf('django.db.models.fields.CharField')(max_length=100)),
|
fields=[
|
||||||
))
|
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
|
||||||
db.send_create_signal('dpaste', ['Spamword'])
|
('secret_id', models.CharField(max_length=255, unique=True, null=True, verbose_name='Secret ID', blank=True)),
|
||||||
|
('content', models.TextField(verbose_name='Content')),
|
||||||
def backwards(self, orm):
|
('lexer', models.CharField(default=b'python', max_length=30, verbose_name='Lexer')),
|
||||||
# Deleting model 'Snippet'
|
('published', models.DateTimeField(auto_now_add=True, verbose_name='Published')),
|
||||||
db.delete_table('dpaste_snippet')
|
('expire_type', models.PositiveSmallIntegerField(default=1, verbose_name='Expire Type', choices=[(1, 'Expire by timestamp'), (2, 'Keep Forever'), (3, 'One-Time snippet')])),
|
||||||
|
('expires', models.DateTimeField(null=True, verbose_name='Expires', blank=True)),
|
||||||
# Deleting model 'Spamword'
|
('view_count', models.PositiveIntegerField(default=0, verbose_name='View count')),
|
||||||
db.delete_table('dpaste_spamword')
|
('lft', models.PositiveIntegerField(editable=False, db_index=True)),
|
||||||
|
('rght', models.PositiveIntegerField(editable=False, db_index=True)),
|
||||||
models = {
|
('tree_id', models.PositiveIntegerField(editable=False, db_index=True)),
|
||||||
'dpaste.snippet': {
|
('level', models.PositiveIntegerField(editable=False, db_index=True)),
|
||||||
'Meta': {'ordering': "('-published',)", 'object_name': 'Snippet'},
|
('parent', models.ForeignKey(related_name='children', blank=True, to='dpaste.Snippet', null=True)),
|
||||||
'author': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
|
],
|
||||||
'content': ('django.db.models.fields.TextField', [], {}),
|
options={
|
||||||
'content_highlighted': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
|
'ordering': ('-published',),
|
||||||
'expires': ('django.db.models.fields.DateTimeField', [], {'blank': 'True'}),
|
'db_table': 'dpaste_snippet',
|
||||||
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
},
|
||||||
'level': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
|
bases=(models.Model,),
|
||||||
'lexer': ('django.db.models.fields.CharField', [], {'default': "'python'", 'max_length': '30'}),
|
),
|
||||||
'lft': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
|
]
|
||||||
'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': "orm['dpaste.Snippet']"}),
|
|
||||||
'published': ('django.db.models.fields.DateTimeField', [], {'blank': 'True'}),
|
|
||||||
'rght': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
|
|
||||||
'secret_id': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),
|
|
||||||
'title': ('django.db.models.fields.CharField', [], {'max_length': '120', 'blank': 'True'}),
|
|
||||||
'tree_id': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'})
|
|
||||||
},
|
|
||||||
'dpaste.spamword': {
|
|
||||||
'Meta': {'object_name': 'Spamword'},
|
|
||||||
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
|
||||||
'word': ('django.db.models.fields.CharField', [], {'max_length': '100'})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
complete_apps = ['dpaste']
|
|
||||||
|
|
70
dpaste/south_migrations/0001_initial.py
Normal file
70
dpaste/south_migrations/0001_initial.py
Normal file
|
@ -0,0 +1,70 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
import datetime
|
||||||
|
|
||||||
|
from django.db import models
|
||||||
|
from south.db import db
|
||||||
|
from south.v2 import SchemaMigration
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(SchemaMigration):
|
||||||
|
|
||||||
|
def forwards(self, orm):
|
||||||
|
# Adding model 'Snippet'
|
||||||
|
db.create_table('dpaste_snippet', (
|
||||||
|
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
|
||||||
|
('secret_id', self.gf('django.db.models.fields.CharField')(max_length=255, blank=True)),
|
||||||
|
('title', self.gf('django.db.models.fields.CharField')(max_length=120, blank=True)),
|
||||||
|
('author', self.gf('django.db.models.fields.CharField')(max_length=30, blank=True)),
|
||||||
|
('content', self.gf('django.db.models.fields.TextField')()),
|
||||||
|
('content_highlighted', self.gf('django.db.models.fields.TextField')(blank=True)),
|
||||||
|
('lexer', self.gf('django.db.models.fields.CharField')(default='python', max_length=30)),
|
||||||
|
('published', self.gf('django.db.models.fields.DateTimeField')(blank=True)),
|
||||||
|
('expires', self.gf('django.db.models.fields.DateTimeField')(blank=True)),
|
||||||
|
('parent', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='children', null=True, to=orm['dpaste.Snippet'])),
|
||||||
|
('lft', self.gf('django.db.models.fields.PositiveIntegerField')(db_index=True)),
|
||||||
|
('rght', self.gf('django.db.models.fields.PositiveIntegerField')(db_index=True)),
|
||||||
|
('tree_id', self.gf('django.db.models.fields.PositiveIntegerField')(db_index=True)),
|
||||||
|
('level', self.gf('django.db.models.fields.PositiveIntegerField')(db_index=True)),
|
||||||
|
))
|
||||||
|
db.send_create_signal('dpaste', ['Snippet'])
|
||||||
|
|
||||||
|
# Adding model 'Spamword'
|
||||||
|
db.create_table('dpaste_spamword', (
|
||||||
|
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
|
||||||
|
('word', self.gf('django.db.models.fields.CharField')(max_length=100)),
|
||||||
|
))
|
||||||
|
db.send_create_signal('dpaste', ['Spamword'])
|
||||||
|
|
||||||
|
def backwards(self, orm):
|
||||||
|
# Deleting model 'Snippet'
|
||||||
|
db.delete_table('dpaste_snippet')
|
||||||
|
|
||||||
|
# Deleting model 'Spamword'
|
||||||
|
db.delete_table('dpaste_spamword')
|
||||||
|
|
||||||
|
models = {
|
||||||
|
'dpaste.snippet': {
|
||||||
|
'Meta': {'ordering': "('-published',)", 'object_name': 'Snippet'},
|
||||||
|
'author': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
|
||||||
|
'content': ('django.db.models.fields.TextField', [], {}),
|
||||||
|
'content_highlighted': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
|
||||||
|
'expires': ('django.db.models.fields.DateTimeField', [], {'blank': 'True'}),
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'level': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
|
||||||
|
'lexer': ('django.db.models.fields.CharField', [], {'default': "'python'", 'max_length': '30'}),
|
||||||
|
'lft': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
|
||||||
|
'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': "orm['dpaste.Snippet']"}),
|
||||||
|
'published': ('django.db.models.fields.DateTimeField', [], {'blank': 'True'}),
|
||||||
|
'rght': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
|
||||||
|
'secret_id': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),
|
||||||
|
'title': ('django.db.models.fields.CharField', [], {'max_length': '120', 'blank': 'True'}),
|
||||||
|
'tree_id': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'})
|
||||||
|
},
|
||||||
|
'dpaste.spamword': {
|
||||||
|
'Meta': {'object_name': 'Spamword'},
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'word': ('django.db.models.fields.CharField', [], {'max_length': '100'})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
complete_apps = ['dpaste']
|
0
dpaste/south_migrations/__init__.py
Normal file
0
dpaste/south_migrations/__init__.py
Normal file
Loading…
Reference in a new issue