[Vtigercrm-developers] Why include a SQL file when we don't use it?

Mike Crowe mike at mikeandkellycrowe.com
Tue Feb 21 20:20:42 PST 2006


Here's my original post.  It was in the private forum:


Guys, time for me to get on my soapbox again!

We aren't using adodb-xmlschema to it's fullest extent. If we fix 
DatabaseSchema.xml and populate with initial data, the install script 
becomes:
Code:
   if ($db_populate)
      $success = $db->createTables("install/vTigerSchema.xml");
   else
      $success = $db->createTables("install/vTigerSchemaDemoData.xml");

The install script is MUCH smaller and simpler. Downside is the schema must be 
created from a pristine database.

I've attached a script names install/extractInstallSchema.php. From the root 
directory of the database, type in:
Code:
php install/extractTableSchema.php

The 2 tables (vTigerSchema and vTigerSchemaDemoData) will be created in the 
install directory.

* vTigerSchema.xml contains all the core data of the database: fields, 
profiles, users, etc. Simply make sure the system you are basing the extract 
on is exactly the result you want to create.
* vTigerSchemaDemoData.xml additionally exports the contents of all the "data" 
of the system, such as Accounts, Contacts, etc.

I would ideally like to break this down even more, but only if everybody 
agrees: Each module (such as Accounts) would have each a schema file such as 
AccountsSchema.xml, and thereby become independent. We could even get to the 
point where modules are installed dynamically. This is a feature which I've 
added to Vip, but I haven't fully tested this portion (of Vip -- I have of 
this install script).

I really think this is a better way to do it, but what do I really know? Very 
Happy

Have a look, review, and please comment. 


On Tuesday 21 February 2006 8:34 pm, Jeff Kowalczyk wrote:
> Mike Crowe wrote:
> > I refer you to my post:
> > http://forums.vtiger.com/viewtopic.php?t=4535&highlight=
> >
> > To install from command line:
> > 	php install.php
> > where install.php is:
> > <?
> > require_once('config.php');
> > require_once('connection.php');
> > require_once('adodb/adodb.inc.php');
> > require_once('adodb/adodb-xmlschema.inc.php');
> >
> > $conn = ADONewConnection($dbconfig['db_type']);
> > $conn->Connect($dbconfig['db_host_name'],$dbconfig['db_user_name'],
> > $dbconfig['db_password'],$dbconfig['db_name']);
> > $schema = new adoSchema( $conn );
> > $schema->SetUpgradeMethod('ALTER');
> > $schema->ExecuteInline(true);
> > $sql = $schema->ParseSchema( "adodb/DatabaseSchema.xml" );
> > ?>
> >
> > To create the XML file, all it takes is:
> > $schema = new adoSchema( $conn );
> > $t = $schema->ExtractSchema(true);
> > (now write $t to the xml file)
>
> Thanks Mike. Can you make a trac ticket with this snippet and specifics on
> where you'd like to see this fit into the install steps?
>
> (BTW, I moved adodb/DatabaseSchema.xml to schema/DatabaseSchema.xml)
> http://vtiger.fosslabs.com/cgi-bin/trac.cgi/ticket/4
>
>
>
> _______________________________________________
> This vtiger.com email is sponsored by: Zoho Writer. Are you still using
> your desktop word processor for typing documents? Try the AJAX enabled,
> collaboration-friendly online word processor, Zoho Writer for FREE instead!
> http://zohowriter.com/?vt

-- 
_____________________________________________________
Cheers!

Mike Crowe
Sr. Field Sales Engineer
ELCOM 

3030 Naomi Dr.
Clover, SC 29710
Phone: (803) 831-9050
Fax: (704) 973-7910 

mike.crowe at elcomsales.com
http://www.elcomsales.com/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: install.zip
Type: application/x-zip
Size: 171270 bytes
Desc: not available
Url : http://lists.vtigercrm.com/pipermail/vtigercrm-developers/attachments/20060221/96af9c8d/attachment-0003.bin 


More information about the vtigercrm-developers mailing list