/command/migrations/0002_auto__add_cprsession__del_field_command_equipment__add_field_command_v.py
https://github.com/flavioinnovatech/itrack · Python · 154 lines · 134 code · 13 blank · 7 comment · 0 complexity · ca3d6778a03b959e5359ce2db67f345a MD5 · raw file
- # encoding: 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 'CPRSession'
- db.create_table('command_cprsession', (
- ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
- ('key', self.gf('django.db.models.fields.CharField')(max_length=50)),
- ('time', self.gf('django.db.models.fields.DateTimeField')()),
- ))
- db.send_create_signal('command', ['CPRSession'])
- # Deleting field 'Command.equipment'
- db.delete_column('command_command', 'equipment_id')
- # Adding field 'Command.vehicle'
- db.add_column('command_command', 'vehicle', self.gf('django.db.models.fields.related.ForeignKey')(default=1, to=orm['vehicles.Vehicle']), keep_default=False)
- def backwards(self, orm):
-
- # Deleting model 'CPRSession'
- db.delete_table('command_cprsession')
- # User chose to not deal with backwards NULL issues for 'Command.equipment'
- raise RuntimeError("Cannot reverse this migration. 'Command.equipment' and its values cannot be restored.")
- # Deleting field 'Command.vehicle'
- db.delete_column('command_command', 'vehicle_id')
- models = {
- 'auth.group': {
- 'Meta': {'object_name': 'Group'},
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
- 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
- },
- 'auth.permission': {
- 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
- 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
- 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
- },
- 'auth.user': {
- 'Meta': {'object_name': 'User'},
- 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
- 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
- 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
- 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
- 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
- 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
- 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
- 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
- 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
- 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
- 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
- },
- 'command.command': {
- 'Meta': {'object_name': 'Command'},
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'state': ('django.db.models.fields.CharField', [], {'max_length': '50'}),
- 'system': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['system.System']"}),
- 'time_executed': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
- 'time_received': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
- 'time_sent': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
- 'type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['equipments.CustomFieldName']", 'null': 'True'}),
- 'vehicle': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['vehicles.Vehicle']"})
- },
- 'command.cprsession': {
- 'Meta': {'object_name': 'CPRSession'},
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'key': ('django.db.models.fields.CharField', [], {'max_length': '50'}),
- 'time': ('django.db.models.fields.DateTimeField', [], {})
- },
- 'contenttypes.contenttype': {
- 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
- 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
- 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
- },
- 'equipments.customfield': {
- 'Meta': {'object_name': 'CustomField'},
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'name': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
- 'system': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['system.System']", 'symmetrical': 'False'}),
- 'table': ('django.db.models.fields.IntegerField', [], {}),
- 'tag': ('django.db.models.fields.CharField', [], {'default': "'tag'", 'max_length': '50'}),
- 'type': ('django.db.models.fields.CharField', [], {'max_length': '50'})
- },
- 'equipments.customfieldname': {
- 'Meta': {'object_name': 'CustomFieldName'},
- 'custom_field': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['equipments.CustomField']"}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}),
- 'system': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['system.System']"})
- },
- 'equipments.equipment': {
- 'Meta': {'object_name': 'Equipment'},
- 'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'name': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
- 'serial': ('django.db.models.fields.CharField', [], {'default': "'000017E8'", 'max_length': '50', 'unique': 'True', 'null': 'True'}),
- 'system': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['system.System']", 'symmetrical': 'False'}),
- 'type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['equipments.EquipmentType']"})
- },
- 'equipments.equipmenttype': {
- 'Meta': {'object_name': 'EquipmentType'},
- 'custom_field': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['equipments.CustomField']", 'symmetrical': 'False'}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'manufacturer': ('django.db.models.fields.CharField', [], {'default': "'Quanta'", 'max_length': '40'}),
- 'name': ('django.db.models.fields.CharField', [], {'max_length': '200'})
- },
- 'sites.site': {
- 'Meta': {'ordering': "('domain',)", 'object_name': 'Site', 'db_table': "'django_site'"},
- 'domain': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
- },
- 'system.system': {
- 'Meta': {'ordering': "('domain',)", 'object_name': 'System', '_ormbases': ['sites.Site']},
- 'administrator': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'usuarios'", 'to': "orm['auth.User']"}),
- 'parent': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['system.System']", 'null': 'True', 'blank': 'True'}),
- 'site_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['sites.Site']", 'unique': 'True', 'primary_key': 'True'}),
- 'users': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'})
- },
- 'vehicles.vehicle': {
- 'Meta': {'object_name': 'Vehicle'},
- 'chassi': ('django.db.models.fields.CharField', [], {'max_length': '30'}),
- 'color': ('django.db.models.fields.CharField', [], {'max_length': '20'}),
- 'equipment': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['equipments.Equipment']", 'unique': 'True', 'null': 'True', 'blank': 'True'}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'last_alert_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
- 'license_plate': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '10'}),
- 'manufacturer': ('django.db.models.fields.CharField', [], {'max_length': '30'}),
- 'model': ('django.db.models.fields.CharField', [], {'max_length': '30'}),
- 'system': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['system.System']", 'null': 'True', 'symmetrical': 'False'}),
- 'threshold_time': ('django.db.models.fields.FloatField', [], {'default': '5'}),
- 'type': ('django.db.models.fields.CharField', [], {'max_length': '30'}),
- 'year': ('django.db.models.fields.CharField', [], {'max_length': '30'})
- }
- }
- complete_apps = ['command']