/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

  1. # encoding: utf-8
  2. import datetime
  3. from south.db import db
  4. from south.v2 import SchemaMigration
  5. from django.db import models
  6. class Migration(SchemaMigration):
  7. def forwards(self, orm):
  8. # Adding model 'CPRSession'
  9. db.create_table('command_cprsession', (
  10. ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
  11. ('key', self.gf('django.db.models.fields.CharField')(max_length=50)),
  12. ('time', self.gf('django.db.models.fields.DateTimeField')()),
  13. ))
  14. db.send_create_signal('command', ['CPRSession'])
  15. # Deleting field 'Command.equipment'
  16. db.delete_column('command_command', 'equipment_id')
  17. # Adding field 'Command.vehicle'
  18. db.add_column('command_command', 'vehicle', self.gf('django.db.models.fields.related.ForeignKey')(default=1, to=orm['vehicles.Vehicle']), keep_default=False)
  19. def backwards(self, orm):
  20. # Deleting model 'CPRSession'
  21. db.delete_table('command_cprsession')
  22. # User chose to not deal with backwards NULL issues for 'Command.equipment'
  23. raise RuntimeError("Cannot reverse this migration. 'Command.equipment' and its values cannot be restored.")
  24. # Deleting field 'Command.vehicle'
  25. db.delete_column('command_command', 'vehicle_id')
  26. models = {
  27. 'auth.group': {
  28. 'Meta': {'object_name': 'Group'},
  29. 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
  30. 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
  31. 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
  32. },
  33. 'auth.permission': {
  34. 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
  35. 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
  36. 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
  37. 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
  38. 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
  39. },
  40. 'auth.user': {
  41. 'Meta': {'object_name': 'User'},
  42. 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
  43. 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
  44. 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
  45. 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
  46. 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
  47. 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
  48. 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
  49. 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
  50. 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
  51. 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
  52. 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
  53. 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
  54. 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
  55. },
  56. 'command.command': {
  57. 'Meta': {'object_name': 'Command'},
  58. 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
  59. 'state': ('django.db.models.fields.CharField', [], {'max_length': '50'}),
  60. 'system': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['system.System']"}),
  61. 'time_executed': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
  62. 'time_received': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
  63. 'time_sent': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
  64. 'type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['equipments.CustomFieldName']", 'null': 'True'}),
  65. 'vehicle': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['vehicles.Vehicle']"})
  66. },
  67. 'command.cprsession': {
  68. 'Meta': {'object_name': 'CPRSession'},
  69. 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
  70. 'key': ('django.db.models.fields.CharField', [], {'max_length': '50'}),
  71. 'time': ('django.db.models.fields.DateTimeField', [], {})
  72. },
  73. 'contenttypes.contenttype': {
  74. 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
  75. 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
  76. 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
  77. 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
  78. 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
  79. },
  80. 'equipments.customfield': {
  81. 'Meta': {'object_name': 'CustomField'},
  82. 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
  83. 'name': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
  84. 'system': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['system.System']", 'symmetrical': 'False'}),
  85. 'table': ('django.db.models.fields.IntegerField', [], {}),
  86. 'tag': ('django.db.models.fields.CharField', [], {'default': "'tag'", 'max_length': '50'}),
  87. 'type': ('django.db.models.fields.CharField', [], {'max_length': '50'})
  88. },
  89. 'equipments.customfieldname': {
  90. 'Meta': {'object_name': 'CustomFieldName'},
  91. 'custom_field': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['equipments.CustomField']"}),
  92. 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
  93. 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}),
  94. 'system': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['system.System']"})
  95. },
  96. 'equipments.equipment': {
  97. 'Meta': {'object_name': 'Equipment'},
  98. 'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
  99. 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
  100. 'name': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
  101. 'serial': ('django.db.models.fields.CharField', [], {'default': "'000017E8'", 'max_length': '50', 'unique': 'True', 'null': 'True'}),
  102. 'system': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['system.System']", 'symmetrical': 'False'}),
  103. 'type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['equipments.EquipmentType']"})
  104. },
  105. 'equipments.equipmenttype': {
  106. 'Meta': {'object_name': 'EquipmentType'},
  107. 'custom_field': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['equipments.CustomField']", 'symmetrical': 'False'}),
  108. 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
  109. 'manufacturer': ('django.db.models.fields.CharField', [], {'default': "'Quanta'", 'max_length': '40'}),
  110. 'name': ('django.db.models.fields.CharField', [], {'max_length': '200'})
  111. },
  112. 'sites.site': {
  113. 'Meta': {'ordering': "('domain',)", 'object_name': 'Site', 'db_table': "'django_site'"},
  114. 'domain': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
  115. 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
  116. 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
  117. },
  118. 'system.system': {
  119. 'Meta': {'ordering': "('domain',)", 'object_name': 'System', '_ormbases': ['sites.Site']},
  120. 'administrator': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'usuarios'", 'to': "orm['auth.User']"}),
  121. 'parent': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['system.System']", 'null': 'True', 'blank': 'True'}),
  122. 'site_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['sites.Site']", 'unique': 'True', 'primary_key': 'True'}),
  123. 'users': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'})
  124. },
  125. 'vehicles.vehicle': {
  126. 'Meta': {'object_name': 'Vehicle'},
  127. 'chassi': ('django.db.models.fields.CharField', [], {'max_length': '30'}),
  128. 'color': ('django.db.models.fields.CharField', [], {'max_length': '20'}),
  129. 'equipment': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['equipments.Equipment']", 'unique': 'True', 'null': 'True', 'blank': 'True'}),
  130. 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
  131. 'last_alert_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
  132. 'license_plate': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '10'}),
  133. 'manufacturer': ('django.db.models.fields.CharField', [], {'max_length': '30'}),
  134. 'model': ('django.db.models.fields.CharField', [], {'max_length': '30'}),
  135. 'system': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['system.System']", 'null': 'True', 'symmetrical': 'False'}),
  136. 'threshold_time': ('django.db.models.fields.FloatField', [], {'default': '5'}),
  137. 'type': ('django.db.models.fields.CharField', [], {'max_length': '30'}),
  138. 'year': ('django.db.models.fields.CharField', [], {'max_length': '30'})
  139. }
  140. }
  141. complete_apps = ['command']