class Meta: verbose_name = "ToDo" verbose_name_plural = "ToDos" indexes = [ Index(fields=["user", "is_done"]) ] ordering = ["-created_at"]
def create_sql(self, model, schema_editor, using=''): """Creates the actual SQL used when applying the migration.""" sql_create_index = self.sql_create_index sql_parameters = { **Index.get_sql_create_template_values(self, model, schema_editor, using), 'condition': self.condition } return sql_create_index % sql_parameters
class Meta: managed = False db_table = 'sys_menu' verbose_name = '메뉴' verbose_name_plural = '메뉴' constraints = [ UniqueConstraint(fields=['menu_cd', 'parent_menu_cd'], name='sys_menu_uk') ] indexes = [ Index(fields=['menu_name_ko', 'menu_name_en', 'url', 'use_yn'], name='sys_menu_ix1'), ]
def create_sql(self, model, schema_editor, using=''): """Creates the actual SQL used when applying the migration.""" if django.VERSION >= (2, 0): statement = super().create_sql(model, schema_editor, using) statement.template = self.sql_create_index statement.parts['condition'] = self.condition return statement else: sql_create_index = self.sql_create_index sql_parameters = { **Index.get_sql_create_template_values(self, model, schema_editor, using), 'condition': self.condition } return sql_create_index % sql_parameters
class Meta: indexes = [ Index(name='other-index', fields=['url']), ZomboDBIndex(url='http://localhost:9200/', fields=[ 'name', 'street', 'zip_code', 'city', 'state', 'phone', 'email', 'website', 'categories', ]), ]
class Meta: ordering = ('subject_identifier', 'status_date', '-created') indexes = [ Index(fields=['subject_identifier', 'status_date']), Index(fields=['subject_identifier', 'status_date', '-created']) ]