#34843: Feature request: Support postgres table storage options
-------------------------------------+-------------------------------------
               Reporter:  Anton-     |          Owner:  nobody
  Shutik                             |
                   Type:  New        |         Status:  new
  feature                            |
              Component:             |        Version:  3.2
  Migrations                         |       Keywords:  postgres,
               Severity:  Normal     |  autovacuum, storage options, django
           Triage Stage:             |  migrations
  Unreviewed                         |      Has patch:  0
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 There is a list of storage options
 (https://www.postgresql.org/docs/current/sql-createtable.html#SQL-
 CREATETABLE-STORAGE-PARAMETERS) that can be applied when creating a table
 in postgres database. So, since django manages database schema, it would
 be nice to extend it to support these storage options.

 It might look like:

 {{{
 class MyModel(db.Models):

     #  fields go here

     class Meta:
       storage_options = {
           "autovacuum_vacuum_scale_factor": 0.01,
           "autovacuum_vacuum_threshold": 1000
       }

 }}}

 and that would produce migration which eventually will run sql like this:

 `CREATE TABLE mymodel WITH (autovacuum_vacuum_scale_factor = 0.01,
 autovacuum_vacuum_threshold = 1000);`


 For now it could be done with `RunSQL(sql='ALTER TABLE .... WITH (...);')`
 migration, but it would be better to have the settings on the model class
 itself for better visibility and managed by django.

 What do you think ?

-- 
Ticket URL: <https://code.djangoproject.com/ticket/34843>
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/0107018a99497e04-de69b3db-a14d-4f42-bae1-371f1c351641-000000%40eu-central-1.amazonses.com.

Reply via email to