For the sake of completeness, and in case you know how to solve the problem, this is the SQL code:

-- -- DocumentStore Database creation -- -- $Id$ CREATE TABLE PEOPLE ( id serial PRIMARY KEY, nick varchar(16) UNIQUE NOT NULL, passwd varchar(14) NOT NULL, name varchar(64), surname varchar(64) NOT NULL, email varchar(96) UNIQUE NOT NULL ) ; CREATE TABLE GROUPS ( id serial PRIMARY KEY, name varchar(32) UNIQUE NOT NULL, deflevel smallint DEFAULT 15 ) ; CREATE TABLE PG ( groupID integer REFERENCES GROUPS (id), userID integer REFERENCES PEOPLE (id), level smallint, CHECK (level BETWEEN 0 AND 32) ) ; CREATE TABLE TYPES ( id serial PRIMARY KEY, descr varchar(64) UNIQUE NOT NULL, mime varchar(96) DEFAULT 'application/octet-stream' NOT + NULL ) ; CREATE TABLE STATUSES ( id serial PRIMARY KEY, descr varchar(64) UNIQUE NOT NULL ) ; CREATE TABLE DOCUMENTS ( id serial PRIMARY KEY, title varchar(255) NOT NULL, type integer REFERENCES TYPES (id), published date NOT NULL, updated date NOT NULL, descr varchar(200), url varchar(128) UNIQUE NOT NULL, status integer REFERENCES STATUSES (id) ) ; CREATE TABLE AUTHORS ( id serial PRIMARY KEY, name varchar(128) UNIQUE NOT NULL ) ; CREATE TABLE AD ( authorID integer REFERENCES AUTHORS (id), docID integer REFERENCES DOCUMENTS (id) ) ; CREATE TABLE SECTIONS ( id serial PRIMARY KEY, descr varchar(64) UNIQUE NOT NULL ) ; CREATE TABLE SD ( sectionID integer REFERENCES SECTIONS (id), docID integer REFERENCES DOCUMENTS (id) ) ; CREATE TABLE ACCESS_LIST ( groupID integer REFERENCES GROUPS (id), level smallint, docID integer REFERENCES DOCUMENTS (id), CHECK (level BETWEEN 0 AND 32) ) ;

It seems to me that SQL::Translator loses its head with the foreign keys.

Anyway, if you know another perl tool that does the job, I'll be happy to try it

Ciao!
--bronto


The very nature of Perl to be like natural language--inconsistant and full of dwim and special cases--makes it impossible to know it all without simply memorizing the documentation (which is not complete or totally correct anyway).
--John M. Dlugosz

In reply to Re: Is there any script to translate a simple SQL script to an ER diagram? by bronto
in thread Is there any script to translate a simple SQL script to an ER diagram? by bronto

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.