49c4cb1dbf01963a555f430f9487ead30c2b4b06
[dbsrgits/SQL-Translator-2.0-ish.git] / lib / SQL / Translator / Parser / DBI / SQLite.pm
1 use MooseX::Declare;
2 role SQL::Translator::Parser::DBI::SQLite {
3     use MooseX::Types::Moose qw(HashRef);
4     use SQL::Translator::Constants qw(:sqlt_types);
5
6     my %data_type_mapping = (
7         'text' => SQL_LONGVARCHAR(),
8         'timestamp' => SQL_TIMESTAMP(),
9         'timestamp without time zone' => SQL_TYPE_TIMESTAMP(),
10         'timestamp' => SQL_TYPE_TIMESTAMP_WITH_TIMEZONE(),
11         'integer' => SQL_INTEGER(),
12         'character' => SQL_CHAR(),
13         'varchar' => SQL_VARCHAR(),
14         'bigint' => SQL_BIGINT(),
15     );
16
17     method _column_data_type(HashRef $column_info) {
18         print $column_info->{TYPE_NAME} . "\n";
19         my $data_type = defined $data_type_mapping{$column_info->{TYPE_NAME}} ?
20                         $data_type_mapping{$column_info->{TYPE_NAME}} :
21                         -1;
22         return $data_type;
23     }
24
25 }