[Dbix-class] DBIx giving err due to camleCase??? not sure..

Rajeev Prasad rp.neuli at yahoo.com
Mon Aug 21 01:20:42 GMT 2017


why am i getting this err in DBIx::Class ?
$./update_db.pl
DBIx::Class::ResultSource::unique_constraint_columns(): Unknown unique constraint nodeid on 'node' at ./update_from_ieds.pl line 80


relevant code:
...
sub addNode
{
    my $node = shift; my $lcNode = lc($node);
    my $id = $schema
        ->resultset('Node')
        ->find_or_create
        (
            { nodeName => $lcNode },
            { key => 'nodeid' }
        );
    return $id;
}
...


other details:
mysql> desc node;
+-----------+-----------------------+------+-----+---------+----------------+
| Field     | Type                  | Null | Key | Default | Extra          |
+-----------+-----------------------+------+-----+---------+----------------+
| nodeID    | mediumint(5) unsigned | NO   | PRI | NULL    | auto_increment |
| nodeName  | varchar(50)           | NO   | UNI | NULL    |                |
| nodeNotes | varchar(1000)         | YES  |     | NULL    |                |
+-----------+-----------------------+------+-----+---------+----------------+
3 rows in set (0.00 sec)


$ cat Node.pm
use utf8;
package Mydb::Schema::Result::Node;

# 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("node");
__PACKAGE__->add_columns(
  "nodeid",
  {
    data_type => "mediumint",
    extra => { unsigned => 1 },
    is_auto_increment => 1,
    is_nullable => 0,
  },
  "nodename",
  { data_type => "varchar", is_nullable => 0, size => 50 },
  "nodenotes",
  { data_type => "varchar", is_nullable => 1, size => 1000 },
);
__PACKAGE__->set_primary_key("nodeid");
__PACKAGE__->add_unique_constraint("node", ["nodename"]);


# Created by DBIx::Class::Schema::Loader v0.07045 @ 2017-08-18 19:20:59
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:t6+x6tFtAwGEHH/5qfBW/w


# You can replace this text with custom code or comments, and it will be preserved on regeneration
1;


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20170821/c7e2da39/attachment.htm>


More information about the DBIx-Class mailing list