package SQL::Translator::Generator::Role::DDL;
use Moo::Role;
+use SQL::Translator::Utils qw(header_comment);
requires '_build_shim';
requires '_build_type_map';
( $_[1]->comments ? ('-- ' . $_[1]->comments . "\n ") : () )
}
+sub table_comments {
+ my ($self, $table) = @_;
+ if ($self->add_comments) {
+ return (
+ "\n",
+ "--\n",
+ "-- Table: " . $self->quote($table->name) . "\n",
+ "--\n",
+ map "-- $_\n", $table->comments
+ )
+ } else {
+ return ()
+ }
+}
+
sub field_nullable { ($_[1]->is_nullable ? $_[0]->nullable : 'NOT NULL' ) }
sub field_default {
( map $self->field($_), $table->get_fields )
}
+sub indices {
+ my ($self, $table) = @_;
+ (map $self->index($_), $table->get_indices)
+}
+
sub nullable { 'NULL' }
+sub header_comments { header_comment() . "\n" if $_[0]->add_comments }
+
1;