[drupal-devel] [feature] Database Table Creation Script

justin3 drupal-devel at drupal.org
Fri Jul 15 23:00:30 UTC 2005


Issue status update for 
http://drupal.org/node/20530
Post a follow up: 
http://drupal.org/project/comments/add/20530

 Project:      Drupal
 Version:      cvs
 Component:    base system
 Category:     feature requests
 Priority:     normal
 Assigned to:  Anonymous
 Reported by:  danielc
 Updated by:   justin3
 Status:       patch

Would it be possible to change this value in the create.php script


  $sites_dir   = '../sites';


change '../sites'  to '../newsites'


would this allow me add two new directories with their settings.php
file into the 'newsites' folder and have these table-prefixes added by
the script, then i could move the new sites to the regular 'sites'
folder...?




justin3



Previous comments:
------------------------------------------------------------------------

April 14, 2005 - 16:27 : danielc

Attachment: http://drupal.org/files/issues/create.php.v1.txt (11.43 KB)

Attached is a PHP script that creates all of the database tables for all
sites in /drupal/sites/*.


It works with CVS checkouts of either HEAD or the DRUPAL-4-6 branch as
of 2005-04-14 19:00 UTC.


Until it gets added to CVS, you can use it by saving the latest version
of the file from this page, rename it "create.php" and put it in the
"/drupal/database" directory.  Then either execute it from the command
line or point your web browser to it.  For exact usage instructions,
read the documentation inside the script.




------------------------------------------------------------------------

April 17, 2005 - 10:21 : nkurz

Thanks Daniel!


I got it, used it, and it worked fine.  Documentation and instructions
were very clear.  I had to modify a bit because I had already created
the set of tables for my 'default' site,  so at first it failed because
the 'access' table already existed.  I got around this by just putting
in a hardcoded test for 'if ($site == 'default') {continue;}, but
obviously this isn't a general solution.


It would probably be good (if you are interested in making this more
generally useful) to add a way to specify which sites to create tables
for, or alternatively which sites to ignore creating tables for.  I'm
guessing that many people (like me) are going to want something like
this when the add a new site, and not only when there are setting up a
new system.  The easiest way of doing this might be to just change the
error handling if a table creation fails.  Instead of stopping, it
could just ignore the error and continue.


--nate




------------------------------------------------------------------------

April 17, 2005 - 14:56 : danielc

Nate:


> it worked fine.


Good.


> add a way to specify which sites to create tables for


Simple.  Temporarily those directories out of /drupal/sites.  Though
that would cause problems for live sites.


> The easiest way of doing this might be to just change the error
> handling if a table creation fails. Instead of stopping, it could
> just ignore the error and continue.


An interesting thought.







More information about the drupal-devel mailing list