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

John Pulles john.pulles at gmail.com
Thu May 11 20:57:14 UTC 2006

2006/5/11, Adrian Rossouw <adrian at bryght.com>:
> Now that we have .install files for modules, I believe it is time we
> extended our database abstraction layer.

True,  it should  be sufficient to define a table structure only once in the
install file.

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);

These functions are a useful addition, but I am not sure if the developer
that defines tables for his module should need to use them. An alternative
for the install system could be that the structure of the tables is defined
in a xml file that can be validated before it is processed by the install

Kind regards,

John Pulles
http://mappingwidgets.sourceforge.net | carto module
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20060511/90f45743/attachment-0001.htm

More information about the development mailing list