use SQL::Translator::Generator::DDL::SQLServer;
sub produce {
- my $translator = shift;
- my $future = SQL::Translator::Generator::DDL::SQLServer->new(
- add_comments => !$translator->no_comments,
- add_drop_tables => $translator->add_drop_table,
- );
-
- my $schema = $translator->schema;
-
- my $output = $future->header_comments
- . $future->drop_tables($schema);
-
- for my $table ( grep { $_->name } $schema->get_tables ) {
- $output .= join( "\n\n",
- $future->table_comments($table),
- # index defs
- $future->table($table),
- (map $future->unique_constraint_multiple($_),
- grep {
- $_->type eq UNIQUE &&
- grep { $_->is_nullable } $_->fields
- } $table->get_constraints),
-
- (map $future->index($_), $table->get_indices)
- );
- }
-
- my @foreign_constraints = $future->foreign_key_constraints($schema);
- $output .= join ("\n", '', @foreign_constraints) if @foreign_constraints;
-
- return $output;
+ my $translator = shift;
+ SQL::Translator::Generator::DDL::SQLServer->new(
+ add_comments => !$translator->no_comments,
+ add_drop_table => $translator->add_drop_table,
+ )->schema($translator->schema)
}
1;
-=pod
-
-=head1 SQLServer Create Table Syntax
-
-TODO
-
-
=head1 NAME
SQL::Translator::Producer::SQLServer - MS SQLServer producer for SQL::Translator
=head1 DESCRIPTION
-B<WARNING>B This is still fairly early code, basically a hacked version of the
-Sybase Producer (thanks Sam, Paul and Ken for doing the real work ;-)
+This is currently a thin wrapper around the nextgen
+L<SQL::Translator::Generator::DDL::SQLServer> DDL maker.
=head1 Extra Attributes
=head1 SEE ALSO
-SQL::Translator.
+L<SQL::Translator>
=head1 AUTHORS
-Mark Addison E<lt>grommit@users.sourceforge.netE<gt> - Bulk of code from
-Sybase producer, I just tweaked it for SQLServer. Thanks.
+See the included AUTHORS file:
+L<http://search.cpan.org/dist/SQL-Translator/AUTHORS>
+
+=head1 COPYRIGHT
+
+Copyright (c) 2012 the SQL::Translator L</AUTHORS> as listed above.
+
+=head1 LICENSE
+
+This code is free software and may be distributed under the same terms as Perl
+itself.
=cut