SQLT-DIFF-OLD(1p) User Contributed Perl Documentation SQLT-DIFF-OLD(1p)NAME
sqlt-diff - find the differences b/w two schemas
SYNOPSIS
For help:
sqlt-diff -h|--help
For a list of all valid parsers:
sqlt -l|--list
To diff two schemas:
sqlt-diff [options] file_name1=parser file_name2=parser
Options:
-d|--debug Show debugging info
DESCRIPTION
sqlt-diff is a utility for creating a file of SQL commands necessary to transform the first schema provided to the second. While not yet
exhaustive in its ability to mutate the entire schema, it will report the following
o New tables
Using the Producer class of the target (second) schema, any tables missing in the first schema will be generated in their entirety
(fields, constraints, indices).
o Missing/altered fields
Any fields missing or altered between the two schemas will be reported as:
ALTER TABLE <table_name>
[DROP <field_name>]
[CHANGE <field_name> <datatype> (<size>)] ;
o Missing/altered indices
Any indices missing or of a different type or on different fields will be indicated. Indices that should be dropped will be reported
as such:
DROP INDEX <index_name> ON <table_name> ;
An index of a different type or on different fields will be reported as a new index as such:
CREATE [<index_type>] INDEX [<index_name>] ON <table_name>
( <field_name>[,<field_name>] ) ;
"ALTER/DROP TABLE" and "CREATE INDEX" statements are not generated by the Producer, unfortunately, and may require massaging before being
passed to your target database.
AUTHOR
Ken Youens-Clark <kclark@cpan.org>.
SEE ALSO
SQL::Translator, <http://sqlfairy.sourceforge.net>.
perl v5.14.2 2012-01-18 SQLT-DIFF-OLD(1p)
Check Out this Related Man Page
SQL::Translator::Producer::XML::SQLFairy(3pm) User Contributed Perl Documentation SQL::Translator::Producer::XML::SQLFairy(3pm)NAME
SQL::Translator::Producer::XML::SQLFairy - SQLFairy's default XML format
SYNOPSIS
use SQL::Translator;
my $t = SQL::Translator->new(
from => 'MySQL',
to => 'XML-SQLFairy',
filename => 'schema.sql',
show_warnings => 1,
);
print $t->translate;
DESCRIPTION
Creates XML output of a schema, in the flavor of XML used natively by the SQLFairy project (SQL::Translator). This format is detailed here.
The XML lives in the "http://sqlfairy.sourceforge.net/sqlfairy.xml" namespace. With a root element of <schema>.
Objects in the schema are mapped to tags of the same name as the objects class (all lowercase).
The attributes of the objects (e.g. $field->name) are mapped to attributes of the tag, except for sql, comments and action, which get
mapped to child data elements.
List valued attributes (such as the list of fields in an index) get mapped to comma separated lists of values in the attribute.
Child objects, such as a tables fields, get mapped to child tags wrapped in a set of container tags using the plural of their contained
classes name.
An objects' extra attribute (a hash of arbitrary data) is mapped to a tag called extra, with the hash of data as attributes, sorted into
alphabetical order.
e.g.
<schema name="" database=""
xmlns="http://sqlfairy.sourceforge.net/sqlfairy.xml">
<tables>
<table name="Story" order="1">
<fields>
<field name="id" data_type="BIGINT" size="20"
is_nullable="0" is_auto_increment="1" is_primary_key="1"
is_foreign_key="0" order="3">
<extra ZEROFILL="1" />
<comments></comments>
</field>
<field name="created" data_type="datetime" size="0"
is_nullable="1" is_auto_increment="0" is_primary_key="0"
is_foreign_key="0" order="1">
<extra />
<comments></comments>
</field>
...
</fields>
<indices>
<index name="foobar" type="NORMAL" fields="foo,bar" options="" />
</indices>
</table>
</tables>
<views>
<view name="email_list" fields="email" order="1">
<sql>SELECT email FROM Basic WHERE email IS NOT NULL</sql>
</view>
</views>
</schema>
To see a complete example of the XML translate one of your schema :)
$ sqlt -f MySQL -t XML-SQLFairy schema.sql
ARGS
add_prefix
Set to true to use the default namespace prefix of 'sqlf', instead of using the default namespace for
"http://sqlfairy.sourceforge.net/sqlfairy.xml namespace"
e.g.
<!-- add_prefix=0 -->
<field name="foo" />
<!-- add_prefix=1 -->
<sqlf:field name="foo" />
prefix
Set to the namespace prefix you want to use for the "http://sqlfairy.sourceforge.net/sqlfairy.xml namespace"
e.g.
<!-- prefix='foo' -->
<foo:field name="foo" />
newlines
If true (the default) inserts newlines around the XML, otherwise the schema is written on one line.
indent
When using newlines the number of whitespace characters to use as the indent. Default is 2, set to 0 to turn off indenting.
LEGACY FORMAT
The previous version of the SQLFairy XML allowed the attributes of the the schema objects to be written as either xml attributes or as data
elements, in any combination. The old producer could produce attribute only or data element only versions. While this allowed for lots of
flexibility in writing the XML the result is a great many possible XML formats, not so good for DTD writing, XPathing etc! So we have moved
to a fixed version described above.
This version of the producer will now only produce the new style XML. To convert your old format files simply pass them through the
translator :)
$ sqlt -f XML-SQLFairy -t XML-SQLFairy schema-old.xml > schema-new.xml
AUTHORS
Ken Youens-Clark <kclark@cpan.org>, Darren Chamberlain <darren@cpan.org>, Mark Addison <mark.addison@itn.co.uk>.
SEE ALSO perl(1), SQL::Translator, SQL::Translator::Parser::XML::SQLFairy, SQL::Translator::Schema, XML::Writer.
perl v5.14.2 2012-01-18 SQL::Translator::Producer::XML::SQLFairy(3pm)