OGo schema comparison
Dax Kelson <[email protected]> Thu, 26 Mar 2009 14:28:28 -0600
| Newsgroups | gmane.comp.cms.opengroupware.user |
|---|---|
| Message-ID | <[email protected]> |
I have an existing OGo 1.0beta.2-1 server running on an older Debian
release. I want to migrate most of my data over to a new shiny install
of OGo (Using the CentOS5 packages here
http://download.opensuse.org/repositories/server://OpenGroupware/CentOS_5/).
I did a comparison of the schema, between the two and besides indexes
and some constraints, the table columns are identical.
For the sake of anyone else attempting to do this (and for the search
engines) here is the procedure I used to compare the schema:
On the OLD OGo server:
Create /tmp/ogo-tables.txt with a list of all the OGo tables (thankfully
old and new OGo both had the same 53 table names) one per line.
mkdir /tmp/ogo-tables
su - postgres
for i in `cat /tmp/ogo-tables.txt`; do pg_dump -s ogo -t $i | grep -v -- '--' | grep . > /tmp/ogo-tables/$i-old.schema; done
^^^ whatever your DB is called
On the NEW OGo server:
Copy over the file /tmp/ogo-tables.txt
mkdir /tmp/ogo-tables
su - postgres
for i in `cat /tmp/ogo-tables.txt`; do pg_dump -s OGo -t $i | grep -v -- '--' | grep . > /tmp/ogo-tables/$i.schema; done
^^^ whatever your DB is called
(note that the command line redirects to a different file)
Now combine (scp, or whatever) the contents of the two directories:
old-server:/tmp/ogo-tables
new-server:/tmp/ogo-tables
Your combined directory should look like:
-bash-3.2$ ls -al | head
total 864
drwxr-xr-x 2 postgres postgres 4096 Mar 26 13:08 .
drwxrwxrwt 13 root root 4096 Mar 26 13:09 ..
-rw-r--r-- 1 postgres postgres 1184 Mar 26 13:08 address-old.schema
-rw-r--r-- 1 postgres postgres 1279 Mar 26 13:07 address.schema
-rw-r--r-- 1 postgres postgres 651 Mar 26 13:08 appointment_resource-old.schema
-rw-r--r-- 1 postgres postgres 746 Mar 26 13:07 appointment_resource.schema
-rw-r--r-- 1 postgres postgres 384 Mar 26 13:08 article_category-old.schema
-rw-r--r-- 1 postgres postgres 479 Mar 26 13:07 article_category.schema
Now to do the comparison, run:
for i in `cat /tmp/ogo-tables.txt`; do diff -u $i-old.schema $i.schema | grep -Ev "^[\+-]SET" | grep -Ev "^[\+-]CREATE INDEX"; done | less
The results of my comparison between OGo 1.0beta2 and what's in the
current CentOS5 repository is that no columns have changed in any of the
tables. Only index and constraints have been added.
Dax Kelson
Guru Labs
--
OpenGroupware.org Users
[email protected]
http://mail.opengroupware.org/mailman/listinfo/users