Python south.db.db.create_unique() Examples
The following are 30
code examples of south.db.db.create_unique().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
south.db.db
, or try the search function
.
Example #1
Source File: 0001_initial.py From django-dashboard-app with MIT License | 6 votes |
def forwards(self, orm): # Adding model 'DashboardWidgetLastUpdate' db.create_table(u'dashboard_app_dashboardwidgetlastupdate', ( (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), ('widget_name', self.gf('django.db.models.fields.CharField')(unique=True, max_length=128)), ('last_update', self.gf('django.db.models.fields.DateTimeField')(auto_now=True, auto_now_add=True, blank=True)), )) db.send_create_signal(u'dashboard_app', ['DashboardWidgetLastUpdate']) # Adding model 'DashboardWidgetSettings' db.create_table(u'dashboard_app_dashboardwidgetsettings', ( (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), ('widget_name', self.gf('django.db.models.fields.CharField')(max_length=128)), ('setting_name', self.gf('django.db.models.fields.CharField')(max_length=128)), ('value', self.gf('django.db.models.fields.CharField')(max_length=4000)), )) db.send_create_signal(u'dashboard_app', ['DashboardWidgetSettings']) # Adding unique constraint on 'DashboardWidgetSettings', fields ['widget_name', 'setting_name'] db.create_unique(u'dashboard_app_dashboardwidgetsettings', ['widget_name', 'setting_name'])
Example #2
Source File: 0006_auto__add_flowbit.py From scirius with GNU General Public License v3.0 | 6 votes |
def forwards(self, orm): # Adding model 'Flowbit' db.create_table(u'rules_flowbit', ( (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), ('name', self.gf('django.db.models.fields.CharField')(max_length=100)), ('set', self.gf('django.db.models.fields.BooleanField')(default=False)), ('isset', self.gf('django.db.models.fields.BooleanField')(default=False)), ('enable', self.gf('django.db.models.fields.BooleanField')(default=True)), ('source', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['rules.Source'])), )) db.send_create_signal(u'rules', ['Flowbit']) # Adding M2M table for field flowbits on 'Rule' m2m_table_name = db.shorten_name(u'rules_rule_flowbits') db.create_table(m2m_table_name, ( ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), ('rule', models.ForeignKey(orm[u'rules.rule'], null=False)), ('flowbit', models.ForeignKey(orm[u'rules.flowbit'], null=False)) )) db.create_unique(m2m_table_name, ['rule_id', 'flowbit_id'])
Example #3
Source File: 0002_auto__add_project__add_unique_project_name_organization.py From kobo-predict with BSD 2-Clause "Simplified" License | 6 votes |
def forwards(self, orm): # Adding model 'Project' db.create_table('api_project', ( ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), ('name', self.gf('django.db.models.fields.CharField')(max_length=255)), ('organization', self.gf('django.db.models.fields.related.ForeignKey')(related_name='project_organization', to=orm['auth.User'])), ('created_by', self.gf('django.db.models.fields.related.ForeignKey')(related_name='project_creator', to=orm['auth.User'])), ('date_created', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)), ('date_modified', self.gf('django.db.models.fields.DateTimeField')(auto_now=True, blank=True)), )) db.send_create_signal('api', ['Project']) # Adding unique constraint on 'Project', fields ['name', 'organization'] db.create_unique('api_project', ['name', 'organization_id']) # Adding M2M table for field projects on 'Team' db.create_table('api_team_projects', ( ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), ('team', models.ForeignKey(orm['api.team'], null=False)), ('project', models.ForeignKey(orm['api.project'], null=False)) )) db.create_unique('api_team_projects', ['team_id', 'project_id'])
Example #4
Source File: 0001_initial.py From baobab with GNU General Public License v3.0 | 6 votes |
def forwards(self, orm): # Adding model 'Event' db.create_table(u'socialnetwork_event', ( (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), ('event', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['backoffice.Event'])), ('name', self.gf('django.db.models.fields.CharField')(max_length=10)), ('sn_id', self.gf('django.db.models.fields.CharField')(max_length=30)), )) db.send_create_signal(u'socialnetwork', ['Event']) # Adding unique constraint on 'Event', fields ['event', 'name'] db.create_unique(u'socialnetwork_event', ['event_id', 'name']) # Adding model 'EventLog' db.create_table(u'socialnetwork_eventlog', ( (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), ('eventlog', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['backoffice.EventLog'])), ('name', self.gf('django.db.models.fields.CharField')(max_length=10)), ('sn_id', self.gf('django.db.models.fields.CharField')(max_length=30)), )) db.send_create_signal(u'socialnetwork', ['EventLog']) # Adding unique constraint on 'EventLog', fields ['eventlog', 'name'] db.create_unique(u'socialnetwork_eventlog', ['eventlog_id', 'name'])
Example #5
Source File: 0078_auto__add_field_category_founder.py From canvas with BSD 3-Clause "New" or "Revised" License | 5 votes |
def forwards(self, orm): # Adding field 'Category.founder' db.add_column('canvas_category', 'founder', self.gf('django.db.models.fields.related.ForeignKey')(default=None, related_name='founded_categories', null=True, blank=True, to=orm['auth.User']), keep_default=False) # Adding M2M table for field moderators on 'Category' db.create_table('canvas_category_moderators', ( ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), ('category', models.ForeignKey(orm['canvas.category'], null=False)), ('user', models.ForeignKey(orm['auth.user'], null=False)) )) db.create_unique('canvas_category_moderators', ['category_id', 'user_id'])
Example #6
Source File: 0002_auto__add_field_userinfo_global_unique_id.py From builder with GNU Affero General Public License v3.0 | 5 votes |
def forwards(self, orm): # Adding field 'UserInfo.global_unique_id' db.add_column(u'main_userinfo', 'global_unique_id', self.gf('django.db.models.fields.CharField')(default=random_code, max_length=64), keep_default=False) # Initializing values of global_unique_id to their previous values if not db.dry_run: for user in orm.UserInfo.objects.all(): user.global_unique_id = get_unique_id(user.user_id) user.save() # Adding unique constraint on 'UserInfo', fields ['global_unique_id'] db.create_unique(u'main_userinfo', ['global_unique_id'])
Example #7
Source File: 0002_auto__add_field_userinfo_global_unique_id.py From builder with GNU Affero General Public License v3.0 | 5 votes |
def forwards(self, orm): # Adding field 'UserInfo.global_unique_id' db.add_column(u'main_userinfo', 'global_unique_id', self.gf('django.db.models.fields.CharField')(default=random_code, max_length=64), keep_default=False) # Initializing values of global_unique_id to their previous values if not db.dry_run: for user in orm.UserInfo.objects.all(): user.global_unique_id = get_unique_id(user.user_id) user.save() # Adding unique constraint on 'UserInfo', fields ['global_unique_id'] db.create_unique(u'main_userinfo', ['global_unique_id'])
Example #8
Source File: 0002_auto__del_unique_transaction_hash.py From ripple_api with BSD 3-Clause "New" or "Revised" License | 5 votes |
def backwards(self, orm): # Adding unique constraint on 'Transaction', fields ['hash'] db.create_unique('ripple_api_transaction', ['hash'])
Example #9
Source File: 0008_auto__del_field_rawmeeting_committee.py From legco-watch with MIT License | 5 votes |
def forwards(self, orm): # Deleting field 'RawMeeting.committee' db.delete_column(u'raw_rawmeeting', 'committee_id') # Adding M2M table for field committees on 'RawMeeting' m2m_table_name = db.shorten_name(u'raw_rawmeeting_committees') db.create_table(m2m_table_name, ( ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), ('rawmeeting', models.ForeignKey(orm[u'raw.rawmeeting'], null=False)), ('rawcommittee', models.ForeignKey(orm[u'raw.rawcommittee'], null=False)) )) db.create_unique(m2m_table_name, ['rawmeeting_id', 'rawcommittee_id'])
Example #10
Source File: 0015_auto__add_field_parsedmembership_person__add_field_parsedmembership_st.py From legco-watch with MIT License | 5 votes |
def backwards(self, orm): # Deleting field 'ParsedMembership.person' db.delete_column(u'raw_parsedmembership', 'person_id') # Deleting field 'ParsedMembership.start_date' db.delete_column(u'raw_parsedmembership', 'start_date') # Deleting field 'ParsedMembership.end_date' db.delete_column(u'raw_parsedmembership', 'end_date') # Deleting field 'ParsedMembership.method_obtained' db.delete_column(u'raw_parsedmembership', 'method_obtained') # Deleting field 'ParsedMembership.position' db.delete_column(u'raw_parsedmembership', 'position') # Deleting field 'ParsedMembership.note' db.delete_column(u'raw_parsedmembership', 'note') # Changing field 'ParsedMembership.uid' db.alter_column(u'raw_parsedmembership', 'uid', self.gf('django.db.models.fields.CharField')(max_length=100, unique=True)) # Adding unique constraint on 'ParsedMembership', fields ['uid'] db.create_unique(u'raw_parsedmembership', ['uid']) # Changing field 'ParsedPerson.uid' db.alter_column(u'raw_parsedperson', 'uid', self.gf('django.db.models.fields.CharField')(max_length=100, unique=True)) # Adding unique constraint on 'ParsedPerson', fields ['uid'] db.create_unique(u'raw_parsedperson', ['uid'])
Example #11
Source File: 0066_auto__chg_field_bestof_comment__add_unique_bestof_comment.py From canvas with BSD 3-Clause "New" or "Revised" License | 5 votes |
def forwards(self, orm): # Changing field 'BestOf.comment' db.alter_column('canvas_bestof', 'comment_id', self.gf('django.db.models.fields.related.ForeignKey')(unique=True, to=orm['canvas.Comment'])) # Adding unique constraint on 'BestOf', fields ['comment'] db.create_unique('canvas_bestof', ['comment_id'])
Example #12
Source File: 0077_auto__add_field_bestof_category__del_unique_bestof.py From canvas with BSD 3-Clause "New" or "Revised" License | 5 votes |
def backwards(self, orm): # Deleting field 'BestOf.category' db.delete_column('canvas_bestof', 'category_id') # Adding unique constraint on 'BestOf', fields ['comment'] db.create_unique('canvas_bestof', ['comment_id'])
Example #13
Source File: 0036_auto__del_post__del_hashtag__del_thread.py From canvas with BSD 3-Clause "New" or "Revised" License | 5 votes |
def backwards(self, orm): # Adding model 'Post' db.create_table('canvas_post', ( ('ip', self.gf('django.db.models.fields.IPAddressField')(default='0.0.0.0', max_length=15)), ('post_id', self.gf('django.db.models.fields.IntegerField')()), ('anonymous', self.gf('django.db.models.fields.BooleanField')(default=False)), ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), ('thumb_up', self.gf('django.db.models.fields.IntegerField')(default=0)), ('blacklisted', self.gf('django.db.models.fields.BooleanField')(default=False)), ('thread', self.gf('django.db.models.fields.related.ForeignKey')(related_name='posts', to=orm['canvas.Thread'])), ('author', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'])), ('thumb_down', self.gf('django.db.models.fields.IntegerField')(default=0)), ('timestamp', self.gf('django.db.models.fields.FloatField')()), ('hidden', self.gf('django.db.models.fields.BooleanField')(default=False)), ('content_id', self.gf('django.db.models.fields.CharField')(max_length=32, blank=True)), )) db.send_create_signal('canvas', ['Post']) # Adding model 'Hashtag' db.create_table('canvas_hashtag', ( ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), ('name', self.gf('django.db.models.fields.SlugField')(max_length=50, unique=True, db_index=True)), )) db.send_create_signal('canvas', ['Hashtag']) # Adding model 'Thread' db.create_table('canvas_thread', ( ('locked', self.gf('django.db.models.fields.BooleanField')(default=False)), ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), )) db.send_create_signal('canvas', ['Thread']) # Adding M2M table for field hashtags on 'Thread' db.create_table('canvas_thread_hashtags', ( ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), ('thread', models.ForeignKey(orm['canvas.thread'], null=False)), ('hashtag', models.ForeignKey(orm['canvas.hashtag'], null=False)) )) db.create_unique('canvas_thread_hashtags', ['thread_id', 'hashtag_id'])
Example #14
Source File: 0140_auto__add_unique_welcomeemailrecipient_recipient.py From canvas with BSD 3-Clause "New" or "Revised" License | 5 votes |
def forwards(self, orm): # Adding unique constraint on 'WelcomeEmailRecipient', fields ['recipient'] db.create_unique('canvas_welcomeemailrecipient', ['recipient_id'])
Example #15
Source File: 0011_auto.py From django-mmc with GNU General Public License v2.0 | 5 votes |
def forwards(self, orm): # Adding M2M table for field ignore on 'MMCEmail' m2m_table_name = db.shorten_name('mmc_mmcemail_ignore') db.create_table(m2m_table_name, ( ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), ('mmcemail', models.ForeignKey(orm['mmc.mmcemail'], null=False)), ('mmcscript', models.ForeignKey(orm['mmc.mmcscript'], null=False)) )) db.create_unique(m2m_table_name, ['mmcemail_id', 'mmcscript_id'])
Example #16
Source File: 0130_auto__add_unique_apiauthtoken_app_user.py From canvas with BSD 3-Clause "New" or "Revised" License | 5 votes |
def forwards(self, orm): # Adding unique constraint on 'APIAuthToken', fields ['app', 'user'] db.create_unique('canvas_apiauthtoken', ['app_id', 'user_id'])
Example #17
Source File: 0001_initial.py From canvas with BSD 3-Clause "New" or "Revised" License | 5 votes |
def forwards(self, orm): # Adding model 'Hashtag' db.create_table('canvas_hashtag', ( ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), ('name', self.gf('django.db.models.fields.SlugField')(unique=True, max_length=50, db_index=True)), )) db.send_create_signal('canvas', ['Hashtag']) # Adding model 'Thread' db.create_table('canvas_thread', ( ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), ('locked', self.gf('django.db.models.fields.BooleanField')(default=False)), )) db.send_create_signal('canvas', ['Thread']) # Adding M2M table for field hashtags on 'Thread' db.create_table('canvas_thread_hashtags', ( ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), ('thread', models.ForeignKey(orm['canvas.thread'], null=False)), ('hashtag', models.ForeignKey(orm['canvas.hashtag'], null=False)) )) db.create_unique('canvas_thread_hashtags', ['thread_id', 'hashtag_id']) # Adding model 'StashContent' db.create_table('canvas_stashcontent', ( ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), ('thread', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['canvas.Thread'], null=True)), ('post', self.gf('django.db.models.fields.IntegerField')(null=True)), ('content_id', self.gf('django.db.models.fields.CharField')(max_length=255)), ('user', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'])), )) db.send_create_signal('canvas', ['StashContent'])
Example #18
Source File: 0135_auto__add_unique_followcategory_category_user.py From canvas with BSD 3-Clause "New" or "Revised" License | 5 votes |
def forwards(self, orm): # Adding unique constraint on 'FollowCategory', fields ['category', 'user'] db.create_unique('canvas_followcategory', ['category_id', 'user_id'])
Example #19
Source File: 0044_add_stamps_used_m2m_table.py From canvas with BSD 3-Clause "New" or "Revised" License | 5 votes |
def forwards(self, orm): # Adding M2M table for field stamps_used on 'Content' db.create_table('canvas_content_stamps_used', ( ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), ('from_content', models.ForeignKey(orm['canvas.content'], null=False)), ('to_content', models.ForeignKey(orm['canvas.content'], null=False)) )) db.create_unique('canvas_content_stamps_used', ['from_content_id', 'to_content_id'])
Example #20
Source File: 0004_auto__add_unique_emailconfirmation_user.py From canvas with BSD 3-Clause "New" or "Revised" License | 5 votes |
def forwards(self, orm): # Adding unique constraint on 'EmailConfirmation', fields ['user'] db.create_unique('user_settings_emailconfirmation', ['user_id'])
Example #21
Source File: 0005_auto__add_unique_activity_key_activity_type.py From canvas with BSD 3-Clause "New" or "Revised" License | 5 votes |
def forwards(self, orm): # Adding unique constraint on 'Activity', fields ['key', 'activity_type'] db.create_unique('activity_activity', ['key', 'activity_type'])
Example #22
Source File: 0002_auto__add_unstar__add_unique_unstar_comment_user.py From canvas with BSD 3-Clause "New" or "Revised" License | 5 votes |
def forwards(self, orm): # Adding model 'Unstar' db.create_table('stars_unstar', ( ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), ('comment', self.gf('django.db.models.fields.related.OneToOneField')(to=orm['canvas.Comment'], unique=True)), ('user', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'])), )) db.send_create_signal('stars', ['Unstar']) # Adding unique constraint on 'Unstar', fields ['comment', 'user'] db.create_unique('stars_unstar', ['comment_id', 'user_id'])
Example #23
Source File: 0003_auto__add_unique_playback_comment_viewer.py From canvas with BSD 3-Clause "New" or "Revised" License | 5 votes |
def forwards(self, orm): # Adding unique constraint on 'Playback', fields ['comment', 'viewer'] db.create_unique('playback_playback', ['comment_id', 'viewer_id'])
Example #24
Source File: 0001_initial.py From django-email-confirm-la with MIT License | 5 votes |
def forwards(self, orm): # Adding model 'EmailConfirmation' db.create_table('email_confirm_la_emailconfirmation', ( ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), ('content_type', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['contenttypes.ContentType'])), ('object_id', self.gf('django.db.models.fields.PositiveIntegerField')()), ('email_field_name', self.gf('django.db.models.fields.CharField')(max_length=32, default='email')), ('email', self.gf('django.db.models.fields.EmailField')(db_index=True, max_length=75)), ('confirmation_key', self.gf('django.db.models.fields.CharField')(max_length=64, unique=True)), ('send_at', self.gf('django.db.models.fields.DateTimeField')(blank=True, db_index=True, null=True)), )) db.send_create_signal('email_confirm_la', ['EmailConfirmation']) # Adding unique constraint on 'EmailConfirmation', fields ['content_type', 'object_id', 'email_field_name'] db.create_unique('email_confirm_la_emailconfirmation', ['content_type_id', 'object_id', 'email_field_name'])
Example #25
Source File: 0004_auto__add_eventtheme__add_eventaudience.py From coding-events with MIT License | 5 votes |
def forwards(self, orm): # Adding model 'EventTheme' db.create_table( u'api_eventtheme', ((u'id', self.gf('django.db.models.fields.AutoField')( primary_key=True)), ('name', self.gf('django.db.models.fields.CharField')( max_length=255)), )) db.send_create_signal('api', ['EventTheme']) # Adding model 'EventAudience' db.create_table( u'api_eventaudience', ((u'id', self.gf('django.db.models.fields.AutoField')( primary_key=True)), ('name', self.gf('django.db.models.fields.CharField')( max_length=255)), )) db.send_create_signal('api', ['EventAudience']) # Adding M2M table for field audience on 'Event' m2m_table_name = db.shorten_name(u'api_event_audience') db.create_table(m2m_table_name, ( ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), ('event', models.ForeignKey(orm['api.event'], null=False)), ('eventaudience', models.ForeignKey(orm['api.eventaudience'], null=False)) )) db.create_unique(m2m_table_name, ['event_id', 'eventaudience_id']) # Adding M2M table for field theme on 'Event' m2m_table_name = db.shorten_name(u'api_event_theme') db.create_table(m2m_table_name, ( ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), ('event', models.ForeignKey(orm['api.event'], null=False)), ('eventtheme', models.ForeignKey(orm['api.eventtheme'], null=False)) )) db.create_unique(m2m_table_name, ['event_id', 'eventtheme_id'])
Example #26
Source File: 0002_auto__del_unique_xform_id_string__add_unique_xform_id_string_user.py From kobo-predict with BSD 2-Clause "Simplified" License | 5 votes |
def forwards(self, orm): # Removing unique constraint on 'XForm', fields ['id_string'] db.delete_unique('odk_logger_xform', ['id_string']) # Adding unique constraint on 'XForm', fields ['id_string', 'user'] db.create_unique('odk_logger_xform', ['id_string', 'user_id'])
Example #27
Source File: 0007_auto__add_unique_mysecondmodel_name.py From django_migration_testcase with MIT License | 5 votes |
def forwards(self, orm): # Adding unique constraint on 'MySecondModel', fields ['name'] db.create_unique('test_app_mysecondmodel', ['name'])
Example #28
Source File: 0007_auto__add_unique_mysecondmodel_name.py From django_migration_testcase with MIT License | 5 votes |
def forwards(self, orm): # Adding unique constraint on 'MySecondModel', fields ['name'] db.create_unique('test_app_mysecondmodel', ['name'])
Example #29
Source File: 0007_auto__add_unique_mysecondmodel_name.py From django_migration_testcase with MIT License | 5 votes |
def forwards(self, orm): # Adding unique constraint on 'MySecondModel', fields ['name'] db.create_unique('test_app_mysecondmodel', ['name'])
Example #30
Source File: 0007_auto__add_unique_mysecondmodel_name.py From django_migration_testcase with MIT License | 5 votes |
def forwards(self, orm): # Adding unique constraint on 'MySecondModel', fields ['name'] db.create_unique('test_app_mysecondmodel', ['name'])