Save table prefix

Rob Loach - November 27, 2008 - 05:41
Project:Demonstration site (Sandbox / Snapshot)
Version:6.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:needs work
Description

For the Demo Profile, it would be great if we could get the table prefix so there's no conflict with settings.php during restore. So it would be great if the table prefix was saved in the .info file during backup.

#1

Rob Loach - November 27, 2008 - 07:07
Status:active» needs review

This patch saves and loads the db_prefix with the .info file.

AttachmentSize
infoprefix.patch 1.14 KB

#2

sun - November 27, 2008 - 15:05

erm - just add db_prefix to the .info file is sufficient for you? Does this work already? And, how is this information used by the profile? Does it replace the manually supplied db_prefix upon install?

#3

Rob Loach - November 27, 2008 - 20:18
Status:needs review» needs work

Haven't had a hack at it yet. It would need the table prefix, and then the installer would rewrite the settings.php with what the database dump used for the table prefix. Not quite sure if it works yet. If you have a hack at it, wicked! ;-)

#4

Rob Loach - June 8, 2009 - 20:45

Although having the database prefix in the info file is handy (patch updated to DRUPAL-6--1), it won't work for Demonstration Site Install Profile because Drupal has you create the database before configuring the install profile. We don't know which database dump the person will be using at the time that the database configuration screen.

I believe the way around this would be to abstract the database prefix out of the MySQL dump file itself in Demonstration Site module and have it inject it back in on restore. This way, you could restore to database dumps with different database prefixes, even when the site's prefix is different.

Thanks!

AttachmentSize
db_prefix.patch 1.14 KB
 
 

Drupal is a registered trademark of Dries Buytaert.