| 320 | return "Validate constraint %s on model %s" % (self.name, self.model_name) |
| 321 | |
| 322 | def database_forwards(self, app_label, schema_editor, from_state, to_state): |
| 323 | model = from_state.apps.get_model(app_label, self.model_name) |
| 324 | if self.allow_migrate_model(schema_editor.connection.alias, model): |
| 325 | schema_editor.execute( |
| 326 | "ALTER TABLE %s VALIDATE CONSTRAINT %s" |
| 327 | % ( |
| 328 | schema_editor.quote_name(model._meta.db_table), |
| 329 | schema_editor.quote_name(self.name), |
| 330 | ) |
| 331 | ) |
| 332 | |
| 333 | def database_backwards(self, app_label, schema_editor, from_state, to_state): |
| 334 | # PostgreSQL does not provide a way to make a constraint invalid. |