| 1 | package Geoffrey::Converter::Pg::Tables; | ||
| 2 | |||
| 3 | use utf8; | ||
| 4 | use 5.016; | ||
| 5 | use strict; | ||
| 6 | use Readonly; | ||
| 7 | use warnings; | ||
| 8 | |||
| 9 | $Geoffrey::Converter::Pg::Tables::VERSION = '0.000100'; | ||
| 10 | |||
| 11 | use parent 'Geoffrey::Role::ConverterType'; | ||
| 12 | |||
| 13 | sub add { return q~CREATE TABLE {0} ( {1} )~; } | ||
| 14 | |||
| 15 | sub drop { return q~DROP TABLE {0}~; } | ||
| 16 | |||
| 17 | sub alter { return q~ALTER TABLE {0}~; } | ||
| 18 | |||
| 19 | sub add_column { return $_[0]->alter . q~ ADD COLUMN {1}~; } | ||
| 20 | |||
| 21 | sub list { | ||
| 22 | my ( $self, $schema ) = @_; | ||
| 23 | require Geoffrey::Utils; | ||
| 24 | return q~SELECT t.* | ||
| 25 | FROM information_schema.tables t | ||
| 26 | WHERE t.table_type != 'VIEW' AND t.table_schema=?~; | ||
| 27 | } | ||
| 28 | |||
| 29 | sub s_list_columns { | ||
| 30 | my ( $self, $schema ) = @_; | ||
| 31 | require Geoffrey::Utils; | ||
| 32 | return q~SELECT * | ||
| 33 | FROM information_schema.columns | ||
| 34 | WHERE table_name = ? | ||
| 35 | AND table_schema = ?~; | ||
| 36 | } | ||
| 37 | |||
| 38 | 1; # End of Geoffrey::Converter::Pg::Tables | ||
| 39 | |||
| 40 | __END__ |