[Bast-commits] r4910 - in DBIx-Class/0.08/trunk: maint t/lib

ribasushi at dev.catalyst.perl.org ribasushi at dev.catalyst.perl.org
Thu Oct 9 12:19:28 BST 2008


Author: ribasushi
Date: 2008-10-09 12:19:28 +0100 (Thu, 09 Oct 2008)
New Revision: 4910

Modified:
   DBIx-Class/0.08/trunk/maint/gen-schema.pl
   DBIx-Class/0.08/trunk/t/lib/DBICTest.pm
   DBIx-Class/0.08/trunk/t/lib/sqlite.sql
Log:
Regenerate (finally\!) t/lib/sqlite.sql
Fix maint/gen-schema to work correctly with newer SQL::Translators

Modified: DBIx-Class/0.08/trunk/maint/gen-schema.pl
===================================================================
--- DBIx-Class/0.08/trunk/maint/gen-schema.pl	2008-10-08 09:46:18 UTC (rev 4909)
+++ DBIx-Class/0.08/trunk/maint/gen-schema.pl	2008-10-09 11:19:28 UTC (rev 4910)
@@ -5,7 +5,15 @@
 use lib qw(lib t/lib);
 
 use DBICTest::Schema;
+use SQL::Translator;
 
+my $sql_join_str = '';
+if (SQL::Translator->VERSION >= 0.09001) {
+    $sql_join_str .= ";";
+}
+if (SQL::Translator->VERSION >= 0.09) {
+    $sql_join_str .= "\n";
+}
+
 my $schema = DBICTest::Schema->connect;
-
-print $schema->storage->deployment_statements($schema, 'SQLite');
+print join ($sql_join_str,$schema->storage->deployment_statements($schema, 'SQLite') );

Modified: DBIx-Class/0.08/trunk/t/lib/DBICTest.pm
===================================================================
--- DBIx-Class/0.08/trunk/t/lib/DBICTest.pm	2008-10-08 09:46:18 UTC (rev 4909)
+++ DBIx-Class/0.08/trunk/t/lib/DBICTest.pm	2008-10-09 11:19:28 UTC (rev 4910)
@@ -132,7 +132,11 @@
         my $sql;
         { local $/ = undef; $sql = <IN>; }
         close IN;
-        ($schema->storage->dbh->do($_) || print "Error on SQL: $_\n") for split(/;\n/, $sql);
+        for my $chunk ( split (/;\s*\n+/, $sql) ) {
+          if ( $chunk =~ / ^ (?! --\s* ) \S /xm ) {  # there is some real sql in the chunk - a non-space at the start of the string which is not a comment
+            $schema->storage->dbh->do($chunk) or print "Error on SQL: $chunk\n";
+          }
+        }
     }
     return;
 }

Modified: DBIx-Class/0.08/trunk/t/lib/sqlite.sql
===================================================================
--- DBIx-Class/0.08/trunk/t/lib/sqlite.sql	2008-10-08 09:46:18 UTC (rev 4909)
+++ DBIx-Class/0.08/trunk/t/lib/sqlite.sql	2008-10-09 11:19:28 UTC (rev 4910)
@@ -1,46 +1,11 @@
 -- 
 -- Created by SQL::Translator::Producer::SQLite
--- Created on Tue Aug  8 01:53:20 2006
+-- Created on Thu Oct  9 13:12:46 2008
 -- 
 BEGIN TRANSACTION;
 
---
--- Table: employee
---
-CREATE TABLE employee (
-  employee_id INTEGER PRIMARY KEY NOT NULL,
-  position integer NOT NULL,
-  group_id integer,
-  group_id_2 integer,  
-  name varchar(100)
-);
 
 --
--- Table: serialized
---
-CREATE TABLE serialized (
-  id INTEGER PRIMARY KEY NOT NULL,
-  serialized text NOT NULL
-);
-
---
--- Table: liner_notes
---
-CREATE TABLE liner_notes (
-  liner_id INTEGER PRIMARY KEY NOT NULL,
-  notes varchar(100) NOT NULL
-);
-
---
--- Table: cd_to_producer
---
-CREATE TABLE cd_to_producer (
-  cd integer NOT NULL,
-  producer integer NOT NULL,
-  PRIMARY KEY (cd, producer)
-);
-
---
 -- Table: artist
 --
 CREATE TABLE artist (
@@ -48,41 +13,40 @@
   name varchar(100)
 );
 
+
 --
--- Table: twokeytreelike
+-- Table: artist_undirected_map
 --
