Copying data from one database to another without

3 views
Skip to first unread message

Mark Plamann

unread,
Jun 23, 2009, 11:51:39 PM6/23/09
to Php-Object...@googlegroups.com
I am in the situation where I have multiple environments -
development, staging, and production. I'm using POG for the data layer
of the application. In lower environments there is a lot of testing
going on with records being created - most of them junk data that will
never be promoted into production. That being said, however, there are
database records that are considered static system data and are
retained through every environment.

My question is, are there any recommended practices for promoting data
through environments when using POG. My quandary is that I don't want
to screw up the sequencing of the primary key ID fields and instead
would prefer to insert the data from lower environments into
production and allow the sequence number to be automatically generated
by each environment's own database (so as not to start with an
artificially high sequence number due to lots of junk records having
been inserted in lower environments). Would taking the primary key ID
values from lower environments cause the sequencing to begin
artificially high? My ignorance of how the primary keys are actually
incremented comes into play here, so any enlightenment in that area is
also greatly appreciated.

If my question doesn't make much sense, I'll be happy to clarify or
provide a concrete example. Any insight into recommendations for this
type of scenario is appreciated.

Cheers,
Mark

Essio Studio - http://www.essiostudio.com

Pino Alu

unread,
Jun 26, 2009, 7:04:25 AM6/26/09
to Php-Object...@googlegroups.com
I am having trouble setting up POG.  The diagnostic setup fails in step two, tells me to recheck the database.  Any suggestions?

^Pino

Crispytwo

unread,
Jun 27, 2009, 1:34:30 PM6/27/09
to Php Object Generator
Hi Mark,

I think I understand the concepts here. Let me rephrase:
1) You have a test and a production environment
2) you want to migrate data from test into production
3) you don't want data to collide
4) you don't like ID's that are high

So my short response would be
1) good - normal
2) depends on your situation
3) sensible - and tougher to deal with
4) don't worry about that. IDs are for programs to find things, not
for people to admire.

so, for 2 and 3,
If your data is simple, like one object and no children, and the
linkages to the data are not external, then I would use phpMyAdmin to
dump the table data, and import it into the production server... That
is presuming that the production server does not get this data in any
other way (no manual data entry). This would mean that the production
data is taken from Test data always.

If your data is complex, then a custom export and import is necessary.
I prefer creating XML dumps of the data and the relationships in your
database. This is typically much more time consuming to do. In PHP I
write XML raw, for export, and DOMDocument for import... Then walk the
data and insert it with the various IDs being regenerated at insert
time.

If your data is somewhere in-between, it might be easier to just to
copy it manually.

If your data is something that you want do have when you install a new
system, POG provides a SQL injection system for the tables, so when
you run setup, it will put values into the database. This is as
complex or simple as you make it.

-Mark
Reply all
Reply to author
Forward
0 new messages