Commit 47017037 authored by Sergios Aftsidis's avatar Sergios Aftsidis

Update migrations to exclude non-django managed db tables

parent 16c0b790
......@@ -3,34 +3,38 @@ import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
from django.conf import settings
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'PeerRange'
db.create_table(u'peer_range', (
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('network', self.gf('django.db.models.fields.CharField')(max_length=128)),
))
db.send_create_signal('peers', ['PeerRange'])
if settings.PEER_RANGE_MANAGED_TABLE:
db.create_table(u'peer_range', (
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('network', self.gf('django.db.models.fields.CharField')(max_length=128)),
))
db.send_create_signal('peers', ['PeerRange'])
# Adding model 'TechcEmail'
db.create_table('techc_email', (
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('email', self.gf('django.db.models.fields.CharField')(max_length=352, db_column='email')),
))
db.send_create_signal('peers', ['TechcEmail'])
if settings.PEER_TECHC_MANAGED_TABLE:
db.create_table('techc_email', (
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('email', self.gf('django.db.models.fields.CharField')(max_length=352, db_column='email')),
))
db.send_create_signal('peers', ['TechcEmail'])
# Adding model 'Peer'
db.create_table(u'peer', (
('peer_id', self.gf('django.db.models.fields.IntegerField')(primary_key=True)),
('peer_name', self.gf('django.db.models.fields.CharField')(max_length=128)),
('peer_as', self.gf('django.db.models.fields.IntegerField')()),
('peer_tag', self.gf('django.db.models.fields.CharField')(max_length=64)),
('domain_name', self.gf('django.db.models.fields.CharField')(max_length=128, null=True, blank=True)),
))
db.send_create_signal('peers', ['Peer'])
if settings.PEER_MANAGED_TABLE:
db.create_table(u'peer', (
('peer_id', self.gf('django.db.models.fields.IntegerField')(primary_key=True)),
('peer_name', self.gf('django.db.models.fields.CharField')(max_length=128)),
('peer_as', self.gf('django.db.models.fields.IntegerField')()),
('peer_tag', self.gf('django.db.models.fields.CharField')(max_length=64)),
('domain_name', self.gf('django.db.models.fields.CharField')(max_length=128, null=True, blank=True)),
))
db.send_create_signal('peers', ['Peer'])
# Adding M2M table for field networks on 'Peer'
db.create_table(u'peer_networks', (
......@@ -48,16 +52,18 @@ class Migration(SchemaMigration):
))
db.create_unique(u'peer_techc_emails', ['peer_id', 'techcemail_id'])
def backwards(self, orm):
# Deleting model 'PeerRange'
db.delete_table(u'peer_range')
if settings.PEER_RANGE_MANAGED_TABLE:
db.delete_table(u'peer_range')
# Deleting model 'TechcEmail'
db.delete_table('techc_email')
if settings.PEER_TECHC_MANAGED_TABLE:
db.delete_table('techc_email')
# Deleting model 'Peer'
db.delete_table(u'peer')
if settings.PEER_MANAGED_TABLE:
db.delete_table(u'peer')
# Removing M2M table for field networks on 'Peer'
db.delete_table('peer_networks')
......@@ -65,7 +71,6 @@ class Migration(SchemaMigration):
# Removing M2M table for field techc_emails on 'Peer'
db.delete_table('peer_techc_emails')
models = {
'peers.peer': {
'Meta': {'ordering': "['peer_name']", 'object_name': 'Peer', 'db_table': "u'peer'"},
......@@ -89,4 +94,4 @@ class Migration(SchemaMigration):
}
}
complete_apps = ['peers']
\ No newline at end of file
complete_apps = ['peers']
......@@ -3,6 +3,7 @@ import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
from django.conf import settings
# Probably due to a MySQL bug, the AutoField is not created properly and raises a
......@@ -21,12 +22,14 @@ class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'Peer.peer_id'
db.alter_column(u'peer', 'peer_id', self.gf('django.db.models.fields.AutoField')(primary_key=True))
if settings.PEER_MANAGED_TABLE:
db.alter_column(u'peer', 'peer_id', self.gf('django.db.models.fields.AutoField')(primary_key=True))
def backwards(self, orm):
# Changing field 'Peer.peer_id'
db.alter_column(u'peer', 'peer_id', self.gf('django.db.models.fields.IntegerField')(primary_key=True))
if settings.PEER_MANAGED_TABLE:
db.alter_column(u'peer', 'peer_id', self.gf('django.db.models.fields.IntegerField')(primary_key=True))
models = {
'peers.peer': {
......
......@@ -3,12 +3,15 @@ import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
from django.conf import settings
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'PeerNotify'
db.create_table('peers_peernotify', (
('peer', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['peers.Peer'])),
('peer_activation_notified', self.gf('django.db.models.fields.BooleanField')(default=True, blank=True)),
......@@ -17,19 +20,19 @@ class Migration(SchemaMigration):
))
db.send_create_signal('peers', ['PeerNotify'])
# Changing field 'Peer.peer_as'
db.alter_column(u'peer', 'peer_as', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True))
if settings.PEER_MANAGED_TABLE:
# Changing field 'Peer.peer_as'
db.alter_column(u'peer', 'peer_as', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True))
def backwards(self, orm):
# Deleting model 'PeerNotify'
db.delete_table('peers_peernotify')
# Changing field 'Peer.peer_as'
db.alter_column(u'peer', 'peer_as', self.gf('django.db.models.fields.IntegerField')())
if settings.PEER_MANAGED_TABLE:
# Changing field 'Peer.peer_as'
db.alter_column(u'peer', 'peer_as', self.gf('django.db.models.fields.IntegerField')())
models = {
'auth.group': {
'Meta': {'object_name': 'Group'},
......@@ -95,5 +98,5 @@ class Migration(SchemaMigration):
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
}
}
complete_apps = ['peers']
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment