MCPcopy
hub / github.com/django/django / database_forwards

Method database_forwards

django/contrib/postgres/operations.py:322–331  ·  view source on GitHub ↗
(self, app_label, schema_editor, from_state, to_state)

Source from the content-addressed store, hash-verified

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.

Callers 1

test_validateMethod · 0.95

Calls 4

get_modelMethod · 0.45
allow_migrate_modelMethod · 0.45
executeMethod · 0.45
quote_nameMethod · 0.45

Tested by 1

test_validateMethod · 0.76