本文整理汇总了Python中south.db.db.create_index函数的典型用法代码示例。如果您正苦于以下问题:Python create_index函数的具体用法?Python create_index怎么用?Python create_index使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了create_index函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: forwards
def forwards(self, orm):
# Deleting field 'UserProfile.occupation'
db.delete_column('auth_userprofile', 'occupation')
# Deleting field 'UserProfile.telephone_number'
db.delete_column('auth_userprofile', 'telephone_number')
# Deleting field 'UserProfile.date_of_birth'
db.delete_column('auth_userprofile', 'date_of_birth')
# Deleting field 'UserProfile.country'
db.delete_column('auth_userprofile', 'country')
# Adding field 'UserProfile.year_of_birth'
db.add_column('auth_userprofile', 'year_of_birth',
self.gf('django.db.models.fields.IntegerField')(
db_index=True, null=True, blank=True),
keep_default=False)
# Adding field 'UserProfile.level_of_education'
db.add_column('auth_userprofile', 'level_of_education',
self.gf('django.db.models.fields.CharField')(
db_index=True, max_length=6, null=True, blank=True),
keep_default=False)
# Adding field 'UserProfile.goals'
db.add_column('auth_userprofile', 'goals',
self.gf('django.db.models.fields.TextField')(
null=True, blank=True),
keep_default=False)
# Adding index on 'UserProfile', fields ['gender']
db.create_index('auth_userprofile', ['gender'])
开发者ID:hughdbrown,项目名称:edx-platform,代码行数:33,代码来源:0019_create_approved_demographic_fields_fall_2012.py
示例2: forwards
def forwards(self, orm):
# Deleting field 'SellerRateChart.ext_category_id'
db.delete_column('catalog_sellerratechart', 'ext_category_id')
# Deleting field 'SellerRateChart.ext_category_name'
db.delete_column('catalog_sellerratechart', 'ext_category_name')
# Deleting field 'SellerRateChart.unit_list_price'
db.delete_column('catalog_sellerratechart', 'unit_list_price')
# Deleting field 'SellerRateChart.unit_offer_price'
db.delete_column('catalog_sellerratechart', 'unit_offer_price')
# Deleting field 'SellerRateChart.old_id'
db.delete_column('catalog_sellerratechart', 'old_id')
# Deleting field 'SellerRateChart.unit_transfer_price'
db.delete_column('catalog_sellerratechart', 'unit_transfer_price')
# Adding field 'SellerRateChart.list_price'
db.add_column('catalog_sellerratechart', 'list_price', self.gf('django.db.models.fields.DecimalField')(null=True, max_digits=10, decimal_places=2), keep_default=False)
# Adding field 'SellerRateChart.transfer_price'
db.add_column('catalog_sellerratechart', 'transfer_price', self.gf('django.db.models.fields.DecimalField')(null=True, max_digits=10, decimal_places=2), keep_default=False)
# Adding field 'SellerRateChart.offer_price'
db.add_column('catalog_sellerratechart', 'offer_price', self.gf('django.db.models.fields.DecimalField')(null=True, max_digits=10, decimal_places=2), keep_default=False)
# Adding field 'SellerRateChart.status'
db.add_column('catalog_sellerratechart', 'status', self.gf('django.db.models.fields.CharField')(default='active', max_length=25, db_index=True), keep_default=False)
# Adding index on 'SellerRateChart', fields ['sku']
db.create_index('catalog_sellerratechart', ['sku'])
开发者ID:Morphnus-IT-Solutions,项目名称:riba,代码行数:34,代码来源:0013_auto__del_field_sellerratechart_ext_category_id__del_field_sellerratec.py
示例3: backwards
def backwards(self, orm):
# Adding index on 'PurpleRobotDevice', fields ['device_id']
db.create_index(u'purple_robot_app_purplerobotdevice', ['device_id'])
# Changing field 'PurpleRobotDevice.device_id'
db.alter_column(u'purple_robot_app_purplerobotdevice', 'device_id', self.gf('django.db.models.fields.SlugField')(max_length=256, unique=True))
开发者ID:aucontraire,项目名称:Purple-Robot-Django,代码行数:7,代码来源:0019_auto__chg_field_purplerobotdevice_device_id__del_index_purplerobotdevi.py
示例4: 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
示例5: forwards
def forwards(self):
# Model 'ArticleCategory'
db.create_table('articles_articlecategory', (
('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
('name', models.CharField(_("Name"), max_length=255)),
('slug', models.SlugField(_("Slug"), max_length=255, unique=True)),
('theme', models.CharField(_("Colour Theme"), max_length=10, choices=THEME_CHOICES)),
('featured', models.BooleanField(_("Featured"), default=False)),
))
# Mock Models
ArticleCategory = db.mock_model(model_name='ArticleCategory', db_table='articles_articlecategory', db_tablespace='', pk_field_name='id', pk_field_type=models.AutoField, pk_field_args=[], pk_field_kwargs={})
# Model 'Article'
db.create_table('articles_article', (
('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
('title', models.CharField(_("Title"), max_length=255)),
('slug', models.SlugField(_("Slug"), max_length=255)),
('summary', models.TextField(_("Summary"), blank=True)),
('body', models.TextField(_("Body"), blank=True)),
('category', models.ForeignKey(ArticleCategory, verbose_name=_("Category"))),
('tags', TagField(_("Tags"))),
('featured', models.BooleanField(_("Featured"), default=False)),
('published', models.BooleanField(_("Published"), default=True)),
('publication_date', models.DateTimeField(_("Publication Date"), default=datetime.now)),
('expiration_date', models.DateTimeField(_("Expiration Date"), blank=True, null=True)),
('creation_date', models.DateTimeField(_("Creation Date"), editable=False, auto_now_add=True)),
('modification_date', models.DateTimeField(_("Modification Date"), editable=False, auto_now=True)),
('view_count', models.PositiveIntegerField(_("View Count"), editable=False, default=0)),
))
db.create_index('articles_article', ['slug','publication_date','category_id'], unique=True, db_tablespace='')
db.send_create_signal('articles', ['ArticleCategory','Article'])
开发者ID:taylanpince,项目名称:alghalia,代码行数:35,代码来源:0001_initial.py
示例6: forwards
def forwards(self, orm):
# Adding model 'RawStatistics'
db.create_table('user_billing_raw_statistics', (
(u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('insert_time', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)),
('data', self.gf('django.db.models.fields.TextField')()),
))
#db.send_create_signal(u'user_billing', ['RawStatistics'])
# Adding model 'RawStatisticsIndex'
db.create_table('user_billing_raw_statistics_index', (
(u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('year', self.gf('django.db.models.fields.IntegerField')()),
('month', self.gf('django.db.models.fields.IntegerField')()),
('meter', self.gf('django.db.models.fields.CharField')(max_length=64)),
('user_id', self.gf('django.db.models.fields.CharField')(max_length=64)),
('fetched', self.gf('django.db.models.fields.BooleanField')(default=False, db_index=True)),
('raw_statistics', self.gf('django.db.models.fields.related.OneToOneField')(default=-1, to=orm['user_billing.RawStatistics'], unique=True)),
('billed', self.gf('django.db.models.fields.BooleanField')(default=False, db_index=True)),
))
#db.send_create_signal(u'user_billing', ['RawStatisticsIndex'])
# Adding unique constraint on 'RawStatisticsIndex', fields ['user_id', 'month', 'meter', 'year']
db.create_unique('user_billing_raw_statistics_index', ['user_id', 'month', 'meter', 'year'])
# Adding index on 'RawStatisticsIndex', fields ['user_id', 'month', 'meter', 'year']
db.create_index('user_billing_raw_statistics_index', ['user_id', 'month', 'meter', 'year'])
开发者ID:kili,项目名称:dashboard,代码行数:27,代码来源:0002_initial.py
示例7: forwards
def forwards(self, orm):
# Renaming column for 'iSCSITarget.iscsi_target_portalgroup' to match new field type.
db.rename_column("services_iscsitarget", "iscsi_target_portalgroup", "iscsi_target_portalgroup_id")
# Changing field 'iSCSITarget.iscsi_target_portalgroup'
db.alter_column(
"services_iscsitarget",
"iscsi_target_portalgroup_id",
self.gf("django.db.models.fields.related.ForeignKey")(to=orm["services.iSCSITargetPortal"]),
)
# Adding index on 'iSCSITarget', fields ['iscsi_target_portalgroup']
db.create_index("services_iscsitarget", ["iscsi_target_portalgroup_id"])
# Renaming column for 'iSCSITarget.iscsi_target_initiatorgroup' to match new field type.
db.rename_column("services_iscsitarget", "iscsi_target_initiatorgroup", "iscsi_target_initiatorgroup_id")
# Changing field 'iSCSITarget.iscsi_target_initiatorgroup'
db.alter_column(
"services_iscsitarget",
"iscsi_target_initiatorgroup_id",
self.gf("django.db.models.fields.related.ForeignKey")(to=orm["services.iSCSITargetAuthorizedInitiator"]),
)
# Adding index on 'iSCSITarget', fields ['iscsi_target_initiatorgroup']
db.create_index("services_iscsitarget", ["iscsi_target_initiatorgroup_id"])
开发者ID:BillTheBest,项目名称:MetaNAS,代码行数:25,代码来源:0017_auto__chg_field_iscsitarget_iscsi_target_portalgroup__chg_field_iscsit.py
示例8: forwards
def forwards(self, orm):
# Adding index on 'Feed', fields ['active_subscribers']
db.create_index('feeds', ['active_subscribers'])
# Adding index on 'Feed', fields ['active']
db.create_index('feeds', ['active'])
开发者ID:0077cc,项目名称:NewsBlur,代码行数:7,代码来源:0032_indexes_on_feeds.py
示例9: backwards
def backwards(self, orm):
# Adding index on 'PageContent', fields ['key']
db.create_index(u'apollo_pagecontent', ['key'])
# Changing field 'PageContent.key'
db.alter_column(u'apollo_pagecontent', 'key', self.gf('django.db.models.fields.SlugField')(max_length=50))
开发者ID:dbroudy,项目名称:django-apollo,代码行数:7,代码来源:0002_change_slug_complex_keys.py
示例10: forwards
def forwards(self, orm):
# Changing field 'Category.slug'
db.alter_column('qa_category', 'slug', self.gf('django.db.models.fields.SlugField')(unique=True, max_length=255))
# Changing field 'Category.name'
db.alter_column('qa_category', 'name', self.gf('django.db.models.fields.CharField')(unique=True, max_length=255))
# Changing field 'Reference.name'
db.alter_column('qa_reference', 'name', self.gf('django.db.models.fields.CharField')(max_length=255))
# Changing field 'Test.name'
db.alter_column('qa_test', 'name', self.gf('django.db.models.fields.CharField')(unique=True, max_length=255))
if 'sql_server' in engine:
sql_server_idxs = (('qa_testlist', 'name'), ('qa_testlistcycle', 'name'),)
for table_name, column_name in sql_server_idxs:
try:
db.drop_index(table_name, column_name)
except:
pass
# sqlserver_utils.drop_index(db,table_name,column_name)
# Changing field 'TestList.name'
db.alter_column('qa_testlist', 'name', self.gf('django.db.models.fields.CharField')(max_length=255))
# Changing field 'TestListCycle.name'
db.alter_column('qa_testlistcycle', 'name', self.gf('django.db.models.fields.CharField')(max_length=255))
if 'sql_server' in engine:
for table_name, column_name in sql_server_idxs:
db.create_index(table_name, [column_name])
开发者ID:jrkerns,项目名称:qatrackplus,代码行数:32,代码来源:0003_auto__chg_field_category_slug__chg_field_category_name__chg_field_refe.py
示例11: forwards
def forwards(self, orm):
db.alter_column('core_placement', 'publishable_id', models.ForeignKey(orm['core.Publishable'], null=False))
db.create_index('core_placement', ['publishable_id'])
db.delete_unique('core_placement', ('target_ct_id', 'target_id', 'category_id'))
db.delete_column('core_placement', 'target_ct_id')
db.delete_column('core_placement', 'target_id')
开发者ID:goldsoft1206,项目名称:ella,代码行数:7,代码来源:0002_04_type_columns.py
示例12: forwards
def forwards(self, orm):
# Adding model 'ProjectDomain'
db.create_table('sentry_projectdomain', (
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('project', self.gf('django.db.models.fields.related.ForeignKey')(related_name='domain_set', to=orm['sentry.Project'])),
('domain', self.gf('django.db.models.fields.CharField')(max_length=128)),
))
db.send_create_signal('sentry', ['ProjectDomain'])
# Adding unique constraint on 'ProjectDomain', fields ['project', 'domain']
db.create_unique('sentry_projectdomain', ['project_id', 'domain'])
sid = transaction.savepoint()
try:
# Adding index on 'Message', fields ['checksum']
db.create_index('sentry_message', ['checksum'])
except:
transaction.savepoint_rollback(sid)
sid = transaction.savepoint()
try:
# Adding index on 'Message', fields ['checksum']
db.create_index('sentry_groupedmessage', ['checksum'])
except:
transaction.savepoint_rollback(sid)
开发者ID:Erkan-Yilmaz,项目名称:sentry,代码行数:26,代码来源:0020_auto__add_projectdomain__add_unique_projectdomain_project_domain.py
示例13: forwards
def forwards(self, orm):
# Adding index on 'EntityTypeName', fields ['language_code']
db.create_index("places_entitytypename", ["language_code"])
# Adding index on 'EntityGroupName', fields ['language_code']
db.create_index("places_entitygroupname", ["language_code"])
开发者ID:RCGTDev,项目名称:mollyproject,代码行数:7,代码来源:0015_add_index_EntityTypeName_language_code_add_index_EntityGroupName_language_code.py
示例14: forwards
def forwards(self, orm):
# Deleting field 'Banner.width'
db.delete_column(u'banners_banner', 'width')
# Deleting field 'Banner.height'
db.delete_column(u'banners_banner', 'height')
# Adding field 'Banner.is_active'
db.add_column(u'banners_banner', 'is_active',
self.gf('django.db.models.fields.BooleanField')(default=True),
keep_default=False)
# Adding field 'Placement.name'
db.add_column(u'banners_placement', 'name',
self.gf('django.db.models.fields.CharField')(default=u'', max_length=255),
keep_default=False)
# Adding field 'Placement.is_active'
db.add_column(u'banners_placement', 'is_active',
self.gf('django.db.models.fields.BooleanField')(default=True),
keep_default=False)
# Adding field 'Zone.is_active'
db.add_column(u'banners_zone', 'is_active',
self.gf('django.db.models.fields.BooleanField')(default=True),
keep_default=False)
# Adding index on 'Zone', fields ['english_name']
db.create_index(u'banners_zone', ['english_name'])
开发者ID:grengojbo,项目名称:django-banners,代码行数:29,代码来源:0005_auto__del_field_banner_width__del_field_banner_height__add_field_banne.py
示例15: forwards
def forwards(self, orm):
# Adding model 'WeightBased'
db.create_table('shipping_weightbased', (
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('code', self.gf('django.db.models.fields.SlugField')(unique=True, max_length=128, db_index=True)),
('name', self.gf('django.db.models.fields.CharField')(unique=True, max_length=128)),
('description', self.gf('django.db.models.fields.TextField')(blank=True)),
('upper_charge', self.gf('django.db.models.fields.DecimalField')(null=True, max_digits=12, decimal_places=2)),
))
db.send_create_signal('shipping', ['WeightBased'])
# Changing field 'OrderAndItemCharges.code'
db.alter_column('shipping_orderanditemcharges', 'code', self.gf('django.db.models.fields.SlugField')(unique=True, max_length=128))
# Adding index on 'OrderAndItemCharges', fields ['code']
db.create_index('shipping_orderanditemcharges', ['code'])
# Adding unique constraint on 'OrderAndItemCharges', fields ['name']
db.create_unique('shipping_orderanditemcharges', ['name'])
# Deleting field 'WeightBand.method_code'
db.delete_column('shipping_weightband', 'method_code')
# Adding field 'WeightBand.method'
db.add_column('shipping_weightband', 'method',
self.gf('django.db.models.fields.related.ForeignKey')(default=1, related_name='bands', to=orm['shipping.WeightBased']), keep_default=False)
开发者ID:AjitHimself,项目名称:Houseofhaus,代码行数:27,代码来源:0003_auto__add_weightbased__chg_field_orderanditemcharges_code__add_unique_.py
示例16: backwards
def backwards(self, orm):
# Adding index on 'Species', fields ['name']
db.create_index(u'backend_species', ['name'])
# Adding index on 'Species', fields ['name_en']
db.create_index(u'backend_species', ['name_en'])
# Adding index on 'Species', fields ['name_it']
db.create_index(u'backend_species', ['name_it'])
# Adding index on 'Species', fields ['name_fr']
db.create_index(u'backend_species', ['name_fr'])
# Adding index on 'Individual', fields ['name']
db.create_index(u'backend_individual', ['name'])
# Adding field 'Area.codezone'
db.add_column(u'backend_area', 'codezone',
self.gf('django.db.models.fields.CharField')(default='', max_length=20, blank=True),
keep_default=False)
# Adding M2M table for field species on 'Area'
m2m_table_name = db.shorten_name(u'backend_area_species')
db.create_table(m2m_table_name, (
('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
('area', models.ForeignKey(orm[u'backend.area'], null=False)),
('species', models.ForeignKey(orm[u'backend.species'], null=False))
))
db.create_unique(m2m_table_name, ['area_id', 'species_id'])
# Changing field 'Snowing.observer'
db.alter_column(u'backend_snowing', 'observer_id', self.gf('select2.fields.ForeignKey')(to=orm['backend.Observer'], search_field=''))
开发者ID:makinacorpus,项目名称:phenology-backend,代码行数:33,代码来源:0024_auto__del_field_area_codezone__del_index_individual_name__chg_field_sn.py
示例17: backwards
def backwards(self, orm):
# Adding index on 'PaperSubmission', fields ['slug']
db.create_index(u'papers_papersubmission', ['slug'])
# Changing field 'PaperSubmission.slug'
db.alter_column(u'papers_papersubmission', 'slug', self.gf('django.db.models.fields.SlugField')(max_length=100))
开发者ID:zetas,项目名称:django-writer,代码行数:7,代码来源:0005_auto__chg_field_papersubmission_slug__del_index_papersubmission_slug.py
示例18: forwards
def forwards(self, orm):
# Changing field 'InstitutionDetails.number_id'
db.alter_column('edumanage_institutiondetails', 'number_id', self.gf('django.db.models.fields.PositiveIntegerField')(max_length=6, null=True, blank=True))
# Deleting field 'InstRealmMon.instid'
db.delete_column('edumanage_instrealmmon', 'instid_id')
# Renaming column for 'InstRealmMon.realm' to match new field type.
db.rename_column('edumanage_instrealmmon', 'realm', 'realm_id')
# Changing field 'InstRealmMon.realm'
# WORKAROUND NEEDED
# This migration breaks with PostgreSQL with:
# ERROR: column "realm_id" cannot be cast automatically to type integer
# HINT: Specify a USING expression to perform the conversion.
# STATEMENT: ALTER TABLE "edumanage_instrealmmon" ALTER COLUMN "realm_id" TYPE integer,
# ALTER COLUMN "realm_id" SET NOT NULL, ALTER COLUMN "realm_id" DROP DEFAULT;
# This is a known problem: http://south.aeracode.org/ticket/484
# (PostgreSQL will not automatically convert and conversion must be provided with the USING clause)
# Workaround: For PostgreSQL invoke a direct SQL statement amended with a USING clause to do the converion explicitly.
# Credits:
# * http://codeinthehole.com/writing/altering-postgres-table-columns-with-south/
# * http://stackoverflow.com/questions/13170570/change-type-of-varchar-field-to-integer-cannot-be-cast-automatically-to-type-i
if ( db._get_connection().vendor == "postgresql" ):
db.execute('ALTER TABLE "edumanage_instrealmmon" ALTER COLUMN "realm_id" TYPE integer USING (trim(realm_id)::integer), ALTER COLUMN "realm_id" SET NOT NULL, ALTER COLUMN "realm_id" DROP DEFAULT;')
else:
db.alter_column('edumanage_instrealmmon', 'realm_id', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['edumanage.InstRealm']))
# Adding index on 'InstRealmMon', fields ['realm']
db.create_index('edumanage_instrealmmon', ['realm_id'])
# Changing field 'InstRealmMon.mon_type'
db.alter_column('edumanage_instrealmmon', 'mon_type', self.gf('django.db.models.fields.CharField')(max_length=16))
开发者ID:reuna,项目名称:djnro,代码行数:33,代码来源:0022_auto__chg_field_institutiondetails_number_id__del_field_instrealmmon_i.py
示例19: forwards
def forwards(self, orm):
# Changing field 'Spell.altname'
db.alter_column('spell', 'altname', self.gf('django.db.models.fields.SlugField')(max_length=64))
# Adding index on 'Spell', fields ['altname']
db.create_index('spell', ['altname'])
开发者ID:PathfinderRPG,项目名称:django-srd20,代码行数:7,代码来源:0005_auto__chg_field_spell_altname.py
示例20: forwards
def forwards(self, orm):
# Changing field 'Page.titre_url'
db.alter_column('story_page', 'titre_url', self.gf('django.db.models.fields.SlugField')(max_length=50))
# Adding index on 'Page', fields ['titre_url']
db.create_index('story_page', ['titre_url'])
开发者ID:MrGecko,项目名称:jpdebonbon,代码行数:7,代码来源:0002_auto__chg_field_page_titre_url.py
注:本文中的south.db.db.create_index函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论