def migrate_project(self, table): r = db.execute(""" SELECT COUNT(*) FROM %s WHERE project IS NOT NULL AND project != ''""" % table)[0][0] if r: # Create custom field db.execute( """ INSERT INTO main_customfield("table", name, is_active, label, "type", max_length, is_indexed) VALUES(%s, 'project', TRUE, 'Project', 'str', 256, TRUE) """, [table]) # Move data db.execute(""" ALTER TABLE %s RENAME project TO cust_project """ % table) else: # Drop column db.drop_column(table, "project")
def forwards(self): c = get_db()["noc.sync"] smap = {} # name -> id for d in c.find(): smap[d["name"]] = str(d["_id"]) # Create .sync db.execute("ALTER TABLE dns_dnsserver ADD sync CHAR(24)") for i, ch in db.execute( "SELECT id, sync_channel FROM dns_dnsserver WHERE sync_channel IS NOT NULL" ): if ch not in smap: n = c.insert({ "name": ch, "is_active": True, "description": "Converted from DNS Server settings" }) smap[ch] = str(n) print smap db.execute("UPDATE dns_dnsserver SET sync=%s WHERE id=%s", [smap[ch], i]) db.drop_column("dns_dnsserver", "sync_channel")
def forwards(self, orm): # Changing field 'TestUser.facebook_id' db.drop_column('facetools_testuser', 'facebook_id') db.add_column('facetools_testuser', 'facebook_id', self.gf('django.db.models.fields.BigIntegerField')(null=True))
def forwards(self): db.drop_column("vc_vc", "type_id") db.execute("ALTER TABLE vc_vcdomain ALTER COLUMN type_id SET NOT NULL")
def backwards(self): db.drop_column("vc_vc", "project_id")
def backwards(self): for t in ["peer_asset"]: db.drop_column(t, "project_id")
def backwards(self): db.drop_column("sa_objectnotification", "alarm_reopened")
def backwards(self): db.drop_column("vc_vcdomainprovisioningconfig", "vc_filter")
def forwards(self, orm): # Adding field 'User.institution' db.drop_column('auth_user', 'institution_id') db.add_column('auth_user', 'institution', self.gf('django.db.models.fields.related.ForeignKey')(default=1, to=orm['neuroelectro.Institution'],null=True), keep_default=False)
def forwards(self, orm): # Renaming column for 'Shop.country' to match new field type. db.drop_column('shops_shop', 'country') # Changing field 'Shop.country' db.add_column('shops_shop', 'country', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['countries.Country'], null=True, blank=True))
def backwards(self): for t in ("peer_as", "peer_peer"): db.drop_column(t, "project_id")
def backwards(self): db.drop_column("vc_vcdomain", "selector")
def forwards(self, orm): # Changing field 'Talk.duration' db.drop_column('talks_talk', 'duration') db.add_column('talks_talk', 'duration', self.gf('django.db.models.fields.IntegerField')())
def backwards(self): db.drop_column("ip_vrf", "state_id") db.drop_column("ip_prefix", "state_id") db.drop_column("ip_address", "state_id")
def backwards(self): db.drop_column("main_notification", "tag")
def forwards(self): db.drop_column("sa_managedobject", "is_configuration_managed") db.drop_column("sa_managedobject", "repo_path")
def forwards(self): # Drop old tags db.drop_column("sa_managedobjectselector", "filter_tags") # Rename new tags db.rename_column("sa_managedobjectselector", "tmp_filter_tags", "filter_tags")
def backwards(self): db.drop_column("ip_prefix", "enable_ip_discovery")
def backwards(self): db.drop_column("sa_managedobject", "auth_profile_id") db.delete_table("sa_authprofile")
def backwards(self): db.drop_column("ip_ipv4address", "managed_object_id") db.drop_column("ip_ipv4address", "mac") db.drop_column("ip_ipv4address", "auto_update_mac")
def backwards(self): db.drop_column("main_userprofile", "preview_theme_id")
def backwards(self): db.drop_column("vc_vc", "state_id")
def backwards(self): db.drop_column("cm_objectnotify", "notification_group")
def backwards(self): db.drop_column("dns_dnszone", "project_id")
def backwards(self): db.drop_column("ip_ipv4block", "vc_id")
def backwards(self): db.drop_column("dns_dnszone", "type")
def backwards(self): db.drop_column("ip_ippool", "name")
def backwards(self, orm): # Revert field 'TestUser.facebook_id' db.drop_column('facetools_testuser', 'facebook_id') db.add_column('facetools_testuser', 'facebook_id', self.gf('django.db.models.fields.CharField')(max_length=255, null=True))
def backwards(self): db.drop_column("ip_prefix", "ipv6_transition_id") db.drop_column("ip_address", "ipv6_transition_id")
def backwards(self): db.drop_column("vc_vcdomain", "style_id") db.drop_column("vc_vc", "style_id")
def forwards(self): db.drop_column("ip_vrf", "is_active")
def forwards(self): db.drop_column("vc_vcdomain", "selector_id")
def forwards(self): # Drop groups and fields db.drop_column("cm_objectnotify", "group_id")
def backwards(self): db.drop_column("ip_ippool", "technologies")
def forwards(self, orm): # Adding field 'PostComment.title' db.drop_column('bee_trustgroup_members', 'identity_id') db.add_column('bee_trustgroup_members', 'usersocialauth', self.gf('django.db.models.fields.related.ForeignKey')(default=1, to=orm['auth.User']))