You need bleeedin edge man ;) sql.bronto.t_GraphViz.png

Description of Schema

Tables

PEOPLE
GROUPS
TYPES
STATUSES
DOCUMENTS
AUTHORS
AD
SECTIONS
SD

PEOPLE

Top
Field Name Data Type Size Default Other Foreign Key
id integer 11
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

GROUPS

Top
Field Name Data Type Size Default Other Foreign Key
id integer 11
name varchar 32 UNIQUE, NOT NULL
deflevel integer 5 15

TYPES

Top
Field Name Data Type Size Default Other Foreign Key
id integer 11
descr varchar 64 UNIQUE, NOT NULL
mime varchar 96 application/octet-stream NOT NULL

STATUSES

Top
Field Name Data Type Size Default Other Foreign Key
id integer 11
descr varchar 64 UNIQUE, NOT NULL

DOCUMENTS

Top
Field Name Data Type Size Default Other Foreign Key
id integer 11
title varchar 255 NOT NULL
type integer 10 TYPES.id
published date 0 NOT NULL
updated date 0 NOT NULL
descr varchar 200
url varchar 128 UNIQUE, NOT NULL
status integer 10 STATUSES.id

AUTHORS

Top
Field Name Data Type Size Default Other Foreign Key
id integer 11
name varchar 128 UNIQUE, NOT NULL

AD

Top
Field Name Data Type Size Default Other Foreign Key
authorID integer 10 AUTHORS.id
docID integer 10 DOCUMENTS.id

SECTIONS

Top
Field Name Data Type Size Default Other Foreign Key
id integer 11
descr varchar 64 UNIQUE, NOT NULL

SD

Top
Field Name Data Type Size Default Other Foreign Key
sectionID integer 10 SECTIONS.id
docID integer 10 DOCUMENTS.id

Created by SQL::Translator

And just for kicks, this is your psql converted into psql by the sql fairy

DROP TABLE "PEOPLE"; CREATE TABLE "PEOPLE" ( "id" serial, "nick" character varying(16) NOT NULL, "passwd" character varying(14) NOT NULL, "name" character varying(64), "surname" character varying(64) NOT NULL, "email" character varying(96) NOT NULL, CONSTRAINT pk_PEOPLE PRIMARY KEY ("id"), CONSTRAINT 1_PEOPLE UNIQUE ("nick"), CONSTRAINT 2_PEOPLE UNIQUE ("email") ); DROP TABLE "GROUPS"; CREATE TABLE "GROUPS" ( "id" serial, "name" character varying(32) NOT NULL, "deflevel" integer DEFAULT '15', CONSTRAINT pk_GROUPS PRIMARY KEY ("id"), CONSTRAINT 1_GROUPS UNIQUE ("name") ); DROP TABLE "TYPES"; CREATE TABLE "TYPES" ( "id" serial, "descr" character varying(64) NOT NULL, "mime" character varying(96) DEFAULT 'application/octet-stream' NOT +NULL, CONSTRAINT pk_TYPES PRIMARY KEY ("id"), CONSTRAINT 1_TYPES UNIQUE ("descr") ); DROP TABLE "STATUSES"; CREATE TABLE "STATUSES" ( "id" serial, "descr" character varying(64) NOT NULL, CONSTRAINT pk_STATUSES PRIMARY KEY ("id"), CONSTRAINT 1_STATUSES UNIQUE ("descr") ); DROP TABLE "DOCUMENTS"; CREATE TABLE "DOCUMENTS" ( "id" serial, "title" character varying(255) NOT NULL, "type" integer, "published" date NOT NULL, "updated" date NOT NULL, "descr" character varying(200), "url" character varying(128) NOT NULL, "status" integer, CONSTRAINT pk_DOCUMENTS PRIMARY KEY ("id"), FOREIGN KEY ("type") REFERENCES TYPES ("id"), CONSTRAINT 1_DOCUMENTS UNIQUE ("url"), FOREIGN KEY ("status") REFERENCES STATUSES ("id") ); DROP TABLE "AUTHORS"; CREATE TABLE "AUTHORS" ( "id" serial, "name" character varying(128) NOT NULL, CONSTRAINT pk_AUTHORS PRIMARY KEY ("id"), CONSTRAINT 1_AUTHORS UNIQUE ("name") ); DROP TABLE "AD"; CREATE TABLE "AD" ( "authorID" integer, "docID" integer, FOREIGN KEY ("authorID") REFERENCES AUTHORS ("id"), FOREIGN KEY ("docID") REFERENCES DOCUMENTS ("id") ); DROP TABLE "SECTIONS"; CREATE TABLE "SECTIONS" ( "id" serial, "descr" character varying(64) NOT NULL, CONSTRAINT pk_SECTIONS PRIMARY KEY ("id"), CONSTRAINT 1_SECTIONS UNIQUE ("descr") ); DROP TABLE "SD"; CREATE TABLE "SD" ( "sectionID" integer, "docID" integer, FOREIGN KEY ("sectionID") REFERENCES SECTIONS ("id"), FOREIGN KEY ("docID") REFERENCES DOCUMENTS ("id") );
update: That would seem to suggest that the CHECK constraint(?) is somehow mishandled. You should submit a bug report (http://sf.net/projects/sqlfairy ;)

MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
** The third rule of perl club is a statement of fact: pod is sexy.


In reply to Re: Re: Is there any script to translate a simple SQL script to an ER diagram? by PodMaster
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.