Skip to content
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

Create triggers for tables in unmigrated apps when run_syncdb is specified #112

Open
danifus opened this issue Nov 9, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@danifus
Copy link
Contributor

danifus commented Nov 9, 2022

Django can create tables without migrations if an app is left 'unmigrated' (doesn't have a migrations package in the app) and the run_syncdb option is provided to the migrate command. By default tests are run with run_syncdb=True so unmigrated apps are created in the database. Django's tests use this feature extensively as it simplifies the testing workflow (changes to test models are immediately reflected in the test db without having to run makemigrations).

I would like to enhance django-pgtrigger so that triggers are created for unmigrated apps when run_syncdb=True

Here's the part of django's migrate command that creates the tables of unmigrated apps when run_syncdb option is set:

https://github.com/django/django/blob/1a7b6909ac030d2c4dae2664b08ee0bce9c4c915/django/core/management/commands/migrate.py#L321

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants