forked from 0x2620/pandora
add south migrations, convert update to python
This commit is contained in:
parent
dc1bd6bccd
commit
2c07dedac0
46 changed files with 2729 additions and 48 deletions
21
pandora/app/management/commands/south_installed.py
Normal file
21
pandora/app/management/commands/south_installed.py
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vi:si:et:sw=4:sts=4:ts=4
|
||||
from django.core.management.base import BaseCommand
|
||||
from django.db import connection, transaction
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
"""
|
||||
"""
|
||||
help = 'check if south migrations are initialized'
|
||||
args = ''
|
||||
|
||||
def handle(self, **options):
|
||||
try:
|
||||
import south.models
|
||||
table_name = south.models.MigrationHistory._meta.db_table
|
||||
cursor = connection.cursor()
|
||||
db_rows = connection.introspection.get_table_description(cursor, table_name)
|
||||
print "yes"
|
||||
except:
|
||||
print "no"
|
||||
38
pandora/app/migrations/0001_initial.py
Normal file
38
pandora/app/migrations/0001_initial.py
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
import datetime
|
||||
from south.db import db
|
||||
from south.v2 import SchemaMigration
|
||||
from django.db import models
|
||||
|
||||
|
||||
class Migration(SchemaMigration):
|
||||
|
||||
def forwards(self, orm):
|
||||
# Adding model 'Page'
|
||||
db.create_table('app_page', (
|
||||
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
|
||||
('created', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)),
|
||||
('modified', self.gf('django.db.models.fields.DateTimeField')(auto_now=True, blank=True)),
|
||||
('name', self.gf('django.db.models.fields.CharField')(unique=True, max_length=1024)),
|
||||
('text', self.gf('django.db.models.fields.TextField')(blank=True)),
|
||||
))
|
||||
db.send_create_signal('app', ['Page'])
|
||||
|
||||
|
||||
def backwards(self, orm):
|
||||
# Deleting model 'Page'
|
||||
db.delete_table('app_page')
|
||||
|
||||
|
||||
models = {
|
||||
'app.page': {
|
||||
'Meta': {'object_name': 'Page'},
|
||||
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
||||
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
|
||||
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '1024'}),
|
||||
'text': ('django.db.models.fields.TextField', [], {'blank': 'True'})
|
||||
}
|
||||
}
|
||||
|
||||
complete_apps = ['app']
|
||||
0
pandora/app/migrations/__init__.py
Normal file
0
pandora/app/migrations/__init__.py
Normal file
Loading…
Add table
Add a link
Reference in a new issue