当前位置: 首页>>代码示例>>Python>>正文


Python db.rename_table函数代码示例

本文整理汇总了Python中south.db.db.rename_table函数的典型用法代码示例。如果您正苦于以下问题:Python rename_table函数的具体用法?Python rename_table怎么用?Python rename_table使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了rename_table函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: forwards

 def forwards(self, orm):
     
     db.rename_table("flash_flash", "cmsplugin_flash")
     db.rename_table("flash_publicflash", "cmsplugin_flashpublic")
     db.alter_column('cmsplugin_flash', 'public_id', orm['flash.flash:public'])
     #db.drop_primary_key("cmsplugin_flashpublic")
     db.rename_column("cmsplugin_flashpublic", "publiccmsplugin_ptr_id", "cmspluginpublic_ptr_id")
开发者ID:artemrizhov,项目名称:itcm,代码行数:7,代码来源:0004_table_rename.py

示例2: backwards

 def backwards(self, orm):
     db.drop_primary_key("cmsplugin_linkpublic")
     db.rename_column("cmsplugin_linkpublic", "cmspluginpublic_ptr_id", "publiccmsplugin_ptr_id")
     db.create_primary_key("cmsplugin_linkpublic", ("publiccmsplugin_ptr_id",))
     db.rename_table("cmsplugin_link", "link_link")
     db.rename_table("cmsplugin_linkpublic", "link_publiclink")
     db.alter_column('cmsplugin_link', 'public_id', orm['link.link:public'])
开发者ID:wolfe,项目名称:django-cms-2.0,代码行数:7,代码来源:0006_table_rename.py

示例3: backwards

    def backwards(self, orm):
        
        # Renaming M2M table for field enquiries on 'Studentship'
        db.rename_table('vacancies_and_studentships_studentship_please_contact', 'vacancies_and_studentships_studentship_enquiries',)

        # Renaming M2M table for field enquiries on 'Vacancy'
        db.rename_table('vacancies_and_studentships_vacancy_please_contact', 'vacancies_and_studentships_vacancy_enquiries', )
开发者ID:KristianOellegaard,项目名称:Arkestra,代码行数:7,代码来源:0006_auto.py

示例4: forwards

 def forwards(self, orm):
     
     # Deleting model 'Badge'
     db.rename_table(u'badge', u'askbot_badgedata')
     db.create_unique('askbot_badgedata', ['type', 'name'])
     # Changing field 'Award.badge'
     db.alter_column(u'award', 'badge_id', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['askbot.BadgeData']))
开发者ID:maxwward,项目名称:SCOPE,代码行数:7,代码来源:0030_rename_badge_to_badgedata.py

示例5: forwards

 def forwards(self, orm):
     db.rename_table('billing_app_stripecustomer', 'billing_app_card')
     db.delete_unique('billing_app_card', ['name', 'keystone_id'])
     db.rename_column('billing_app_card', 'name', 'last4')
     db.rename_column('billing_app_card', 'is_default', 'default')
     db.add_column('billing_app_card', 'tenant_id', models.fields.CharField(max_length=64, db_index=True))
     db.create_unique('billing_app_card', ['last4', 'tenant_id'])
开发者ID:kili,项目名称:dashboard,代码行数:7,代码来源:0003_auto__del_stripecustomer__del_unique_stripecustomer_name_keystone_id__.py

示例6: backwards

    def backwards(self, orm):
        # Adding model 'NavTree'
        #db.create_table('coop_cms_navtree', (
        #    ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
        #    ('name', self.gf('django.db.models.fields.CharField')(default='default', max_length=100, unique=True, db_index=True)),
        #    ('last_update', self.gf('django.db.models.fields.DateTimeField')(auto_now=True, blank=True)),
        #))
        #db.send_create_signal('coop_cms', ['NavTree'])
        #
        ## Adding M2M table for field types on 'NavTree'
        #db.create_table('coop_cms_navtree_types', (
        #    ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
        #    ('navtree', models.ForeignKey(orm['coop_cms.navtree'], null=False)),
        #    ('navtype', models.ForeignKey(orm['coop_cms.navtype'], null=False))
        #))
        #db.create_unique('coop_cms_navtree_types', ['navtree_id', 'navtype_id'])

        db.rename_table('basic_cms_navtree', 'coop_cms_navtree')

        # Removing M2M table for field types on 'NavTree'
        #db.delete_table('basic_cms_navtree_types')
        db.rename_table('basic_cms_navtree_types', 'coop_cms_navtree_types')


        # Changing field 'NavNode.tree'
        db.alter_column('coop_cms_navnode', 'tree_id', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['coop_cms.NavTree']))
开发者ID:credis,项目名称:coop_cms,代码行数:26,代码来源:0026_auto__del_navtree__chg_field_navnode_tree.py

