-
-
Save edipretoro/2585815 to your computer and use it in GitHub Desktop.
Error while running populate-db.pl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################ schema.sql #################### | |
# CREATE TABLE Law ( | |
# id integer primary key, | |
# title text not null, | |
# lastdate date not null, | |
# auth text | |
# ); | |
# CREATE TABLE LawVersion ( | |
# lawid integer references Law(id), | |
# numid text primary key not null, | |
# date date not null | |
# ); | |
# CREATE TABLE Article ( | |
# numid text references LawVersion(numid), | |
# lawid integer references Law(id), | |
# numord integer not null, | |
# text text not null, | |
# primary key (numid,numord) | |
# ); | |
########### populate-db.pl ##################### | |
package My::LawDB::Schema; | |
use base qw(DBIx::Class::Schema::Loader); | |
package main; | |
my $schema = My::LawDB::Schema->connect('dbi:SQLite:dbname=LawDB.db'); | |
$schema->populate('Law', [ | |
['id','title','lastdate','auth'], | |
['1','Law one','2011-11-11','Author One'], | |
['2','Law two','2004-01-12','Author One'], | |
['3','Law three','2012-05-03','Author Two'], | |
]); | |
$schema->storage->dbh_do( sub { | |
my ( $storage, $dbh ) = @_; | |
$dbh->do( "INSERT INTO LawVersion ( 'lawid','numid','date') VALUES ('1','Law one','2011-11-11')"); | |
$dbh->do( "INSERT INTO LawVersion ( 'lawid','numid','date') VALUES ('2','Law two','2004-01-12')"); | |
$dbh->do( "INSERT INTO LawVersion ( 'lawid','numid','date') VALUES ('3','Law three','2012-05-03')"); | |
} ); | |
$schema->populate('Article', [ | |
['numid','lawid','numord','text'], | |
['L1V1','1','1','article à propos de la liaison chaude'], | |
['L1V2','1','1','article sur la liaison chaude'], | |
['L1V1','1','2','article à propos de la liaison froide'], | |
['L2V1','2','1','à propos des bains-maries'], | |
['L2V1','2','2','à propos des friteuses'], | |
]); | |
########## resulting errors ###################### | |
# Dynamic schema detected, will run in 0.04006 mode. | |
# Set the 'naming' attribute or the SCHEMA_LOADER_BACKCOMPAT environment variable | |
# to disable this warning. | |
# See perldoc DBIx::Class::Schema::Loader::Manual::UpgradingFromV4 for more | |
# details. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment