[development] Extend database abstraction layer, to include table creation.

Chris Johnson chris at tinpixel.com
Thu May 11 19:20:00 UTC 2006

Adrian Rossouw wrote:
> http://drupal.org/node/63049
> Now that we have .install files for modules, I believe it is time we 
> extended our database abstraction layer.
> I recommend we create the following extra functions :
> 1. db_create_table($tablename, $columns); // columns is an associative 
> array with the 'name' => 'type'
> 3. db_drop_table($tablename);
> 3. db_create_index($tablename, $columns); // columns is an array of 
> column names, or just a single column.
> 4. db_drop_index($tablename, $columns);
> 5. db_add_column($tablename, $column, $type); // PGSQL already has a 
> similar function, but it isn't in both systems.
> 6. db_drop_column($tablename, $column);

I'm in favor of adding these functions -- but if and only if we also add 
a database privilege escalation feature for the site admin to use.  Many 
hosts with *better* security provide multiple database users with tiered 
privileges specifically so that web applications can access the database 
without full create/drop rights.  Widespread use of the above functions 
will break Drupal on those hosts.  (yes, that means my sites :-)


More information about the development mailing list