Drupal: Multisiting with Shared Tables
This article would be the first in the cycle of articles related to multisiting. Here, I would tell you how to create a few sites with shared tables in database.
You could meet some problems if setting the second site in multisiting with shared tables in D6 and D7. Installer would give an error when meet shared tables.
Solutions
- Set multisiting with shared tables in Drupal 6 and 7
- Set multisiting with shared tables in Drupal 5
Set multisiting with shared tables in Drupal 6 and 7
The first site
- Specify a line with data necessary for connection to a database
- Specify tables’ prefixes before installation
- Install Drupal as usual
All further sites
- Specify a line with data necessary for connection to a database
- Do NOT specify tables’ prefixes before installation
- Install Drupal without tables’ prefixes
- Install tables’ prefixes after installation
- Remove shared tables
Here is the template of sql-request for removing the tables (remove tables you wish to be in the database from this code):
DROP TABLE `term_data`,
`term_hierarchy`,
`term_relation`,
`term_synonym`,
`vocabulary`,
`vocabulary_node_types`,
`aggregator_category`,
`aggregator_category_feed`,
`aggregator_category_item`,
`aggregator_feed`,
`aggregator_item`,
`book`,
`comments`,
`contact`,
`file_revisions`,
`files`,
`files_backup`,
`files_tmp`,
`forum`,
`history`,
`locales_meta`,
`locales_source`,
`locales_target`,
`node`,
`node_accesaggregator_category`,
`node_access`,
`node_comment_statistics`,
`node_counter`,
`node_revisions`,
`node_type`,
`old_revisions`,
`poll`,
`poll_choices`,
`poll_votes`,
`search_dataset`,
`search_index`,
`search_total`,
`term_node`,
`url_alias`,
`access`,
`authmap`,
`profile_fields`,
`profile_values`,
`sessions`,
`users`,
`filter_formats`,
`filters`,
`permission`,
`role`,
`users_roles`;
You may also need this table for Drupal 5 (Drupal 6 has no such table):
DROP TABLE `sequences`;
If you’ll remove unnecessary tables you have to begin from the step 2.
Set multisiting with shared tables in Drupal 5
In Drupal 5, the following steps are sufficient for all installations:
- Specify a line with data necessary for connection to a database
- Specify tables’ prefixes before installation
- Install Drupal as usual ignoring alert that the tables already exist.