#31693: Add setting to control installed PostgreSQL extensions.
-------------------------------------+-------------------------------------
     Reporter:  Markus Bertheau      |                    Owner:  nobody
         Type:                       |                   Status:  new
  Cleanup/optimization               |
    Component:  Migrations           |                  Version:  master
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Adam (Chainz) Johnson):

 I strongly recommend you do not disable migrations during tests.
 Migrations are highly important code that affect your most vital asset -
 your data. I wrote a whole section in my book [https://gumroad.com/l/suydt
 Speed Up Your Django Tests] against disabling migrations during tests.

 But... if you really want to continue on that route... You can run `CREATE
 EXTENSION`, or any arbitrary SQL, in a custom test runner's overridden
 `setup_databases()`. I have an example in my blog post
 [https://adamj.eu/tech/2020/06/11/avoid-hardcoding-ids-in-your-tests/ |
 How to Add Database Modifications Beyond Migrations to Your Django Project
 ].

 You could also override the `migrate` command to run SQL before or after
 it does the migrations. See example 2 in my post
 [https://adamj.eu/tech/2019/08/07/how-to-add-database-modifications-
 beyond-migrations-to-your-django-project/ How to Add Database
 Modifications Beyond Migrations to Your Django Project ].

-- 
Ticket URL: <https://code.djangoproject.com/ticket/31693#comment:4>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.30ca1a923a6fb0936d7a5179d68b303a%40djangoproject.com.

Reply via email to