本文整理汇总了Python中south.db.db.rename_column函数的典型用法代码示例。如果您正苦于以下问题:Python rename_column函数的具体用法?Python rename_column怎么用?Python rename_column使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rename_column函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: rename_db_column
def rename_db_column(model_class, old_name, new_name):
""" Renomear uma coluna de banco de dados do sensor. """
table_name = model_class._meta.db_table
db.start_transaction()
db.rename_column(table_name, old_name, new_name)
logger.debug("Renamed column '%s' to '%s' on %s" % (old_name, new_name, table_name))
db.commit_transaction()
开发者ID:rsandrini,项目名称:dynamic-models,代码行数:7,代码来源:utils.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: test_dry_rename
def test_dry_rename(self):
"""
Test column renaming while --dry-run is turned on (should do nothing)
See ticket #65
"""
cursor = connection.cursor()
db.create_table("test_drn", [('spam', models.BooleanField(default=False))])
# Make sure we can select the column
cursor.execute("SELECT spam FROM test_drn")
# Rename it
db.dry_run = True
db.rename_column("test_drn", "spam", "eggs")
db.dry_run = False
cursor.execute("SELECT spam FROM test_drn")
db.commit_transaction()
db.start_transaction()
try:
cursor.execute("SELECT eggs FROM test_drn")
except:
pass
else:
self.fail("Dry-renamed new column could be selected!")
db.rollback_transaction()
db.delete_table("test_drn")
db.start_transaction()
开发者ID:TradeHill2011,项目名称:south,代码行数:25,代码来源:db.py
示例4: forwards
def forwards(self, orm):
# Adding model 'User'
db.create_table('tomato_user', (
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('name', self.gf('django.db.models.fields.CharField')(max_length=20, unique=True)),
))
db.send_create_signal('tomato', ['User'])
db.rename_column('tomato_element', 'owner', 'owner_str')
db.rename_column('tomato_connection', 'owner', 'owner_str')
db.add_column('tomato_element', 'owner',
self.gf('django.db.models.fields.related.ForeignKey')(related_name='elements', null=True, to=orm['tomato.User']),
keep_default=False)
# Adding field 'Connection.owner'
db.add_column('tomato_connection', 'owner',
self.gf('django.db.models.fields.related.ForeignKey')(related_name='connections', null=True, to=orm['tomato.User']),
keep_default=False)
db.add_column('tomato_network', 'owner',
self.gf('django.db.models.fields.related.ForeignKey')(related_name='networks', null=True, to=orm['tomato.User']),
keep_default=False)
db.add_column('tomato_template', 'owner',
self.gf('django.db.models.fields.related.ForeignKey')(related_name='templates', null=True, to=orm['tomato.User']),
keep_default=False)
# Changing field 'OpenVZ.template'
db.alter_column('tomato_openvz', 'template_id', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['tomato.Template'], null=True))
开发者ID:StephanSchlosser,项目名称:ToMaTo,代码行数:31,代码来源:0004_users1.py
示例5: backwards
def backwards(self, orm):
db.delete_column('l_t_troncon', 'geom')
db.rename_column('l_t_troncon', 'geom_3d', 'geom')
db.delete_column('e_t_evenement', 'geom')
db.rename_column('e_t_evenement', 'geom_3d', 'geom')
db.alter_column('l_t_troncon', 'geom_cadastre', self.gf('django.contrib.gis.db.models.fields.LineStringField')(srid=settings.SRID, dim=3, null=True, spatial_index=False))
开发者ID:masterdubs,项目名称:Geotrek,代码行数:7,代码来源:0019_auto__add_field_path_geom_3d__chg_field_path_geom.py
示例6: backwards
def backwards(self, orm):
# Adding field 'OutputSettings.daily_states_filename'
db.add_column('ScenarioCreator_outputsettings', 'daily_states_filename',
self.gf('django.db.models.fields.CharField')(max_length=255, blank=True, null=True),
keep_default=False)
# Adding field 'OutputSettings.maximum_iterations_for_daily_output'
db.add_column('ScenarioCreator_outputsettings', 'maximum_iterations_for_daily_output',
self.gf('django.db.models.fields.PositiveIntegerField')(default=3, blank=True, null=True),
keep_default=False)
# Adding field 'OutputSettings.save_all_daily_outputs'
db.add_column('ScenarioCreator_outputsettings', 'save_all_daily_outputs',
self.gf('django.db.models.fields.BooleanField')(default=False),
keep_default=False)
# Adding field 'OutputSettings.map_directory'
db.add_column('ScenarioCreator_outputsettings', 'map_directory',
self.gf('django.db.models.fields.CharField')(max_length=255, blank=True, null=True),
keep_default=False)
# Adding field 'OutputSettings.write_map_output'
db.rename_column('ScenarioCreator_outputsettings', 'save_map_output', 'write_map_output' )
# Deleting field 'OutputSettings.save_daily_unit_states'
db.delete_column('ScenarioCreator_outputsettings', 'save_daily_unit_states')
开发者ID:sniperpj21,项目名称:SpreadModel,代码行数:26,代码来源:0034_auto__del_field_outputsettings_daily_states_filename__del_field_output.py
示例7: forwards
def forwards(self, orm):
# Adding model 'Faction'
db.create_table('representative_faction', (
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('name', self.gf('django.db.models.fields.CharField')(max_length=255, null=True)),
('short', self.gf('django.db.models.fields.CharField')(max_length=32, null=True)),
))
db.send_create_signal('representative', ['Faction'])
# Deleting field 'Representative.faction_en'
db.delete_column('representative_representative', 'faction_en')
# Deleting field 'Representative.faction_ka'
db.delete_column('representative_representative', 'faction_ka')
# Renaming column for 'Representative.faction' to match new field type.
db.rename_column('representative_representative', 'faction', 'faction_id')
# Changing field 'Representative.faction'
db.alter_column('representative_representative', 'faction_id', self.gf('django.db.models.fields.related.ForeignKey')(null=True, to=orm['representative.Faction']))
# Adding index on 'Representative', fields ['faction']
db.create_index('representative_representative', ['faction_id'])
# Removing M2M table for field parties on 'Cabinet'
db.delete_table(db.shorten_name('representative_cabinet_parties'))
# Adding M2M table for field factions on 'Cabinet'
m2m_table_name = db.shorten_name('representative_cabinet_factions')
db.create_table(m2m_table_name, (
('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
('cabinet', models.ForeignKey(orm['representative.cabinet'], null=False)),
('faction', models.ForeignKey(orm['representative.faction'], null=False))
))
db.create_unique(m2m_table_name, ['cabinet_id', 'faction_id'])
开发者ID:araneta,项目名称:shenmartav,代码行数:34,代码来源:0024_auto__add_faction__del_field_representative_faction_en__del_field_repr.py
示例8: backwards
def backwards(self, orm):
try:
# Removing index on 'PricingObject', fields ['type']
db.delete_index(u'ralph_scrooge_pricingobject', ['type_id'])
except utils.DatabaseError:
pass
# Removing unique constraint on 'TeamManager', fields ['manager', 'team']
db.delete_unique(u'ralph_scrooge_teammanager', ['manager_id', 'team_id'])
# Deleting model 'PricingObjectType'
db.delete_table(u'ralph_scrooge_pricingobjecttype')
# Deleting model 'PricingObjectModel'
db.delete_table(u'ralph_scrooge_pricingobjectmodel')
# Deleting model 'TeamManager'
db.delete_table(u'ralph_scrooge_teammanager')
# Adding field 'AssetInfo.model'
db.rename_column(u'ralph_scrooge_assetinfo', 'model_old_id', 'model_id')
# Adding field 'PricingObject.color'
db.add_column(u'ralph_scrooge_pricingobject', 'color',
self.gf('django.db.models.fields.PositiveIntegerField')(default=255),
keep_default=False)
# Deleting field 'PricingObject.model'
db.delete_column(u'ralph_scrooge_pricingobject', 'model_id')
# Renaming column for 'PricingObject.type' to match new field type.
db.rename_column(u'ralph_scrooge_pricingobject', 'type_id', 'type')
# Changing field 'PricingObject.type'
db.alter_column(u'ralph_scrooge_pricingobject', 'type', self.gf('django.db.models.fields.PositiveIntegerField')())
开发者ID:allegro,项目名称:ralph_pricing,代码行数:34,代码来源:0005_auto__add_pricingobjecttype__add_pricingobjectmodel__add_teammanager__.py
示例9: 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
示例10: forwards
def forwards(self, orm):
# Renaming field 'Prize.deprecated_provided' to 'Prize.provided'
db.rename_column(u'tracker_prize', 'deprecated_provided', 'provided')
# Adding field 'Prize.creator'
db.add_column(u'tracker_prize', 'creator',
self.gf('django.db.models.fields.CharField')(default='', max_length=64, blank=True),
keep_default=False)
# Adding field 'Prize.creatoremail'
db.add_column(u'tracker_prize', 'creatoremail',
self.gf('django.db.models.fields.CharField')(default='', max_length=64, blank=True),
keep_default=False)
# Adding field 'Prize.creatorwebsite'
db.add_column(u'tracker_prize', 'creatorwebsite',
self.gf('django.db.models.fields.CharField')(default='', max_length=64, blank=True),
keep_default=False)
# Adding field 'Prize.state'
db.add_column(u'tracker_prize', 'state',
self.gf('django.db.models.fields.CharField')(default='PENDING', max_length=32),
keep_default=False)
# Removing M2M table for field contributors on 'Prize'
db.delete_table(db.shorten_name(u'tracker_prize_contributors'))
# Deleting field 'Donor.prizecontributorwebsite'
db.delete_column(u'tracker_donor', 'prizecontributorwebsite')
# Deleting field 'Donor.prizecontributoremail'
db.delete_column(u'tracker_donor', 'prizecontributoremail')
开发者ID:DreadWingKnight,项目名称:donation-tracker,代码行数:32,代码来源:0049_clean_up_prize_and_donor.py
示例11: backwards
def backwards(self, orm):
# Removing index on 'Restaurant', fields ['location']
db.delete_index(u'api_restaurant', ['location_id'])
# Adding model 'Restaurant_Holiday'
db.create_table(u'api_restaurant_holiday', (
('closed_date', self.gf('django.db.models.fields.DateTimeField')()),
(u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('restaurant', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['api.Restaurant'])),
))
db.send_create_signal(u'api', ['Restaurant_Holiday'])
# Deleting model 'RestaurantOpenHours'
db.delete_table(u'api_restaurantopenhours')
# Deleting model 'RestaurantHoliday'
db.delete_table(u'api_restaurantholiday')
# Deleting model 'Location'
db.delete_table(u'api_location')
# Adding field 'Restaurant.closed_every_other_weekend_initial_weekend'
db.add_column(u'api_restaurant', 'closed_every_other_weekend_initial_weekend',
self.gf('django.db.models.fields.DateTimeField')(null=True, blank=True),
keep_default=False)
# Deleting field 'Restaurant.closed_every_other_weekend_initial_weekend_sat'
db.delete_column(u'api_restaurant', 'closed_every_other_weekend_initial_weekend_sat')
# Renaming column for 'Restaurant.location' to match new field type.
db.rename_column(u'api_restaurant', 'location_id', 'location')
# Changing field 'Restaurant.location'
db.alter_column(u'api_restaurant', 'location', self.gf('django.db.models.fields.IntegerField')())
开发者ID:heronyang,项目名称:plate-api,代码行数:34,代码来源:0007_auto__del_restaurant_holiday__add_restaurantopenhours__add_restauranth.py
示例12: backwards
def backwards(self, orm):
# Renaming field 'Prize.provided' to 'Prize.deprecated_provided'
db.rename_column(u'tracker_prize', 'provided', 'deprecated_provided')
# Deleting field 'Prize.creator'
db.delete_column(u'tracker_prize', 'creator')
# Deleting field 'Prize.creatoremail'
db.delete_column(u'tracker_prize', 'creatoremail')
# Deleting field 'Prize.creatorwebsite'
db.delete_column(u'tracker_prize', 'creatorwebsite')
# Deleting field 'Prize.state'
db.delete_column(u'tracker_prize', 'state')
# Adding M2M table for field contributors on 'Prize'
m2m_table_name = db.shorten_name(u'tracker_prize_contributors')
db.create_table(m2m_table_name, (
('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
('prize', models.ForeignKey(orm['tracker.prize'], null=False)),
('donor', models.ForeignKey(orm['tracker.donor'], null=False))
))
db.create_unique(m2m_table_name, ['prize_id', 'donor_id'])
# Adding field 'Donor.prizecontributorwebsite'
db.add_column(u'tracker_donor', 'prizecontributorwebsite',
self.gf('django.db.models.fields.URLField')(max_length=200, null=True, blank=True),
keep_default=False)
# Adding field 'Donor.prizecontributoremail'
db.add_column(u'tracker_donor', 'prizecontributoremail',
self.gf('django.db.models.fields.EmailField')(unique=True, max_length=128, null=True, blank=True),
keep_default=False)
开发者ID:DreadWingKnight,项目名称:donation-tracker,代码行数:34,代码来源:0049_clean_up_prize_and_donor.py
示例13: backwards
def backwards(self, orm):
# Removing index on 'Sponsor', fields ['organization']
db.delete_index(u'sponsor_sponsor', ['organization_id'])
# Deleting model 'Organization'
db.delete_table(u'sponsor_organization')
# Adding field 'Sponsor.name_user'
db.add_column(u'sponsor_sponsor', 'name_user',
self.gf('django.db.models.fields.CharField')(default=1, max_length=50),
keep_default=False)
# Adding field 'Sponsor.join_date'
db.add_column(u'sponsor_sponsor', 'join_date',
self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, default=1, blank=True),
keep_default=False)
# Adding field 'Sponsor.password'
db.add_column(u'sponsor_sponsor', 'password',
self.gf('django.db.models.fields.CharField')(default=1, max_length=50),
keep_default=False)
# Adding field 'Sponsor.email'
db.add_column(u'sponsor_sponsor', 'email',
self.gf('django.db.models.fields.EmailField')(default=1, max_length=75, unique=True),
keep_default=False)
# Deleting field 'Sponsor.user'
db.delete_column(u'sponsor_sponsor', 'user_id')
# Renaming column for 'Sponsor.organization' to match new field type.
db.rename_column(u'sponsor_sponsor', 'organization_id', 'organization')
# Changing field 'Sponsor.organization'
db.alter_column(u'sponsor_sponsor', 'organization', self.gf('django.db.models.fields.CharField')(max_length=50))
开发者ID:darkmatter08,项目名称:Kommonly,代码行数:35,代码来源:0006_auto__add_organization__del_field_sponsor_name_user__del_field_sponsor.py
示例14: forwards
def forwards(self, orm):
# Renaming field 'State.date' to 'State.captured_at'
db.rename_column('greenhub_state', 'date', 'captured_at')
# Changing field 'Message.data'
db.alter_column('greenhub_message', 'data', self.gf('django.db.models.fields.CharField')(max_length=1000))
开发者ID:Hexaflou,项目名称:GreenHub,代码行数:7,代码来源:0005_manual_date_to_captured_at.py
示例15: backwards
def backwards(self, orm):
# Adding index on 'Tag', fields ['tipo_tags']
db.create_index(u"usuario_tag", ["tipo_tags_id"])
# Adding model 'Tipo_Tag'
db.create_table(
u"usuario_tipo_tag",
(
("tabela", self.gf("django.db.models.fields.CharField")(max_length=100)),
(u"id", self.gf("django.db.models.fields.AutoField")(primary_key=True)),
("tipo", self.gf("django.db.models.fields.CharField")(max_length=100)),
),
)
db.send_create_signal(u"usuario", ["Tipo_Tag"])
# Removing M2M table for field comcopia on 'Tag'
db.delete_table(db.shorten_name(u"usuario_tag_comcopia"))
# Renaming column for 'Tag.tipo_tags' to match new field type.
db.rename_column(u"usuario_tag", "tipo_tags", "tipo_tags_id")
# Changing field 'Tag.tipo_tags'
db.alter_column(
u"usuario_tag",
"tipo_tags_id",
self.gf("django.db.models.fields.related.ForeignKey")(to=orm["usuario.Tipo_Tag"]),
)
开发者ID:wt3c,项目名称:helpdesk,代码行数:26,代码来源:0017_auto__del_tipo_tag__chg_field_tag_tipo_tags__del_index_tag_tipo_tags.py
示例16: backwards
def backwards(self, orm):
# Removing index on 'Volume', fields ['lieu']
db.delete_index(u'volume', ['lieu_id'])
# Adding model 'TestViewOaiRecords'
db.create_table(u'test_view_oai_records', (
('type_notice', self.gf('django.db.models.fields.BigIntegerField')()),
('publisher', self.gf('django.db.models.fields.CharField')(max_length=765)),
('titre', self.gf('django.db.models.fields.CharField')(max_length=765, blank=True)),
('id_loris', self.gf('django.db.models.fields.CharField')(max_length=15)),
('parent', self.gf('django.db.models.fields.IntegerField')()),
('titre_parent', self.gf('django.db.models.fields.CharField')(max_length=765, blank=True)),
('fin_parent', self.gf('django.db.models.fields.DateField')(null=True, blank=True)),
('debut_parent', self.gf('django.db.models.fields.DateField')(null=True, blank=True)),
('time_stamp', self.gf('django.db.models.fields.DateTimeField')()),
('type_event', self.gf('django.db.models.fields.CharField')(max_length=12, blank=True)),
('id', self.gf('django.db.models.fields.CharField')(max_length=48, primary_key=True)),
('date_fin', self.gf('django.db.models.fields.CharField')(max_length=30, blank=True)),
('place', self.gf('django.db.models.fields.CharField')(max_length=384)),
('supprime', self.gf('django.db.models.fields.IntegerField')()),
('date_pub', self.gf('django.db.models.fields.CharField')(max_length=30, blank=True)),
('confidentialite', self.gf('django.db.models.fields.CharField')(max_length=33)),
('oai_set', self.gf('django.db.models.fields.CharField')(max_length=21)),
('date_debut', self.gf('django.db.models.fields.CharField')(max_length=30, blank=True)),
('sous_titre', self.gf('django.db.models.fields.CharField')(max_length=384)),
))
db.send_create_signal('old', ['TestViewOaiRecords'])
# Renaming column for 'Volume.lieu' to match new field type.
db.rename_column(u'volume', 'lieu_id', 'lieu')
# Changing field 'Volume.lieu'
db.alter_column(u'volume', 'lieu', self.gf('django.db.models.fields.IntegerField')())
开发者ID:funkyminh,项目名称:archiprod,代码行数:33,代码来源:0008_auto__del_testviewoairecords__chg_field_volume_lieu.py
示例17: backwards
def backwards(self, orm):
# Adding field 'Phase.judging_close'
db.add_column(
"competition_phase",
"judging_close",
self.gf("django.db.models.fields.DateTimeField")(default=datetime.datetime.now),
keep_default=False,
)
# Adding field 'Phase.applications_open'
db.add_column(
"competition_phase",
"applications_open",
self.gf("django.db.models.fields.DateTimeField")(default=datetime.datetime.now),
keep_default=False,
)
# Adding field 'Phase.applications_close_judging_open'
db.rename_column("competition_phase", "online_applications_due", "applications_close_judging_open")
# Deleting field 'Phase.applications_due'
db.delete_column("competition_phase", "applications_due")
# Changing field 'Phase.name'
db.alter_column("competition_phase", "name", self.gf("django.db.models.fields.CharField")(max_length=500))
开发者ID:robftz,项目名称:bizmodelcomp,代码行数:26,代码来源:0026_auto__del_field_phase_judging_close__del_field_phase_applications_open.py
示例18: backwards
def backwards(self, orm):
# Renaming field 'Personne.telephone'
db.rename_column('chercheurs_personne', 'telephone', 'mobile')
# Deleting field 'Personne.adresse_postale'
db.delete_column('chercheurs_personne', 'adresse_postale')
开发者ID:auf,项目名称:www_savoirsenpartage_auf_org,代码行数:7,代码来源:0004_auto__del_field_personne_mobile__add_field_personne_telephone__add_fie.py
示例19: backwards
def backwards(self, orm):
# Removing index on 'Representative', fields ['faction']
db.delete_index('representative_representative', ['faction_id'])
# Deleting model 'Faction'
db.delete_table('representative_faction')
# Adding field 'Representative.faction_en'
db.add_column('representative_representative', 'faction_en',
self.gf('django.db.models.fields.TextField')(null=True, blank=True),
keep_default=False)
# Adding field 'Representative.faction_ka'
db.add_column('representative_representative', 'faction_ka',
self.gf('django.db.models.fields.TextField')(null=True, blank=True),
keep_default=False)
# Renaming column for 'Representative.faction' to match new field type.
db.rename_column('representative_representative', 'faction_id', 'faction')
# Changing field 'Representative.faction'
db.alter_column('representative_representative', 'faction', self.gf('django.db.models.fields.TextField')(null=True))
# Adding M2M table for field parties on 'Cabinet'
m2m_table_name = db.shorten_name('representative_cabinet_parties')
db.create_table(m2m_table_name, (
('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
('cabinet', models.ForeignKey(orm['representative.cabinet'], null=False)),
('party', models.ForeignKey(orm['representative.party'], null=False))
))
db.create_unique(m2m_table_name, ['cabinet_id', 'party_id'])
# Removing M2M table for field factions on 'Cabinet'
db.delete_table(db.shorten_name('representative_cabinet_factions'))
开发者ID:araneta,项目名称:shenmartav,代码行数:33,代码来源:0024_auto__add_faction__del_field_representative_faction_en__del_field_repr.py
示例20: forwards
def forwards(self, orm):
# Renaming field 'Personne.mobile'
db.rename_column('chercheurs_personne', 'mobile', 'telephone')
# Adding field 'Personne.adresse_postale'
db.add_column('chercheurs_personne', 'adresse_postale', self.gf('django.db.models.fields.TextField')(default='', blank=True), keep_default=False)
开发者ID:auf,项目名称:www_savoirsenpartage_auf_org,代码行数:7,代码来源:0004_auto__del_field_personne_mobile__add_field_personne_telephone__add_fie.py
注:本文中的south.db.db.rename_column函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论