[Bast-commits] r4967 - in DBIx-Class/0.08/trunk/t/lib: .
DBICTest/Schema
ribasushi at dev.catalyst.perl.org
ribasushi at dev.catalyst.perl.org
Fri Oct 24 14:23:33 BST 2008
Author: ribasushi
Date: 2008-10-24 14:23:33 +0100 (Fri, 24 Oct 2008)
New Revision: 4967
Modified:
DBIx-Class/0.08/trunk/t/lib/DBICTest/Schema/CD.pm
DBIx-Class/0.08/trunk/t/lib/DBICTest/Schema/CD_to_Producer.pm
DBIx-Class/0.08/trunk/t/lib/DBICTest/Schema/Genre.pm
DBIx-Class/0.08/trunk/t/lib/DBICTest/Schema/Producer.pm
DBIx-Class/0.08/trunk/t/lib/sqlite.sql
Log:
More test schema relations for future tests
Modified: DBIx-Class/0.08/trunk/t/lib/DBICTest/Schema/CD.pm
===================================================================
--- DBIx-Class/0.08/trunk/t/lib/DBICTest/Schema/CD.pm 2008-10-24 13:21:40 UTC (rev 4966)
+++ DBIx-Class/0.08/trunk/t/lib/DBICTest/Schema/CD.pm 2008-10-24 13:23:33 UTC (rev 4967)
@@ -53,7 +53,10 @@
{ order_by => 'producer.name' },
);
-__PACKAGE__->belongs_to('genre', 'DBICTest::Schema::Genre', { 'foreign.genreid' => 'self.genreid' });
+__PACKAGE__->belongs_to('genre', 'DBICTest::Schema::Genre',
+ { 'foreign.genreid' => 'self.genreid' },
+ { join_type => 'left' },
+);
#__PACKAGE__->add_relationship('genre', 'DBICTest::Schema::Genre',
# { 'foreign.genreid' => 'self.genreid' },
Modified: DBIx-Class/0.08/trunk/t/lib/DBICTest/Schema/CD_to_Producer.pm
===================================================================
--- DBIx-Class/0.08/trunk/t/lib/DBICTest/Schema/CD_to_Producer.pm 2008-10-24 13:21:40 UTC (rev 4966)
+++ DBIx-Class/0.08/trunk/t/lib/DBICTest/Schema/CD_to_Producer.pm 2008-10-24 13:23:33 UTC (rev 4967)
@@ -17,7 +17,8 @@
__PACKAGE__->belongs_to(
'producer', 'DBICTest::Schema::Producer',
- { 'foreign.producerid' => 'self.producer' }
+ { 'foreign.producerid' => 'self.producer' },
+ { on_delete => undef, on_update => undef },
);
1;
Modified: DBIx-Class/0.08/trunk/t/lib/DBICTest/Schema/Genre.pm
===================================================================
--- DBIx-Class/0.08/trunk/t/lib/DBICTest/Schema/Genre.pm 2008-10-24 13:21:40 UTC (rev 4966)
+++ DBIx-Class/0.08/trunk/t/lib/DBICTest/Schema/Genre.pm 2008-10-24 13:23:33 UTC (rev 4967)
@@ -5,18 +5,19 @@
use base 'DBIx::Class::Core';
__PACKAGE__->table('genre');
-__PACKAGE__->add_columns(qw/genreid name/);
+__PACKAGE__->add_columns(
+ genreid => {
+ data_type => 'integer',
+ is_auto_increment => 1,
+ },
+ name => {
+ data_type => 'varchar',
+ size => 100,
+ },
+);
__PACKAGE__->set_primary_key('genreid');
+__PACKAGE__->add_unique_constraint ( genre_name => [qw/name/] );
-1;
-package DBICTest::Schema::Genre;
+__PACKAGE__->has_many (cds => 'DBICTest::Schema::CD', 'genreid');
-use strict;
-
-use base 'DBIx::Class::Core';
-
-__PACKAGE__->table('genre');
-__PACKAGE__->add_columns(qw/genreid name/);
-__PACKAGE__->set_primary_key('genreid');
-
1;
Modified: DBIx-Class/0.08/trunk/t/lib/DBICTest/Schema/Producer.pm
===================================================================
--- DBIx-Class/0.08/trunk/t/lib/DBICTest/Schema/Producer.pm 2008-10-24 13:21:40 UTC (rev 4966)
+++ DBIx-Class/0.08/trunk/t/lib/DBICTest/Schema/Producer.pm 2008-10-24 13:23:33 UTC (rev 4967)
@@ -17,4 +17,8 @@
__PACKAGE__->set_primary_key('producerid');
__PACKAGE__->add_unique_constraint(prod_name => [ qw/name/ ]);
+__PACKAGE__->has_many(
+ producer_to_cd => 'DBICTest::Schema::CD_to_Producer' => 'producer'
+);
+
1;
Modified: DBIx-Class/0.08/trunk/t/lib/sqlite.sql
===================================================================
--- DBIx-Class/0.08/trunk/t/lib/sqlite.sql 2008-10-24 13:21:40 UTC (rev 4966)
+++ DBIx-Class/0.08/trunk/t/lib/sqlite.sql 2008-10-24 13:23:33 UTC (rev 4967)
@@ -1,6 +1,6 @@
--
-- Created by SQL::Translator::Producer::SQLite
--- Created on Thu Oct 9 13:44:56 2008
+-- Created on Fri Oct 24 14:20:32 2008
--
BEGIN TRANSACTION;
@@ -171,11 +171,11 @@
-- Table: genre
--
CREATE TABLE genre (
- genreid NOT NULL,
- name NOT NULL,
- PRIMARY KEY (genreid)
+ genreid INTEGER PRIMARY KEY NOT NULL,
+ name varchar(100) NOT NULL
);
+CREATE UNIQUE INDEX genre_name_genre ON genre (name);
--
-- Table: liner_notes
More information about the Bast-commits
mailing list