dbicdump错误perl 5.22.1

时间:2017-01-08 15:23:48

标签: mysql perl schema dbix-class

我正在我的笔记本电脑上工作,它上面有linux mint(版本17)perl 5.18.2。
我运行dbicdump,一切正常。我转储sql数据库并将模式复制到我的PC。
在我的PC linux mint(版本18.1)上安装了perl 5.22.1。我的目录结构和数据库在两台机器上是相同的。在Mint 17的PC架构上没有工作,所以我试图运行dbicdump命令。
当我运行dbicdump时,我得到了

dbicdump Database::Schema dbi:mysql:database=Database 'user' 'password'
Dumping manual schema for Database::Schema to directory . ...
Schema dump completed.
Failed to reload class Database::Schema::Result::Author: sub name "years_rs" is not valid! at /usr/local/share/perl/5.22.1/DBIx/Class /Relationship/Accessor.pm line 99.
Compilation failed in require at (eval 114) line 2.

And all Database::Schema::Result::Author printed in the console.
(not showing becuause of the space it will take)

如果我运行脚本,则显示此错误!

 {UNKNOWN}: sub name "years_rs" is not valid! at /usr/local/share/perl/5.22.1/DBIx/Class/Relationship/Accessor.pm line 99.
Compilation failed in require at /usr/local/share/perl/5.22.1/Class   /C3/Componentised.pm line 150. at /usr/local/share/perl/5.22.1/Class/C3/Componentised.pm line 155

Perl版本5.22.1
DBIx :: Class :: Schema :: Loader(0.07046)
DBIx :: Class(0.82840)

它在perl 5.18.2上工作正常,perl 5.22.1上有错误吗?

我找到了问题的根源,这是外键问题。 我发现它与外键有关'在数据中。一张表是

 CREATE TABLE `authors` (
`id` INT(50) NOT NULL AUTO_INCREMENT,
`authorName` TINYTEXT NOT NULL,
`aboutAuthor` TINYTEXT NOT NULL,
PRIMARY KEY (`id`)
)
COLLATE='latin1_swedish_ci'  ENGINE=InnoDB  ;

和其他表是

 CREATE TABLE `295c` (
`id` INT(50) NOT NULL AUTO_INCREMENT,
`fileName` VARCHAR(40) NULL DEFAULT NULL,
`file_link` VARCHAR(40) NULL DEFAULT NULL,
`file_toolTips` VARCHAR(40) NULL DEFAULT NULL,
`image` VARCHAR(100) NOT NULL DEFAULT '/img/IconFlag.png',
`content` TEXT NOT NULL,
`author` INT(50) NOT NULL,
`keywords` VARCHAR(80) NULL DEFAULT NULL,
`timemade` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
INDEX `FK__authors` (`author`),
CONSTRAINT `FK__authors` FOREIGN KEY (`author`) REFERENCES `authors`(`id`) )COLLATE='latin1_swedish_ci' ENGINE=InnoDB ;

这些简单的表格给了我错误,

Dumping manual schema for Database3::Schema to directory . ...
Schema dump completed.
Failed to reload class Database3::Schema::Result::Author: sub name      "295cs_rs" is not valid! at /usr/local/share/perl/5.22.1/DBIx/Class/Relationship/Accessor.pm line 99.
Compilation failed in require at (eval 106) line 2.
.

CLASS SOURCE:

use utf8;
package Database3::Schema::Result::Author;

# Created by DBIx::Class::Schema::Loader
# DO NOT MODIFY THE FIRST PART OF THIS FILE

=head1 NAME

Database3::Schema::Result::Author

=cut

use strict;
use warnings;

use base 'DBIx::Class::Core';

=head1 TABLE: C<authors>

=cut

__PACKAGE__->table("authors");

=head1 ACCESSORS

=head2 id

 data_type: 'integer'
 is_auto_increment: 1
 is_nullable: 0

 =head2 authorname

 data_type: 'tinytext'
  is_nullable: 0

  =head2 aboutauthor

  data_type: 'tinytext'
  is_nullable: 0

 =cut

 __PACKAGE__->add_columns(
   "id",
   { data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
   "authorname",
   { data_type => "tinytext", is_nullable => 0 },
   "aboutauthor",
   { data_type => "tinytext", is_nullable => 0 },
 );

 =head1 PRIMARY KEY

 =over 4

 =item * L</id>

 =back

  =cut

  __PACKAGE__->set_primary_key("id");

 =head1 RELATIONS

  =head2 295cs

  Type: has_many

  Related object: L<Database3::Schema::Result::295c>

  =cut

__PACKAGE__->has_many(
    "295cs",
    "Database3::Schema::Result::295c",
     { "foreign.author" => "self.id" },
     { cascade_copy => 0, cascade_delete => 0 },
  );


  # Created by DBIx::Class::Schema::Loader v0.07046 @ 2017-01-09 10:24:48
  # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:9qGUX8im/t3Tsv/4FrDw2A


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

任何解决方案,非常感谢,

0 个答案:

没有答案