Le 28/10/2012 11:13, Thomas Harding a écrit :


I can author a Dia sample, then test it and send both diagram and result. I think it will took half an hour more (I'm puzzled by GUIs: I learned to read and write, not to draw)
:)

And, yes, things has changed since I used for dia2sql :)

Done *a minimal one*.

It was not so obvious, you can double-click on tables and relation

I still get errors:
tom@salon:~$ parsediasql --db postgres --file Desktop/database.dia > Desktop/database.sql
[INFO] Replaced serial with integer
[INFO] components is an empty ARRAY ref

But it results correct statements.

It's a 2 tables sample (book / authors), books has ISBN, I have no idea of authors id, there can be same pen names and any other info is unsure: so it is numeric /serial :)

Sample has to be improved (mixed letters case, etc..), and isbn and serial are Postgres specific.

Attachment: database.dia
Description: application/dia-diagram

<<attachment: database.svg>>

-- Parse::SQL::Dia      version 0.20                              
-- Documentation        http://search.cpan.org/dist/Parse-Dia-SQL/
-- Environment          Perl 5.014002, /usr/bin/perl              
-- Architecture         i486-linux-gnu-thread-multi-64int         
-- Target Database      postgres                                  
-- Input file           Desktop/database.dia                      
-- Generated at         Sun Oct 28 12:27:02 2012                  
-- Typemap for postgres not found in input file                   

-- get_constraints_drop 
alter table book drop constraint fk_author_id ;

-- get_permissions_drop 

-- get_view_drop

-- get_schema_drop
drop table Author;
drop table book;

-- get_smallpackage_pre_sql 

-- get_schema_create
create table Author (
   id            serial    not null,
   name          varchar           ,
   surname       varchar           ,
   date_of_birth timestamp         ,
   date_of_death timestamp         ,
   pen_name      varchar           ,
   constraint pk_Author primary key (id)
)   ;
create table book (
   isbn      isbn    not null,
   title     varchar         ,
   author_id integer         ,
   constraint pk_book primary key (isbn)
)   ;

-- get_view_create

-- get_permissions_create

-- get_inserts

-- get_smallpackage_post_sql

-- get_associations_create
alter table book add constraint fk_author_id 
    foreign key (author_id)
    references Author (id) ;
_______________________________________________
dia-list mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/dia-list
FAQ at http://live.gnome.org/Dia/Faq
Main page at http://live.gnome.org/Dia

Reply via email to