Skip to content

Instantly share code, notes, and snippets.

@SebDeclercq
Created May 3, 2012 13:40
Show Gist options
  • Save SebDeclercq/2585720 to your computer and use it in GitHub Desktop.
Save SebDeclercq/2585720 to your computer and use it in GitHub Desktop.
Error while running populate-db.pl
################ 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'],
],
'LawVersion', [
['lawid','numid','date'],
['1','L1V1','2000-04-12'],
['1','L1V2','2011-11-11'],
['2','L2V1','2004-01-12'],
['3','L3V1','2012-05-03'],
],
'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