}
sub _build_sizeless_types { +{ text => 1 } }
-sub _build_numeric_types { +{ int => 1, tinyint => 1 } }
+sub _build_numeric_types {
+ +{
+ int => 1,
+ integer => 1,
+ tinyint => 1,
+ smallint => 1,
+ mediumint => 1,
+ bigint => 1,
+ 'unsigned big int' => 1,
+ int2 => 1,
+ int8 => 1,
+ numeric => 1,
+ decimal => 1,
+ boolean => 1,
+ real => 1,
+ double => 1,
+ 'double precision' => 1,
+ float => 1,
+ }
+}
sub _build_unquoted_defaults {
+{
# vim: set ft=perl:
use strict;
-use Test::More tests => 3;
+use Test::More;
use Test::SQL::Translator qw(maybe_plan);
-use FindBin qw/$Bin/;
use SQL::Translator::Schema::View;
use SQL::Translator::Schema::Table;
$table->add_field(
name => 'foreign_key',
data_type => 'integer',
+ default_value => 1,
);
my $constraint = SQL::Translator::Schema::Constraint->new(
table => $table,
on_delete => 'RESTRICT',
on_update => 'CASCADE',
);
-
my $expected = [ 'FOREIGN KEY ("foreign_key") REFERENCES "foo"("id") ON DELETE RESTRICT ON UPDATE CASCADE'];
my $result = [SQL::Translator::Producer::SQLite::create_foreignkey($constraint,$create_opts)];
is_deeply($result, $expected, 'correct "FOREIGN KEY"');
}
+{
+ my $table = SQL::Translator::Schema::Table->new(
+ name => 'foo_table',
+ );
+ $table->add_field(
+ name => 'id',
+ data_type => 'integer',
+ default_value => 1,
+ );
+ my $expected = [ qq<CREATE TABLE "foo_table" (\n "id" integer DEFAULT 1\n)>];
+ my $result = [SQL::Translator::Producer::SQLite::create_table($table, { no_comments => 1 })];
+ is_deeply($result, $expected, 'correctly unquoted DEFAULT');
+}
+
+done_testing;