vanstyn / RapidApp

Turnkey ajaxy webapps
http://rapi.io
Other
48 stars 15 forks source link

Can't use Database::Table pre-made DBIx::Class #103

Open linagee opened 9 years ago

linagee commented 9 years ago

I'm using the following DBIx::Class::Schema::Loader:

create_schema.pl:

use DBIx::Class::Schema::Loader qw/ make_schema_at /;
my $dbh = fancy_function_that_returns_connected_dbh;  #(and yes this part works)
make_schema_at(
   "MyApp::Schema",
   {  use_namespaces => 1,
      dump_directory => '../../modules',
      db_schema => '%', #Load all DBs
      components => ["InflateColumn::DateTime"],
      col_collision_map => 'col_%s', #If a name uses a reserved word
      rel_collision_map => 'rel_%s', #If a name uses a reserved word
      naming => { ALL => 'v7', force_ascii => 1 },
      moniker_parts => [qw(schema name)], #Use DB name and Table name (MyDB::legacytable)
      moniker_part_separator => '::',
   },  
   [sub { $dbh }], 
);

After generating the RapidApp... API/lib/API/Model/DB.pm:

package API::Model::DB;
use Moo;
extends 'Catalyst::Model::DBIC::Schema';
use MyApp::util qw/GetPassword/;

use strict;
use warnings;

my $server = 'dbserver';
my $user = 'username';

__PACKAGE__->config(
    schema_class => 'MyApp::Schema',

    connect_info => {
       dsn => "dbi:mysql:database=myappdb;host=$server",
       user => $user,
       password => MyApp::util->GetPassword($server, $user),
       mysql_enable_utf8 => q{1},
       mysql_auto_reconnect => q{1},
       quote_names => q{1},
    },  

    # Configs for the RapidApp::RapidDbic Catalyst Plugin:
    RapidDbic => {

       # use only the relationship column of a foreign-key and hide the 
       # redundant literal column when the names are different:
       hide_fk_columns => 1,

       # grid_params are used to configure the grid module which is 
       # automatically setup for each source in the navtree

       grid_params => {
          # The special '*defaults' key applies to all sources at once
          '*defaults' => {
             include_colspec      => ['*'], #<-- default already ['*']
             ## uncomment these lines to turn on editing in all grids
             #updatable_colspec   => ['*'],
             #creatable_colspec   => ['*'],
             #destroyable_relspec => ['*'],
          }   
       },  

       # TableSpecs define extra RapidApp-specific metadata for each source
       # and is used/available to all modules which interact with them
       TableSpecs => {
         'MyDB::legacytable' => {
            display_column => "title",
         },  
       },
    }
);

I'm only attempting to change the display name at this point, but nothing changes when I've done the above. I don't think its properly selecting the element or something... (MyDB::legacytable is just a single 'table' in the demo and I'm trying 'MyDB::legacytable'. I've also tried 'legacytable' with no success.) If there is a good place to be looking for errors, I'm not sure where it is. (Lots gets flooded when I start RapidApp, 300 tables... Knowing what to look for would be very helpful.)