Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

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 :)


In reply to Re^2: dbicdump not importing the full table (Postgres) by Anonymous Monk
in thread dbicdump not importing the full table (Postgres) by kiz

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2024-04-24 06:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found