(self, model, schema_editor)
| 115 | return sql % tuple(schema_editor.quote_value(p) for p in params) |
| 116 | |
| 117 | def constraint_sql(self, model, schema_editor): |
| 118 | query = Query(model, alias_cols=False) |
| 119 | compiler = query.get_compiler(connection=schema_editor.connection) |
| 120 | expressions = self._get_expressions(schema_editor, query) |
| 121 | table = model._meta.db_table |
| 122 | condition = self._get_condition_sql(compiler, schema_editor, query) |
| 123 | include = [ |
| 124 | model._meta.get_field(field_name).column for field_name in self.include |
| 125 | ] |
| 126 | return Statement( |
| 127 | self.template, |
| 128 | table=Table(table, schema_editor.quote_name), |
| 129 | name=schema_editor.quote_name(self.name), |
| 130 | index_type=self.index_type, |
| 131 | expressions=Expressions( |
| 132 | table, expressions, compiler, schema_editor.quote_value |
| 133 | ), |
| 134 | where=" WHERE (%s)" % condition if condition else "", |
| 135 | include=schema_editor._index_include_sql(model, include), |
| 136 | deferrable=schema_editor._deferrable_constraint_sql(self.deferrable), |
| 137 | ) |
| 138 | |
| 139 | def create_sql(self, model, schema_editor): |
| 140 | return Statement( |
no test coverage detected