Revision history for DBIx::Class
+ - modified SQLT parser to skip dupe table names
- added remove_column(s) to ResultSource/ResultSourceProxy
- added add_column alias to ResultSourceProxy
- added source_name to ResultSource
+2005-04-16 by mst
+ - set_from_related should take undef
+ - ResultSource objects caching ->resultset causes interesting problems
+ - find why XSUB dumper kills schema in Catalyst (may be Pg only?)
+
2006-04-11 by castaway
- using PK::Auto should set is_auto_increment for the PK columns, so that copy() "just works"
- docs of copy() should say that is_auto_increment is essential for auto_incrementing keys
# print Dumper($dbixschema->registered_classes);
#foreach my $tableclass ($dbixschema->registered_classes)
+
+ my %seen_tables;
+
foreach my $moniker ($dbixschema->sources)
{
#eval "use $tableclass";
#print("Can't load $tableclass"), next if($@);
my $source = $dbixschema->source($moniker);
+ next if $seen_tables{$source->name}++;
+
my $table = $schema->add_table(
name => $source->name,
type => 'TABLE',
use lib qw(lib t/lib);
use DBICTest;
-use DBICTest::HelperRels;
+use DBICTest::Schema::HelperRels;
my $schema = DBICTest->initialise;
my $schema = DBICTest::Schema;
-plan tests => 31;
+plan tests => 33;
my $translator = SQL::Translator->new(
parser_args => {
{'display' => 'twokeytreelike name unique',
'table' => 'twokeytreelike', 'cols' => ['name'],
'needed' => 1},
+ {'display' => 'employee position and group_id unique',
+ 'table' => 'employee', cols => ['position', 'group_id'],
+ 'needed' => 1},
);
my $tschema = $translator->schema();
__PACKAGE__->load_components(qw( Ordered PK::Auto Core ));
-__PACKAGE__->table('employees');
+__PACKAGE__->table('employee');
__PACKAGE__->add_columns(
employee_id => {
close IN;
- $dbh->do($_) for split(/\n\n/, $sql);
+ $dbh->do($_) for split(/;\n/, $sql);
}
$schema->storage->dbh->do("PRAGMA synchronous = OFF");
--
-- Created by SQL::Translator::Producer::SQLite
--- Created on Fri Mar 24 15:47:00 2006
+-- Created on Wed Apr 19 18:32:39 2006
--
BEGIN TRANSACTION;
--
--- Table: employees
+-- Table: employee
--
-CREATE TABLE employees (
+CREATE TABLE employee (
employee_id INTEGER PRIMARY KEY NOT NULL,
position integer NOT NULL,
group_id integer,
);
--
+-- 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 (
);
--
--- Table: liner_notes
---
-CREATE TABLE liner_notes (
- liner_id INTEGER PRIMARY KEY NOT NULL,
- notes varchar(100) NOT NULL
-);
-
---
-- Table: artist
--
CREATE TABLE artist (
);
--
+-- 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)
+);
+
+--
-- Table: self_ref_alias
--
CREATE TABLE self_ref_alias (
);
--
--- Table: producer
---
-CREATE TABLE producer (
- producerid INTEGER PRIMARY KEY NOT NULL,
- name varchar(100) NOT NULL
-);
-
---
-- Table: onekey
--
CREATE TABLE onekey (
cd integer NOT NULL
);
+--
+-- Table: producer
+--
+CREATE TABLE producer (
+ producerid INTEGER PRIMARY KEY NOT NULL,
+ name varchar(100) NOT NULL
+);
+
+CREATE UNIQUE INDEX position_group_employee on employee (position, group_id);
+CREATE UNIQUE INDEX tktlnameunique_twokeytreelike on twokeytreelike (name);
+CREATE UNIQUE INDEX artist_title_cd on cd (artist, title);
COMMIT;