[drupal-devel] [support] Database Table Creation Script - problem
nbd
drupal-devel at drupal.org
Fri Sep 9 14:51:12 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
+Category: support requests
Priority: normal
-Assigned to: Anonymous
+Assigned to: nbd
Reported by: danielc
Updated by: nbd
Status: patch (code needs review)
While running crate.php I came into this problem:
Duplicate entry 'modules/block.module' for key 1 query: INSERT INTO
system VALUES ('modules/block.module','block','module',"1,0,0)
I assume it's because the settings table is shared by the subsites and
create.php tries to update it again for each subsite. what can I do
now?
For the moment I do want the settings I change to be effective across
the sub-sites. In the future I may want seperate settings for each.
For additional information my specific sites db_prefix is as follows:
$db_prefix = array(
'default' => 'abc_',
'authmap' => 'shared_',
'profile_fields' => 'shared_',
'profile_values' => 'shared_',
'role' => 'shared_',
'sequences' => 'shared_',
'sessions' => 'shared_',
'users' => 'shared_',
'users_roles' => 'shared_',
'users_uid_seq' => 'shared_', // for pgsql
);
Thanks,
nbd
nbd
Previous comments:
------------------------------------------------------------------------
Fri, 15 Apr 2005 00:27:01 +0000 : 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.
------------------------------------------------------------------------
Sun, 17 Apr 2005 18:21:30 +0000 : 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
------------------------------------------------------------------------
Sun, 17 Apr 2005 22:56:10 +0000 : 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.
------------------------------------------------------------------------
Fri, 15 Jul 2005 23:00:19 +0000 : justin3
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...?
------------------------------------------------------------------------
Sun, 24 Jul 2005 02:13:34 +0000 : cre8d
I'd love to get this working but I ran into a problem - I get this
error:
Found no valid settings.php files in /drupal/sites/*.'
I have followed the previous person's suggestion, as I've already
created the tables for my default site and have changed the code to
look in newsites. It seems to fail at this point:
if ($db_url == $default_url) {
continue;
}
$db_url and $default_url are the same on purpose because I want to use
the same database for both of the sites and share some tables.
Any help appreciated.
------------------------------------------------------------------------
Sat, 03 Sep 2005 19:54:36 +0000 : petepope
When I tried to execute it through the browser, I got the following
error message:
"Fatal error: Table 'access' already exists query: CREATE TABLE access
( aid tinyint(10) NOT NULL auto_increment, mask varchar(255) NOT NULL
default '', type varchar(255) NOT NULL default '', status tinyint(2)
NOT NULL default '0', PRIMARY KEY (aid) ) TYPE=MyISAM in
/home/petepope/public_html/drupal/includes/database.mysql.inc on line
66"
I'm a relative newbie to this game, and I'd appreciate any help that
might be forthcoming.
------------------------------------------------------------------------
Sat, 03 Sep 2005 21:24:41 +0000 : Bèr Kessels
please start a new issue for new questions or issues, do no 'hijack'
existing issues.
------------------------------------------------------------------------
Thu, 08 Sep 2005 19:06:41 +0000 : petepope
Ber -
I fail to see how reporting an issue with the script that is the topic
of the thread can be 'hijacking'.
Rather than upset anybody, though, I will open a new issue...
- Pete
------------------------------------------------------------------------
Thu, 08 Sep 2005 19:44:06 +0000 : Bèr Kessels
Sorry. It was unclear to me that your error had anything to do with the
script. Sorry for that. I was referring to changing the state of the
issue to 'support' and then to 4.6.
This is a patch for CVS, and not a place to post support issues for 4.6
Puttingversion back to CVS.
More information about the drupal-devel
mailing list