mirror of
https://github.com/django/django.git
synced 2025-10-29 00:26:07 +00:00
Add an Executor for end-to-end running
This commit is contained in:
@@ -16,13 +16,13 @@ class AddField(Operation):
|
||||
|
||||
def database_forwards(self, app_label, schema_editor, from_state, to_state):
|
||||
app_cache = to_state.render()
|
||||
model = app_cache.get_model(app_label, self.name)
|
||||
schema_editor.add_field(model, model._meta.get_field_by_name(self.name))
|
||||
model = app_cache.get_model(app_label, self.model_name)
|
||||
schema_editor.add_field(model, model._meta.get_field_by_name(self.name)[0])
|
||||
|
||||
def database_backwards(self, app_label, schema_editor, from_state, to_state):
|
||||
app_cache = from_state.render()
|
||||
model = app_cache.get_model(app_label, self.name)
|
||||
schema_editor.remove_field(model, model._meta.get_field_by_name(self.name))
|
||||
model = app_cache.get_model(app_label, self.model_name)
|
||||
schema_editor.remove_field(model, model._meta.get_field_by_name(self.name)[0])
|
||||
|
||||
|
||||
class RemoveField(Operation):
|
||||
@@ -43,10 +43,10 @@ class RemoveField(Operation):
|
||||
|
||||
def database_forwards(self, app_label, schema_editor, from_state, to_state):
|
||||
app_cache = from_state.render()
|
||||
model = app_cache.get_model(app_label, self.name)
|
||||
schema_editor.remove_field(model, model._meta.get_field_by_name(self.name))
|
||||
model = app_cache.get_model(app_label, self.model_name)
|
||||
schema_editor.remove_field(model, model._meta.get_field_by_name(self.name)[0])
|
||||
|
||||
def database_backwards(self, app_label, schema_editor, from_state, to_state):
|
||||
app_cache = to_state.render()
|
||||
model = app_cache.get_model(app_label, self.name)
|
||||
schema_editor.add_field(model, model._meta.get_field_by_name(self.name))
|
||||
model = app_cache.get_model(app_label, self.model_name)
|
||||
schema_editor.add_field(model, model._meta.get_field_by_name(self.name)[0])
|
||||
|
||||
Reference in New Issue
Block a user