• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python db.rename_table函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: forwards

    def forwards(self, orm):

        # Removing unique constraint on 'CohortVariant', fields ['variant', 'cohort']
        db.delete_unique('cohort_variant', ['variant_id', 'cohort_id'])

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

        # Removing unique constraint on 'Sample', fields ['cohort', 'name']
        db.delete_unique('sample', ['cohort_id', 'name'])

        # Deleting model 'CohortVariant'
        db.delete_table('cohort_variant')

        # Renaming model 'Cohort' to 'Batch'
        db.rename_table('project_cohort', 'batch')

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

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

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

        # Adding unique constraint on 'Sample', fields ['batch', 'name']
        db.create_unique('sample', ['batch_id', 'name'])
开发者ID:andrewjesaitis,项目名称:varify,代码行数:27,代码来源:0006_auto__del_cohort__del_unique_cohort_project_name__del_cohortvariant__d.py


示例17: forwards

    def forwards(self, orm):
        # Renaming model 'JobType' to model 'AbstractJobType'
        db.rename_table(u'my_ortoloco_jobtype', u'my_ortoloco_abstractjobtype')

        # Deleting field 'OneTimeJob.description'
        db.delete_column(u'my_ortoloco_onetimejob', 'description')

        # Deleting field 'OneTimeJob.name'
        db.delete_column(u'my_ortoloco_onetimejob', 'name')

        # Deleting field 'OneTimeJob.location'
        db.delete_column(u'my_ortoloco_onetimejob', 'location')

        # Deleting field 'OneTimeJob.duration'
        db.delete_column(u'my_ortoloco_onetimejob', 'duration')

        # Deleting field 'OneTimeJob.bereich'
        db.delete_column(u'my_ortoloco_onetimejob', 'bereich_id')

        # Deleting field 'OneTimeJob.displayed_name'
        db.delete_column(u'my_ortoloco_onetimejob', 'displayed_name')

        # Adding field 'OneTimeJob.abstractjobtype_ptr'
        db.add_column(u'my_ortoloco_onetimejob', u'abstractjobtype_ptr',
                      self.gf('django.db.models.fields.related.OneToOneField')(to=orm['my_ortoloco.AbstractJobType'], unique=True),
                      keep_default=False)


        # Changing field 'RecuringJob.typ'
        db.alter_column(u'my_ortoloco_recuringjob', 'typ_id', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['my_ortoloco.AbstractJobType'], on_delete=models.PROTECT))
开发者ID:mehalsgmues,项目名称:mehalsgmues,代码行数:30,代码来源:0035_auto__del_jobtype__add_abstractjobtype__del_field_onetimejob_descripti.py


示例18: forwards

 def forwards(self, orm):    
     db.rename_table("text_text", "cmsplugin_text")
     db.rename_table("text_publictext", "cmsplugin_textpublic")
     db.alter_column('cmsplugin_text', 'public_id', orm['text.text:public'])
     db.drop_primary_key("cmsplugin_textpublic")
     db.rename_column("cmsplugin_textpublic", "publiccmsplugin_ptr_id", "cmspluginpublic_ptr_id")
     db.create_primary_key("cmsplugin_textpublic", ("cmspluginpublic_ptr_id",))
开发者ID:wolfe,项目名称:django-cms-2.0,代码行数:7,代码来源:0004_table_rename.py


示例19: forwards

    def forwards(self, orm):
        # These tables were already created by vera before we swapped out the
        # models
        db.rename_table('wq_event', 'data_event')
        return

        # Adding model 'Event'
        db.create_table('data_event', (
            (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('site', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['locations.Site'], null=True, blank=True)),
            ('date', self.gf('django.db.models.fields.DateField')()),
        ))
        db.send_create_signal(u'data', ['Event'])

        # Adding unique constraint on 'Event', fields ['site', 'date']
        db.create_unique('data_event', ['site_id', 'date'])

        # Adding model 'EventResult'
        db.create_table('wq_eventresult', (
            ('id', self.gf('django.db.models.fields.PositiveIntegerField')(primary_key=True)),
            ('event', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['data.Event'])),
            ('result', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['vera.Result'])),
            ('event_site', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['locations.Site'], null=True, blank=True)),
            ('event_date', self.gf('django.db.models.fields.DateField')()),
            ('result_type', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['vera.Parameter'])),
            ('result_report', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['vera.Report'])),
            ('result_value_numeric', self.gf('django.db.models.fields.FloatField')(null=True, blank=True)),
            ('result_value_text', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
            ('result_empty', self.gf('django.db.models.fields.BooleanField')()),
        ))
        db.send_create_signal(u'data', ['EventResult'])

        # Adding unique constraint on 'EventResult', fields ['event', 'result_type']
        db.create_unique('wq_eventresult', ['event_id', 'result_type_id'])
开发者ID:pombredanne,项目名称:climata-viewer,代码行数:34,代码来源:0005_swap_event.py


示例20: forwards

    def forwards(self, orm):
        db.rename_table('product_downloadableproduct', 'downloadable_downloadableproduct')

        # check if the table exists; might be a fresh, post 0.9 installation
        try:
            from django.db import connection
            cursor = connection.cursor()
            if not cursor:
                raise Exception
            table_names = connection.introspection.get_table_list(cursor)
        except:
            raise Exception("unable to determine if the table 'shop_downloadlink' exists")
        else:
            if not 'shop_downloadlink' in table_names:
                # create the table
                # create commands were obtained from a fresh --initial migration
                db.create_table('downloadable_downloadlink', (
                    ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
                    ('downloadable_product', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['downloadable.DownloadableProduct'])),
                    ('order', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['shop.Order'])),
                    ('key', self.gf('django.db.models.fields.CharField')(max_length=40)),
                    ('num_attempts', self.gf('django.db.models.fields.IntegerField')()),
                    ('time_stamp', self.gf('django.db.models.fields.DateTimeField')()),
                    ('active', self.gf('django.db.models.fields.BooleanField')(default=True)),
                ))
                db.send_create_signal('downloadable', ['DownloadLink'])
            else:
                db.rename_table('shop_downloadlink', 'downloadable_downloadlink')
开发者ID:Ryati,项目名称:satchmo,代码行数:28,代码来源:0001_split.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python db.rollback_transaction函数代码示例发布时间:2022-05-27
下一篇:
Python db.rename_column函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap