1 package SQL::Translator::Producer::SQLite;
2 use namespace::autoclean;
10 my $add_drop_table = 1;
11 my $sqlite_version = 0;
14 my (@create, @column_defs, @index_defs, @constraint_defs);
16 $create_table .= 'DROP TABLE ' . $table->name . ";\n" if $add_drop_table;
17 $create_table .= 'CREATE TABLE ' . $table->name . " (\n";
19 push @column_defs, $self->_create_column($_) for values %{$table->columns};
20 $create_table .= join(",\n", map { ' ' . $_ } @column_defs ) . "\n)";
22 print $create_table . "\n";
23 return (@create, $create_table, @index_defs, @constraint_defs );
30 my $size = $column->data_type =~ /^(timestamp)/i ? undef : $column->size;
33 $column_def = $column->name . ' ' . $column->data_type;
34 $column_def .= '(' . $column->size . ')' if $size;
35 $column_def .= ' NOT NULL' unless $column->is_nullable;
36 $column_def .= ' DEFAULT ' . $column->default_value if $column->default_value;