|
sqldef.pl - Convert RDBMS schema to mSQL DDL |
sqldef.pl - Convert RDBMS schema to mSQL DDL
sqldef.pl [ --catalog-only ] [ --no-sequences ] [ --help ]
sqldef.pl will read a text-based schema for a relational database on standard input and generate the corresponding Data Definition Language (DDL) on standard output to create an mSQL 2.x database.
Most commonly you would pipe the output of sqldef.pl to the msql monitor program (this will wipe out all of the data in the specified database):
sqldef.pl db.schema | msql db
Table and column definitions consist of lists of colon seperated fields.
Where an optional parameters is omitted the corresponding field should be left blank.
All lines beginning with # are comments.
# company.schema
# company table table:company:companies:: cmpny_id:int::not null:Unique Id:PRIMARY::::0:0: cmpny_name:char:40::Company name:LABEL::::1:1:
# product table table:product:goods/services:: prod_id:int::not null:Unique Id:PRIMARY::::0:0: prod_name:char:40::Product/services:LABEL::::1:1:
# supply table # M:N (company:product) table:supply:supply of goods/services:: supply_cmpny:int:::Company:PRIMARY+FOREIGN+LABEL:company:cmpny_id::1:1: supply_prod:int:::Product:PRIMARY+FOREIGN+LABEL:product:prod_id::1:1:
--catalog-only only create DDL for system catalog
--no-sequences don't create DDL for table sequences
Useful if you plan to dump your data with a program like msqldump,
change the schema and then reload the data, as it will preserve your
table sequences.
--help print a usage messages, then exit
Brian Jepson <bjepson@conan.ids.net>
Paul Sharpe <paul@miraclefish.com>
You may distribute this under the same terms as Perl itself.
|
sqldef.pl - Convert RDBMS schema to mSQL DDL |