[Dbix-class] Strangely does DBIx change table names from MySQL?
Rajeev Prasad
rp.neuli at yahoo.com
Fri Mar 10 16:47:11 GMT 2017
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
|
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20170310/00e15a6c/attachment.htm>
More information about the DBIx-Class
mailing list