-
-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot test migrations if there is a collation in the migrations #343
Comments
I found this workaround: class TestMyMigration(MigratorTestCase):
databases = ("default", "my_db",)
database_name = "my_db"
# ...
def setUp(self) -> None:
sql.drop_models_tables(self.database_name)
sql.flush_django_migrations_table(self.database_name)
with connections["my_db"].cursor() as cursor:
cursor.execute("DROP COLLATION french")
super().setUp()
def test_my_migration(self):
pass |
hi 👋 Creating a collation is tricky because it's not a data migration, it's just changing the DB configuration/metadata. Probably the best solution will be to add some hook (something like, |
Yes, seems like a good idea. Something like |
Sounds great! |
@jrobichaud would you like to send a PR? :) |
I could give it a try. I have trouble finding meaningful names. For the TestCase it could work:
For the migrator:
In theory someone could want to run 4 different things depending if its before/after apply in forward/reverse migration. I only need before apply in forward migration. Any thoughts about this? |
Is anything needed for the migrator at all considering the user call it himself directly? He could just add the just before the function. I believe only the TestCase needs new functions. |
yes, that's true that when the developers are using the So I would add following arguments to
and for the
Optionally also |
I have a migration with a collation:
Ex:
When running the migration tests I have this error:
The text was updated successfully, but these errors were encountered: