A follow-up on my previous post, with a patch attached to make the 
db_table_options work, which was easy to put in.

Any comments on this patch, or something I looked over? Otherwise I make a 
feature request with it, unless I missed it while searching for an existing 
one..

-Geert

Geert Vanderkelen wrote:
> Hi!
> 
> I'm currently looking into a possibility to define per Model which MySQL 
> Storage Engine it should use for creating the table. This would need a new 
> option called 'db_table_option' for the Model.
> 
> Not only for MySQL would this be handy, for other backends as well. I think 
> for PostgreSQL the inheritance feature would need this too.
> 
> There has been discussion that you can set the default engine server wide, 
> and you can set it per session as well. But that's in lots of cases not what 
> people want and need.
> 
> For example, following should be possible:
> 
> CREATE TABLE t1 ( id int ) %db_table_options%;



-- 
Geert Vanderkelen
http://some-abstract-type.com


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers
-~----------~----~----~----~------~----~------~--~---
Index: db/models/options.py
===================================================================
--- db/models/options.py        (revision 3355)
+++ db/models/options.py        (working copy)
@@ -13,7 +13,8 @@
 
 DEFAULT_NAMES = ('verbose_name', 'db_table', 'ordering',
                  'unique_together', 'permissions', 'get_latest_by',
-                 'order_with_respect_to', 'app_label')
+                 'order_with_respect_to', 'app_label',
+                 'db_table_options')
 
 class Options(object):
     def __init__(self, meta):
@@ -21,6 +22,7 @@
         self.module_name, self.verbose_name = None, None
         self.verbose_name_plural = None
         self.db_table = ''
+        self.db_table_options = ''
         self.ordering = []
         self.unique_together =  []
         self.permissions =  []
Index: core/management.py
===================================================================
--- core/management.py  (revision 3355)
+++ core/management.py  (working copy)
@@ -184,7 +184,7 @@
     full_statement = [style.SQL_KEYWORD('CREATE TABLE') + ' ' + 
style.SQL_TABLE(backend.quote_name(opts.db_table)) + ' (']
     for i, line in enumerate(table_output): # Combine and add commas.
         full_statement.append('    %s%s' % (line, i < len(table_output)-1 and 
',' or ''))
-    full_statement.append(');')
+    full_statement.append(') %s ;' % (opts.db_table_options))
     final_output.append('\n'.join(full_statement))
 
     return final_output, pending_references

Reply via email to