http://www.perlmonks.org?node_id=1013220


in reply to Re: dbicdump and relationships
in thread dbicdump and relationships

This is being done against MySQL and here is an abbreviated version of the schema I'm using:

$ cat ../sql-src/schema.sql drop table if exists density; create table density ( density_id integer not null auto_increment primary key, density varchar(25) not null ); drop table if exists startype; create table startype ( startype_id integer not null auto_increment primary key, startype varchar(10) not null ); drop table if exists starsize; create table starsize ( starsize_id integer not null auto_increment primary key, starsize varchar(10) not null ); drop table if exists sector; create table sector ( sector_id integer not null auto_increment primary key, name varchar(80) not null ); drop table if exists subsector; create table subsector ( subsector_id integer not null auto_increment primary key, name varchar(80) not null default 'unnamed', location char not null default 'A', startx integer not null default 1, starty integer not null default 1, endx integer not null default 8, endy integer not null default 10, density integer not null references density(density_id), sector integer not null references sector(sector_id) );
The relationship should be sector->has_many_subsector and subsector belongs_to sector. Here is a sanitized version of the config file for dbicdump:
$ cat schema.conf schema_class RPG::Traveller::DB::Schema use_moose 1 <naming> relationships v6 monikers v6 column_accessors v6 force_ascii 1 </naming> <connect_info> dsn dbi:mysql:host=mydatabasehost.mydomain.com;database=st +armapper user AUSER pass APASSWORD </connect_info>
and by the way use_moose doesn't seem to be doing anything. If I run dbicdump against that config file I see:
$ dbicdump schema.conf Dumping manual schema for RPG::Traveller::DB::Schema to directory . .. +. Schema dump completed.
and the grep shows: <code> $ grep -RE "belongs_to|has_many" . $

Any pointers would be appreciated.


Peter L. Berghold -- Unix Professional
Peter -at- Berghold -dot- Net; AOL IM redcowdawg Yahoo IM: blue_cowdawg