Strangely does DBIx change table names from MySQL?
Rajeev Prasad <[email protected]>
| Newsgroups | gmane.comp.lang.perl.modules.dbix-class,gmane.comp.lang.perl.modules.dbi.general,gmane.comp.db.mysql.general |
|---|---|
| Message-ID | <[email protected]> |
Hello,
Note: this question is also posted on Stack Overflow, a few minutes back.
|
| While using ./create-schema-mydb.pl I realized that the table name "People" is changed to "Person" in DBIx. I am not sure how? or why?
It is not even a reserved word.
in MySQL:people innoDB utf8
create-schema script:$ cat ./create-schema-mydb.pl
#!/usr/bin/perl
use strict;
use warnings;
use DBIx::Class::Schema::Loader qw/make_schema_at/;
make_schema_at(
"Mydb::Schema",
{debug => 0, dump_directory => "../db/",
generate_pod => 0,},
["dbi:mysql:mydb:localhost:3306", 'mydb', 'password'],
);
It shows up like this after create-schema... note the change in name from People to Person, but inside the .pm file table name is retained as People !!!
Result$ cat Person.pm
use utf8;
package Mydb::Schema::Result::Person;
# Created by DBIx::Class::Schema::Loader
# DO NOT MODIFY THE FIRST PART OF THIS FILE
use strict;
use warnings;
use base 'DBIx::Class::Core';
__PACKAGE__->table("people");
__PACKAGE__->add_columns(
"pplid",
{
data_type => "smallint",
extra => { unsigned => 1 },
is_auto_increment => 1,
is_nullable => 0,
},
...
...
only relevant portion shown above...
Thank you.
Rajeev
|