Get rid of Path::Class ( that *does* feel good )
[dbsrgits/DBIx-Class.git] / examples / Schema / insertdb.pl
old mode 100644 (file)
new mode 100755 (executable)
index a701795..4fb22fa
@@ -3,13 +3,12 @@
 use strict;
 use warnings;
 
-use MyDatabase::Main;
+use MyApp::Schema;
+use DBIx::Class::_Util 'parent_dir';
 
-my $schema = MyDatabase::Main->connect('dbi:SQLite:db/example.db');
+my $db_fn = parent_dir( $INC{'MyApp/Schema.pm'} ) . '../db/example.db';
 
-#  here's some of the sql that is going to be generated by the schema
-#  INSERT INTO artist VALUES (NULL,'Michael Jackson');
-#  INSERT INTO artist VALUES (NULL,'Eminem');
+my $schema = MyApp::Schema->connect("dbi:SQLite:$db_fn");
 
 my @artists = (['Michael Jackson'], ['Eminem']);
 $schema->populate('Artist', [
@@ -32,7 +31,7 @@ foreach my $lp (keys %albums) {
 }
 
 $schema->populate('Cd', [
-    [qw/title artist/],
+    [qw/title artistid/],
     @cds,
 ]);
 
@@ -56,6 +55,6 @@ foreach my $track (keys %tracks) {
 }
 
 $schema->populate('Track',[
-    [qw/cd title/],
+    [qw/cdid title/],
     @tracks,
 ]);