示例7: forwards

 def forwards(self, orm):
     # Renaming model 'CourseAttendance'
     db.rename_table(u'attendance_courseattendance', u'attendance_coursesectionattendance')
     if not db.dry_run:
         orm['contenttypes.contenttype'].objects.filter(
             app_label='attendance', model='courseattendance'
         ).update(model='coursesectionattendance')
开发者ID:Alejoss,项目名称:django-sis,代码行数:7,代码来源:0003_auto__del_courseattendance__add_coursesectionattendance.py

示例8: forwards

    def forwards(self, orm):

        # move some models from maps to layers app
        
        # 0. add some missing fields (not for wfp)
        db.start_transaction()
        try:
            # Adding field 'Layer.bbox_top'
            db.add_column('maps_layer', 'bbox_top', self.gf('django.db.models.fields.FloatField')(null=True, blank=True), keep_default=False)
            # Adding field 'Layer.bbox_bottom'
            db.add_column('maps_layer', 'bbox_bottom', self.gf('django.db.models.fields.FloatField')(null=True, blank=True), keep_default=False)
            # Adding field 'Layer.bbox_left'
            db.add_column('maps_layer', 'bbox_left', self.gf('django.db.models.fields.FloatField')(null=True, blank=True), keep_default=False)
            # Adding field 'Layer.bbox_right'
            db.add_column('maps_layer', 'bbox_right', self.gf('django.db.models.fields.FloatField')(null=True, blank=True), keep_default=False)
            db.commit_transaction()
        except:
            print 'No need to create the fields, they are already there'
            db.rollback_transaction()
            
        # 1. layers_layer moved from maps_layer
        db.rename_table('maps_layer', 'layers_layer') 
        if not db.dry_run:
            orm['contenttypes.contenttype'].objects.filter(app_label='maps', model='layer').update(app_label='layers')
            
        # 2. layers_contactrole moved from maps_contactrole
        db.rename_table('maps_contactrole', 'layers_contactrole') 
        if not db.dry_run:
            orm['contenttypes.contenttype'].objects.filter(app_label='maps', model='contactrole').update(app_label='layers')
开发者ID:EricSchles,项目名称:geonode,代码行数:29,代码来源:0003_move_models_to_layers.py

示例9: forwards

    def forwards(self, orm):

        # Adding M2M table for field coauthor on 'Alternative'
        m2m_table_name = db.shorten_name('dnstorm_alternative_coauthor')
        db.create_table(m2m_table_name, (
            ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
            ('alternative', models.ForeignKey(orm[u'app.alternative'], null=False)),
            ('user', models.ForeignKey(orm[u'auth.user'], null=False))
        ))
        db.create_unique(m2m_table_name, ['alternative_id', 'user_id'])

        # Adding M2M table for field coauthor on 'Criteria'
        m2m_table_name = db.shorten_name('dnstorm_criteria_coauthor')
        db.create_table(m2m_table_name, (
            ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
            ('criteria', models.ForeignKey(orm[u'app.criteria'], null=False)),
            ('user', models.ForeignKey(orm[u'auth.user'], null=False))
        ))
        db.create_unique(m2m_table_name, ['criteria_id', 'user_id'])

        # Adding M2M table for field coauthor on 'Idea'
        m2m_table_name = db.shorten_name('dnstorm_idea_coauthor')
        db.create_table(m2m_table_name, (
            ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
            ('idea', models.ForeignKey(orm[u'app.idea'], null=False)),
            ('user', models.ForeignKey(orm[u'auth.user'], null=False))
        ))
        db.create_unique(m2m_table_name, ['idea_id', 'user_id'])

        # Removing M2M table for field contributor on 'Problem'
        db.rename_table('dnstorm_problem_contributor', 'dnstorm_problem_collaborator')
开发者ID:vmassuchetto,项目名称:dnstorm,代码行数:31,代码来源:0004_auto__add_field_alternative_published.py

示例10: forwards

    def forwards(self, orm):
        existing_tables = connection.introspection.table_names()

        # Adding model 'Message'
        if 'messages_message' in existing_tables:
            db.rename_table('messages_message', 'questions_message')
        else:
            db.create_table('questions_message', (
                ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
                ('contest', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['contests.Contest'], null=True, blank=True)),
                ('problem_instance', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['contests.ProblemInstance'], null=True, blank=True)),
                ('problem', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['problems.Problem'], null=True, blank=True)),
                ('top_reference', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['questions.Message'], null=True, blank=True)),
                ('author', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'])),
                ('kind', self.gf('oioioi.base.fields.EnumField')(default='QUESTION', max_length=64)),
                ('topic', self.gf('django.db.models.fields.CharField')(max_length=255)),
                ('content', self.gf('django.db.models.fields.TextField')()),
                ('date', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)),
            ))
            db.send_create_signal('questions', ['Message'])

        # Adding model 'MessageView'
        if 'messages_messageview' in existing_tables:
            db.rename_table('messages_messageview', 'questions_messageview')
        else:
            db.create_table('questions_messageview', (
                ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
                ('message', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['questions.Message'])),
                ('user', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'])),
                ('date', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)),
            ))
            db.send_create_signal('questions', ['MessageView'])