-CREATE TABLE twokeytreelike (
+CREATE TABLE artist_undirected_map (
   id1 integer NOT NULL,
   id2 integer NOT NULL,
-  parent1 integer NOT NULL,
-  parent2 integer NOT NULL,
-  name varchar(100) NOT NULL,
   PRIMARY KEY (id1, id2)
 );
 
+CREATE INDEX artist_undirected_map_idx_id1_ ON artist_undirected_map (id1);
+CREATE INDEX artist_undirected_map_idx_id2_ ON artist_undirected_map (id2);
+
 --
--- Table: fourkeys_to_twokeys
+-- Table: bookmark
 --
-CREATE TABLE fourkeys_to_twokeys (
-  f_foo integer NOT NULL,
-  f_bar integer NOT NULL,
-  f_hello integer NOT NULL,
-  f_goodbye integer NOT NULL,
-  t_artist integer NOT NULL,
-  t_cd integer NOT NULL,
-  autopilot character NOT NULL,
-  PRIMARY KEY (f_foo, f_bar, f_hello, f_goodbye, t_artist, t_cd)
+CREATE TABLE bookmark (
+  id INTEGER PRIMARY KEY NOT NULL,
+  link integer NOT NULL
 );
 
+CREATE INDEX bookmark_idx_link_bookmark ON bookmark (link);
+
 --
--- Table: self_ref_alias
+-- Table: books
 --
-CREATE TABLE self_ref_alias (
-  self_ref integer NOT NULL,
-  alias integer NOT NULL,
-  PRIMARY KEY (self_ref, alias)
+CREATE TABLE books (
+  id INTEGER PRIMARY KEY NOT NULL,
+  source varchar(100) NOT NULL,
+  owner integer NOT NULL,
+  title varchar(100) NOT NULL
 );
 
+
 --
 -- Table: cd
 --
@@ -94,95 +58,144 @@
   genreid integer
 );
 
+CREATE INDEX cd_idx_artist_cd ON cd (artist);
+CREATE INDEX cd_idx_genreid_cd ON cd (genreid);
+CREATE UNIQUE INDEX cd_artist_title_cd ON cd (artist, title);
+
 --
--- Table: genre
+-- Table: cd_to_producer
 --
-CREATE TABLE genre (
-  genreid INTEGER PRIMARY KEY NOT NULL,
-  name varchar(100) NOT NULL
+CREATE TABLE cd_to_producer (
+  cd integer NOT NULL,
+  producer integer NOT NULL,
+  PRIMARY KEY (cd, producer)
 );
 
+CREATE INDEX cd_to_producer_idx_cd_cd_to_pr ON cd_to_producer (cd);
+CREATE INDEX cd_to_producer_idx_producer_cd ON cd_to_producer (producer);
+
 --
--- Table: bookmark
+-- Table: collection
 --
-CREATE TABLE bookmark (
-  id INTEGER PRIMARY KEY NOT NULL,
-  link integer NOT NULL
+CREATE TABLE collection (
+  collectionid INTEGER PRIMARY KEY NOT NULL,
+  name varchar(100) NOT NULL
 );
 
+
 --
--- Table: track
+-- Table: collection_object
 --
-CREATE TABLE track (
-  trackid INTEGER PRIMARY KEY NOT NULL,
-  cd integer NOT NULL,
-  position integer NOT NULL,
-  title varchar(100) NOT NULL,
-  last_updated_on datetime NULL
+CREATE TABLE collection_object (
+  collection integer NOT NULL,
+  object integer NOT NULL,
+  PRIMARY KEY (collection, object)
 );
 
+CREATE INDEX collection_object_idx_collection_collection_obj ON collection_object (collection);
+CREATE INDEX collection_object_idx_object_c ON collection_object (object);
+
 --
--- Table: self_ref
+-- Table: employee
 --
-CREATE TABLE self_ref (
-  id INTEGER PRIMARY KEY NOT NULL,
-  name varchar(100) NOT NULL
+CREATE TABLE employee (
+  employee_id INTEGER PRIMARY KEY NOT NULL,
+  position integer NOT NULL,
+  group_id integer,
+  group_id_2 integer,
+  name varchar(100)
 );
 
+
 --
--- Table: link
+-- Table: event
 --
-CREATE TABLE link (
+CREATE TABLE event (
   id INTEGER PRIMARY KEY NOT NULL,
-  url varchar(100),
-  title varchar(100)
+  starts_at datetime NOT NULL,
+  created_on timestamp NOT NULL
 );
 
+
 --
 -- Table: file_columns
 --
 CREATE TABLE file_columns (
   id INTEGER PRIMARY KEY NOT NULL,
-  file varchar(255)
+  file varchar(255) NOT NULL
 );
 
+
 --
--- Table: tags
+-- Table: forceforeign
 --
-CREATE TABLE tags (
-  tagid INTEGER PRIMARY KEY NOT NULL,
-  cd integer NOT NULL,
-  tag varchar(100) NOT NULL
+CREATE TABLE forceforeign (
+  artist INTEGER PRIMARY KEY NOT NULL,
+  cd integer NOT NULL
 );
 
+CREATE INDEX forceforeign_idx_artist_forcef ON forceforeign (artist);
+
 --
--- Table: treelike
+-- Table: fourkeys
 --
-CREATE TABLE treelike (
-  id INTEGER PRIMARY KEY NOT NULL,
-  parent integer NULL,
-  name varchar(100) NOT NULL
+CREATE TABLE fourkeys (
+  foo integer NOT NULL,
+  bar integer NOT NULL,
+  hello integer NOT NULL,
+  goodbye integer NOT NULL,
+  sensors character NOT NULL,
+  PRIMARY KEY (foo, bar, hello, goodbye)
 );
 
+
 --
--- Table: event
+-- Table: fourkeys_to_twokeys
 --
-CREATE TABLE event (
-  id INTEGER PRIMARY KEY NOT NULL,
-  starts_at datetime NOT NULL,
-  created_on timestamp NOT NULL
+CREATE TABLE fourkeys_to_twokeys (
+  f_foo integer NOT NULL,
+  f_bar integer NOT NULL,
+  f_hello integer NOT NULL,
+  f_goodbye integer NOT NULL,
+  t_artist integer NOT NULL,
+  t_cd integer NOT NULL,
+  autopilot character NOT NULL,
+  PRIMARY KEY (f_foo, f_bar, f_hello, f_goodbye, t_artist, t_cd)
 );
 
+CREATE INDEX fourkeys_to_twokeys_idx_f_foo_f_bar_f_hello_f_goodbye_ ON fourkeys_to_twokeys (f_foo, f_bar, f_hello, f_goodbye);
+CREATE INDEX fourkeys_to_twokeys_idx_t_artist_t_cd_fourkeys_to ON fourkeys_to_twokeys (t_artist, t_cd);
+
 --
--- Table: twokeys
+-- Table: genre
 --
-CREATE TABLE twokeys (
-  artist integer NOT NULL,
-  cd integer NOT NULL,
-  PRIMARY KEY (artist, cd)
+CREATE TABLE genre (
+  genreid  NOT NULL,
+  name  NOT NULL,
+  PRIMARY KEY (genreid)
 );
 
+
 --
+-- Table: liner_notes
+--
+CREATE TABLE liner_notes (
+  liner_id INTEGER PRIMARY KEY NOT NULL,
+  notes varchar(100) NOT NULL
+);
+
+
+--
+-- Table: link
+--
+CREATE TABLE link (
+  id INTEGER PRIMARY KEY NOT NULL,
+  url varchar(100),
+  title varchar(100)
+);
+
+
+--
 -- Table: noprimarykey
 --
 CREATE TABLE noprimarykey (
@@ -191,27 +204,27 @@
   baz integer NOT NULL
 );
 
+CREATE UNIQUE INDEX foo_bar_noprimarykey ON noprimarykey (foo, bar);
+
 --
--- Table: fourkeys
+-- Table: onekey
 --
-CREATE TABLE fourkeys (
-  foo integer NOT NULL,
-  bar integer NOT NULL,
-  hello integer NOT NULL,
-  goodbye integer NOT NULL,
-  sensors character NOT NULL,
-  PRIMARY KEY (foo, bar, hello, goodbye)
+CREATE TABLE onekey (
+  id INTEGER PRIMARY KEY NOT NULL,
+  artist integer NOT NULL,
+  cd integer NOT NULL
 );
 
+
 --
--- Table: artist_undirected_map
+-- Table: owners
 --
-CREATE TABLE artist_undirected_map (
-  id1 integer NOT NULL,
-  id2 integer NOT NULL,
-  PRIMARY KEY (id1, id2)
+CREATE TABLE owners (
+  ownerid INTEGER PRIMARY KEY NOT NULL,
+  name varchar(100) NOT NULL
 );
 
+
 --
 -- Table: producer
 --
@@ -220,63 +233,121 @@
   name varchar(100) NOT NULL
 );
 
+CREATE UNIQUE INDEX prod_name_producer ON producer (name);
+
 --
--- Table: onekey
+-- Table: self_ref
 --
-CREATE TABLE onekey (
+CREATE TABLE self_ref (
   id INTEGER PRIMARY KEY NOT NULL,
-  artist integer NOT NULL,
-  cd integer NOT NULL
+  name varchar(100) NOT NULL
 );
 
+
 --
--- Table: typed_object
+-- Table: self_ref_alias
 --
-CREATE TABLE typed_object (
-  objectid INTEGER PRIMARY KEY NOT NULL,
-  type VARCHAR(100) NOT NULL,
-  value VARCHAR(100)
+CREATE TABLE self_ref_alias (
+  self_ref integer NOT NULL,
+  alias integer NOT NULL,
+  PRIMARY KEY (self_ref, alias)
 );
 
+CREATE INDEX self_ref_alias_idx_alias_self_ ON self_ref_alias (alias);
+CREATE INDEX self_ref_alias_idx_self_ref_se ON self_ref_alias (self_ref);
+
 --
--- Table: collection
+-- Table: sequence_test
 --
-CREATE TABLE collection (
-  collectionid INTEGER PRIMARY KEY NOT NULL,
-  name VARCHAR(100)
+CREATE TABLE sequence_test (
+  pkid1 integer NOT NULL,
+  pkid2 integer NOT NULL,
+  nonpkid integer NOT NULL,
+  name varchar(100),
+  PRIMARY KEY (pkid1, pkid2)
 );
 
+
 --
--- Table: collection_object
+-- Table: serialized
 --
-CREATE TABLE collection_object (
-  collection INTEGER NOT NULL,
-  object INTEGER NOT NULL
+CREATE TABLE serialized (
+  id INTEGER PRIMARY KEY NOT NULL,
+  serialized text NOT NULL
 );
 
+
 --
--- Table: owners
+-- Table: tags
 --
-CREATE TABLE owners (
-  ownerid INTEGER PRIMARY KEY NOT NULL,
-  name varchar(100)
+CREATE TABLE tags (
+  tagid INTEGER PRIMARY KEY NOT NULL,
+  cd integer NOT NULL,
+  tag varchar(100) NOT NULL
 );
 
+CREATE INDEX tags_idx_cd_tags ON tags (cd);
+
 --
--- Table: books
+-- Table: track
 --
-CREATE TABLE books (
+CREATE TABLE track (
+  trackid INTEGER PRIMARY KEY NOT NULL,
+  cd integer NOT NULL,
+  position integer NOT NULL,
+  title varchar(100) NOT NULL,
+  last_updated_on datetime
+);
+
+CREATE INDEX track_idx_cd_track ON track (cd);
+CREATE UNIQUE INDEX track_cd_position_track ON track (cd, position);
+CREATE UNIQUE INDEX track_cd_title_track ON track (cd, title);
+
+--
+-- Table: treelike
+--
+CREATE TABLE treelike (
   id INTEGER PRIMARY KEY NOT NULL,
-  owner INTEGER,
-  source varchar(100),
-  title varchar(100)
+  parent integer,
+  name varchar(100) NOT NULL
 );
 
+CREATE INDEX treelike_idx_parent_treelike ON treelike (parent);
 
-CREATE UNIQUE INDEX tktlnameunique_twokeytreelike on twokeytreelike (name);
-CREATE UNIQUE INDEX cd_artist_title_cd on cd (artist, title);
-CREATE UNIQUE INDEX track_cd_position_track on track (cd, position);
-CREATE UNIQUE INDEX track_cd_title_track on track (cd, title);
-CREATE UNIQUE INDEX foo_bar_noprimarykey on noprimarykey (foo, bar);
-CREATE UNIQUE INDEX prod_name_producer on producer (name);
+--
+-- Table: twokeytreelike
+--
+CREATE TABLE twokeytreelike (
+  id1 integer NOT NULL,
+  id2 integer NOT NULL,
+  parent1 integer NOT NULL,
+  parent2 integer NOT NULL,
+  name varchar(100) NOT NULL,
+  PRIMARY KEY (id1, id2)
+);
+
+CREATE INDEX twokeytreelike_idx_parent1_parent2_twokeytre ON twokeytreelike (parent1, parent2);
+CREATE UNIQUE INDEX tktlnameunique_twokeytreelike ON twokeytreelike (name);
+
+--
+-- Table: twokeys
+--
+CREATE TABLE twokeys (
+  artist integer NOT NULL,
+  cd integer NOT NULL,
+  PRIMARY KEY (artist, cd)
+);
+
+CREATE INDEX twokeys_idx_artist_twokeys ON twokeys (artist);
+
+--
+-- Table: typed_object
+--
+CREATE TABLE typed_object (
+  objectid INTEGER PRIMARY KEY NOT NULL,
+  type varchar(100) NOT NULL,
+  value varchar(100) NOT NULL
+);
+
+
 COMMIT;




More information about the Bast-commits mailing list