diff --git a/.github/workflows/test-python.yml b/.github/workflows/test-python.yml index 2053699c1..f7052f5fc 100644 --- a/.github/workflows/test-python.yml +++ b/.github/workflows/test-python.yml @@ -110,6 +110,8 @@ jobs: ordering or_lookups queries + schema.tests.SchemaTests.test_creation_deletion + schema.tests.SchemaTests.test_db_table select_related select_related_onetoone select_related_regress diff --git a/django_mongodb/schema.py b/django_mongodb/schema.py index 0b108557d..6a78b9a68 100644 --- a/django_mongodb/schema.py +++ b/django_mongodb/schema.py @@ -3,7 +3,10 @@ class DatabaseSchemaEditor(BaseDatabaseSchemaEditor): def create_model(self, model): - pass + self.connection.database.create_collection(model._meta.db_table) + + def delete_model(self, model): + self.connection.database[model._meta.db_table].drop() def add_field(self, model, field): pass @@ -14,11 +17,26 @@ def alter_field(self, model, old_field, new_field, strict=False): def remove_field(self, model, field): pass + def alter_index_together(self, model, old_index_together, new_index_together): + pass + def alter_unique_together(self, model, old_unique_together, new_unique_together): pass def add_index(self, model, index): pass + def rename_index(self, model, old_index, new_index): + pass + def remove_index(self, model, index): pass + + def add_constraint(self, model, constraint): + pass + + def remove_constraint(self, model, constraint): + pass + + def alter_db_table(self, model, old_db_table, new_db_table): + self.connection.database[old_db_table].rename(new_db_table)