开发者ID:sajad22,项目名称:oioioi,代码行数:32,代码来源:0001_initial.py

示例11: backwards

    def backwards(self, orm):

        # Adding M2M table for field speakers on 'Event'
        # db.create_table('news_and_events_event_speakers', (
        #     ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
        #     ('event', models.ForeignKey(orm['news_and_events.event'], null=False)),
        #     ('person', models.ForeignKey(orm['contacts_and_people.person'], null=False))
        # ))
        # db.create_unique('news_and_events_event_speakers', ['event_id', 'person_id'])

        db.rename_table("news_and_events_event_featuring", "news_and_events_event_speakers")

        # Adding M2M table for field registration_enquiries on 'Event'
        db.create_table(
            "news_and_events_event_registration_enquiries",
            (
                ("id", models.AutoField(verbose_name="ID", primary_key=True, auto_created=True)),
                ("event", models.ForeignKey(orm["news_and_events.event"], null=False)),
                ("person", models.ForeignKey(orm["contacts_and_people.person"], null=False)),
            ),
        )
        db.create_unique("news_and_events_event_registration_enquiries", ["event_id", "person_id"])

        # Adding M2M table for field organisers on 'Event'
        db.create_table(
            "news_and_events_event_organisers",
            (
                ("id", models.AutoField(verbose_name="ID", primary_key=True, auto_created=True)),
                ("event", models.ForeignKey(orm["news_and_events.event"], null=False)),
                ("person", models.ForeignKey(orm["contacts_and_people.person"], null=False)),
            ),
        )
        db.create_unique("news_and_events_event_organisers", ["event_id", "person_id"])
开发者ID:airtonix,项目名称:Arkestra,代码行数:33,代码来源:0032_auto.py

示例12: backwards

    def backwards(self, orm):

        db.rename_table(
            u'tasks_cronjob',
            u'system_cronjob',
        )

        db.rename_table(
            u'tasks_initshutdown',
            u'system_initshutdown',
        )

        db.rename_table(
            u'tasks_rsync',
            u'system_rsync',
        )

        db.rename_table(
            u'tasks_smarttest',
            u'system_smarttest',
        )

        db.rename_table(
            db.shorten_name(u'tasks_smarttest_smarttest_disks'),
            db.shorten_name(u'system_smarttest_smarttest_disks'),
        )
开发者ID:650elx,项目名称:middleware,代码行数:26,代码来源:0001_add_tasks.py

示例13: forwards

 def forwards(self, orm):
     db.rename_table("fccpublicfiles_address", "locations_address")
     if not db.dry_run:
         # For permissions to work properly after migrating
         orm["contenttypes.contenttype"].objects.filter(app_label="fccpublicfiles", model="address").update(
             app_label="locations"
         )
开发者ID:sunlightlabs,项目名称:fcc_political_ads,代码行数:7,代码来源:0001_move_fccpublicfiles_address_to_locations_address.py

示例14: backwards

    def backwards(self, orm):

        # Removing unique constraint on 'Batch', fields ['project', 'name']
        db.delete_unique('batch', ['project_id', 'name'])

        db.rename_table('batch', 'project_cohort')

        db.rename_column('sample', 'batch_id', 'cohort_id')

        # Changing field 'Sample.cohort'
        db.alter_column('sample', 'cohort_id', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['samples.Cohort']))

        # Adding unique constraint on 'Cohort', fields ['project', 'name']
        db.create_unique('project_cohort', ['project_id', 'name'])

        # Adding model 'CohortVariant'
        db.create_table('cohort_variant', (
            ('cohort', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['samples.Cohort'])),
            ('variant', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['variants.Variant'])),
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('af', self.gf('django.db.models.fields.FloatField')(null=True, db_index=True)),
        ))
        db.send_create_signal('samples', ['CohortVariant'])

        # Adding unique constraint on 'CohortVariant', fields ['variant', 'cohort']
        db.create_unique('cohort_variant', ['variant_id', 'cohort_id'])
开发者ID:andrewjesaitis,项目名称:varify,代码行数:26,代码来源:0006_auto__del_cohort__del_unique_cohort_project_name__del_cohortvariant__d.py

示例15: backwards

 def backwards(self, orm):
     db.rename_table('billing_app_card', 'billing_app_stripecustomer')
     db.delete_unique('billing_app_stripecustomer', ['last4', 'tenant_id'])
     db.rename_column('billing_app_stripecustomer', 'last4', 'name')
     db.rename_column('billing_app_stripecustomer', 'default', 'is_default')
     db.create_unique('billing_app_stripecustomer', ['is_default', 'keystone_id'])
     db.delete_column('billing_app_stripecustomer', 'tenant_id')
开发者ID:kili,项目名称:dashboard,代码行数:7,代码来源:0003_auto__del_stripecustomer__del_unique_stripecustomer_name_keystone_id__.py


注:本文中的south.db.db.rename_table函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。