Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^2: dbicdump not importing the full table (Postgres)

by Anonymous Monk
on May 08, 2012 at 12:18 UTC ( [id://969433]=note: print w/replies, xml ) Need Help??


in reply to Re: dbicdump not importing the full table (Postgres)
in thread dbicdump not importing the full table (Postgres)

the sqlt test suite is good :)

Create table schema manually from description

#!/usr/bin/perl -- use strict; use warnings; #~ http://cpansearch.perl.org/src/JROBINSON/SQL-Translator-0.11010/t/4 +7postgres-producer.t use SQL::Translator::Schema::Table; use SQL::Translator::Producer::PostgreSQL; my $table = SQL::Translator::Schema::Table->new( name => 'urls' ); #~ column_name | data_type #~ -----------------+------------------- my %columnType = map { split /\s+\|\s+/, $_ } split /[\r\n]+/, <<'__COL_TYPE__'; date_checked | date http_code | integer base_uri | text host_alive | boolean last_check_good | boolean count_fails | integer count_success | integer pri | boolean url | text table_id | integer tbl | character varying id | integer __COL_TYPE__ while( my( $name, $type ) = each %columnType ){ my $field = SQL::Translator::Schema::Field->new( name => $name, table => $table, data_type => $type, ); $table->add_field( $field ); } #~ use Data::Dump ; dd SQL::Translator::Producer::PostgreSQL::create_t +able($table) ; my( $sql, $rest ) = SQL::Translator::Producer::PostgreSQL::create_tabl +e($table); print "$sql;\n\n"; __END__ -- -- Table: urls -- CREATE TABLE urls ( tbl character varying, url text, id integer, host_alive boolean, count_fails integer, base_uri text, pri boolean, http_code integer, date_checked date, count_success integer, table_id integer, last_check_good boolean );

and sqlt doesn't appear to miss anything either

output from sqlt -f PostgreSQL -t DBIx::Class::File --prefix=EDINA::ORI < in > out

package EDINA::ORI::urls; use base 'DBIx::Class'; use strict; use warnings; __PACKAGE__->load_components(qw/ Core/); __PACKAGE__->table('urls'); __PACKAGE__->add_columns( 'tbl' => { 'data_type' => 'varchar', 'is_auto_increment' => 0, 'default_value' => undef, 'is_foreign_key' => 0, 'name' => 'tbl', 'is_nullable' => 1, 'size' => 0 }, 'url' => { 'data_type' => 'text', 'is_auto_increment' => 0, 'default_value' => undef, 'is_foreign_key' => 0, 'name' => 'url', 'is_nullable' => 1, 'size' => '64000' }, 'id' => { 'data_type' => 'integer', 'is_auto_increment' => 0, 'default_value' => undef, 'is_foreign_key' => 0, 'name' => 'id', 'is_nullable' => 1, 'size' => '10' }, 'host_alive' => { 'data_type' => 'boolean', 'is_auto_increment' => 0, 'default_value' => undef, 'is_foreign_key' => 0, 'name' => 'host_alive', 'is_nullable' => 1, 'size' => 0 }, 'count_fails' => { 'data_type' => 'integer', 'is_auto_increment' => 0, 'default_value' => undef, 'is_foreign_key' => 0, 'name' => 'count_fails', 'is_nullable' => 1, 'size' => '10' }, 'base_uri' => { 'data_type' => 'text', 'is_auto_increment' => 0, 'default_value' => undef, 'is_foreign_key' => 0, 'name' => 'base_uri', 'is_nullable' => 1, 'size' => '64000' }, 'pri' => { 'data_type' => 'boolean', 'is_auto_increment' => 0, 'default_value' => undef, 'is_foreign_key' => 0, 'name' => 'pri', 'is_nullable' => 1, 'size' => 0 }, 'http_code' => { 'data_type' => 'integer', 'is_auto_increment' => 0, 'default_value' => undef, 'is_foreign_key' => 0, 'name' => 'http_code', 'is_nullable' => 1, 'size' => '10' }, 'date_checked' => { 'data_type' => 'date', 'is_auto_increment' => 0, 'default_value' => undef, 'is_foreign_key' => 0, 'name' => 'date_checked', 'is_nullable' => 1, 'size' => 0 }, 'count_success' => { 'data_type' => 'integer', 'is_auto_increment' => 0, 'default_value' => undef, 'is_foreign_key' => 0, 'name' => 'count_success', 'is_nullable' => 1, 'size' => '10' }, 'table_id' => { 'data_type' => 'integer', 'is_auto_increment' => 0, 'default_value' => undef, 'is_foreign_key' => 0, 'name' => 'table_id', 'is_nullable' => 1, 'size' => '10' }, 'last_check_good' => { 'data_type' => 'boolean', 'is_auto_increment' => 0, 'default_value' => undef, 'is_foreign_key' => 0, 'name' => 'last_check_good', 'is_nullable' => 1, 'size' => 0 }, ); package EDINA::ORI; use base 'DBIx::Class::Schema'; use strict; use warnings; __PACKAGE__->register_class('urls', 'EDINA::ORI::urls'); 1;

Is this a bug in dbicdump ? I can't tell :)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://969433]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (7)
As of 2024-04-19 12:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found