[development] Staging content to production servers

Dave Cohen drupal at dave-cohen.com
Sat Jun 17 17:34:19 UTC 2006


On Saturday 17 June 2006 05:40, Barry Jaspan wrote:
> >I've started to address this issue by reserving the first 1000 ids for the
> >"staging" (or if you prefer, "install profile").
>
> I think this is an excellent idea that perhaps makes my suggestion to
> split config vs. data tables into two databases obsolete.  Some thoughts:
>
> - If we had data-driven database schemas, your drupal_base_db.txt
> script (or its built-in equivalent) would (a) not need to hard-code
> the list of tables not to copy (the schema would identify them) and
> (b) not need to use fragile-looking MySQL-specific regular
> expressions and SHOW queries to do its job.

Agreed that script could use some improvement.  I was just happy to get it 
working enough for my needs.  I learned mysql queries I never knew existed.

>
> - Not every table needs an id field, only those for which you want to
> reserve some id space.  Pure config tables (e.g. system) can be
> copied in their entirety.  The schema could identify such tables so
> processing them correctly would be easy.

The db dump my script produces can be applied over and over, and should be 
applied each time the install profile is updated.  It's like running 
update.php.  But it works by using INSERT IGNOREs (or REPLACEs).  If the 
table has no unique id, the script would end up adding duplicate rows to the 
production database.  I'm not saying this is the ultimate solution, but as 
long as it works that way the tables must have unique ids.

So for example, if I already have a production site, but I want to enable a 
new module, I'd start by enabling the module on the install profile server.  
Then I'd use my script to dump the database.  The result would have a new row 
inserted into the system table (along with all the original rows).  Then I 
run the script on the production server.  The original rows have no effect 
thanks to INSERT IGNORE.  The new row is inserted though, and the production 
server now has the module enabled.

-Dave


More information about the development mailing list