Пример #1
0
    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")
Пример #2
0
 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))
Пример #4
0
 def forwards(self):
     db.drop_column("vc_vc", "type_id")
     db.execute("ALTER TABLE vc_vcdomain ALTER COLUMN type_id SET NOT NULL")
Пример #5
0
 def backwards(self):
     db.drop_column("vc_vc", "project_id")
Пример #6
0
 def backwards(self):
     for t in ["peer_asset"]:
         db.drop_column(t, "project_id")
 def backwards(self):
     db.drop_column("sa_objectnotification", "alarm_reopened")
Пример #8
0
 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)
Пример #10
0
 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))
Пример #11
0
 def backwards(self):
     for t in ("peer_as", "peer_peer"):
         db.drop_column(t, "project_id")
Пример #12
0
 def backwards(self):
     db.drop_column("vc_vcdomain", "selector")
Пример #13
0
 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')())
Пример #14
0
 def backwards(self):
     db.drop_column("ip_vrf", "state_id")
     db.drop_column("ip_prefix", "state_id")
     db.drop_column("ip_address", "state_id")
Пример #15
0
 def backwards(self):
     db.drop_column("main_notification", "tag")
Пример #16
0
 def forwards(self):
     db.drop_column("sa_managedobject", "is_configuration_managed")
     db.drop_column("sa_managedobject", "repo_path")
Пример #17
0
 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")
Пример #18
0
 def backwards(self):
     db.drop_column("ip_prefix", "enable_ip_discovery")
Пример #19
0
 def backwards(self):
     db.drop_column("sa_managedobject", "auth_profile_id")
     db.delete_table("sa_authprofile")
Пример #20
0
 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")
Пример #21
0
 def backwards(self):
     db.drop_column("main_userprofile", "preview_theme_id")
Пример #22
0
 def backwards(self):
     db.drop_column("vc_vc", "state_id")
 def backwards(self):
     db.drop_column("cm_objectnotify", "notification_group")
Пример #24
0
 def backwards(self):
     db.drop_column("dns_dnszone", "project_id")
Пример #25
0
 def backwards(self):
     db.drop_column("ip_ipv4block", "vc_id")
Пример #26
0
 def backwards(self):
     db.drop_column("dns_dnszone", "type")
Пример #27
0
 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))
Пример #29
0
 def backwards(self):
     db.drop_column("ip_prefix", "ipv6_transition_id")
     db.drop_column("ip_address", "ipv6_transition_id")
Пример #30
0
 def backwards(self):
     db.drop_column("vc_vcdomain", "style_id")
     db.drop_column("vc_vc", "style_id")
Пример #31
0
 def forwards(self):
     db.drop_column("ip_vrf", "is_active")
Пример #32
0
 def forwards(self):
     db.drop_column("vc_vcdomain", "selector_id")
Пример #33
0
 def forwards(self):
     # Drop groups and fields
     db.drop_column("cm_objectnotify", "group_id")
Пример #34
0
 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']))