Forum OpenACS Development: Re: OpenACS Data Model

Collapse
6: Re: OpenACS Data Model (response to 1)
Posted by Nima Mazloumi on

Joel/Malte here the part for the documentation if you like to add that:

How to create a documentation for the OpenACS Data Model

  • Download PostgreSQL Autodoc
    wget http://www.rbt.ca/autodoc/binaries/postgresql_autodoc-1.22.tar.gz
    
  • Unpack autodoc
    gzip -d postgresql_autodoc-1.22.tar.gz 
    tar xsf postgresql_autodoc-1.22.tar 
    
  • Install missing perl modules with cpan. Configure tells you what modules are missing. Installing a module is very easy as you can see from the following two examples. Run configure first to see if and what module is missing.
    ./configure
    perl -MCPAN -e 'install DBD::Pg'
    perl -MCPAN -e 'install HTML::Template'
    
  • Install autodoc ./configure make make install
  • Open postgresql_autodoc in emacs to configure your database setting. You have to either set some postgres environment variables or do the following changes. I use service0 database, user service0, no database password and localhost as host.

    Changes from line 65 ff

    # Setup the default connection variables based on the environment
    # my $dbuser = $ENV{'PGUSER'};
    # $dbuser ||= $ENV{'USER'};
    my $dbuser = 'service0';
    
    # my $database = $ENV{'PGDATABASE'};
    # $database ||= $dbuser;
    my $database = 'service0';
    
    # my $dbhost = $ENV{'PGHOST'};
    # $dbhost ||= "";
    my $dbhost = 'localhost';
    

    Changes from line 191 ff

    # Database Connection
    my $dsn = "dbi:Pg:dbname=$database";
    # $dsn .= ";host=$dbhost" if ( "$dbhost" ne "" );
    # $dsn .= ";port=$dbport" if ( "$dbport" ne "" );
    # my $dbh = DBI->connect( $dsn, $dbuser, $dbpass );
    my $dbh = DBI->connect( $dsn, $dbuser);
    
  • Export the data model
    ./postgresql_autodoc
    This results in the following files:
    service0.xml		for docbook
    service0.html		for browser
    service0.dot		for vizgraph --> Exports to png, jpg, gif, ps, vrml,.....
    service0.dia		for dia
    unima1.zigzag.dia	for dia