[Dbix-class] DBIx::Class::Schema->deploy and ORACLE woes
Doug Scoular
dscoular at cisco.com
Wed Jun 4 23:01:05 BST 2008
Hi Scott,
I guess my real issue is not having to explicitly
list data_type and size in my schema for ORACLE but
how to work around deploy() producing "ON UPDATE CASCADE"
which, apparently, isn't supported by ORACLE:
http://www.oreview.com/9704dalb.htm
http://asktom.oracle.com/tkyte/update_cascade/index.html
Scott Pham (scpham) wrote:
> What does your other 2 tables look like? Can you post the schema
> definition for tables
> Runner::Model::TestGroup
> Runner::Model::Host
Fancy bumping into you here ;^)
Here are the definitions of my Host and TestGroup
modules:
Host:
package Runner::Model::Host;
use base qw/DBIx::Class/;
__PACKAGE__->load_components(qw/PK::Auto Core/);
__PACKAGE__->table('hosts');
__PACKAGE__->add_columns(
id => {
data_type => 'integer',
is_auto_increment => 1,
},
creation => {
data_type => 'datetime',
},
modification => {
data_type => 'datetime',
},
name => {
data_type => 'varchar',
size => 255,
is_unique => 1,
},
manufacturer => {
data_type => 'varchar',
is_nullable => 1,
size => 255,
},
product => {
data_type => 'varchar',
size => 255,
is_nullable => 1,
},
version => {
data_type => 'varchar',
size => 255,
is_nullable => 1,
},
serial => {
data_type => 'text',
is_nullable => 1,
},
ram => {
data_type => 'varchar',
size => 255,
is_nullable => 1,
},
cpuModel => {
data_type => 'varchar',
size => 255,
is_nullable => 1,
},
cpuCount => {
data_type => 'integer',
},
cpuCoreCount => {
data_type => 'integer',
},
cpuSpeed => {
data_type => 'varchar',
size => 255,
is_nullable => 1,
},
os => {
data_type => 'text',
is_nullable => 1,
},
arch => {
data_type => 'varchar',
size => 255,
is_nullable => 1,
},
public => {
data_type => 'text',
is_nullable => 1,
},
private => {
data_type => 'text',
is_nullable => 1,
},
);
__PACKAGE__->set_primary_key('id');
__PACKAGE__->has_many('host_to_testgroups' => 'Runner::Model::HostToTestGroup', 'HostID');
__PACKAGE__->many_to_many(testgroups => 'host_to_testgroups', 'TestGroupID');
__PACKAGE__->has_many('results' => 'Runner::Model::Result');
TestGroup:
package Runner::Model::TestGroup;
use base qw/DBIx::Class/;
__PACKAGE__->load_components(qw/PK::Auto Core/);
__PACKAGE__->table('testgroups');
__PACKAGE__->add_columns(
id => {
data_type => 'integer',
is_auto_increment => 1,
},
creation => {
data_type => 'datetime',
},
modification => {
data_type => 'datetime',
},
name => {
data_type => 'varchar',
size => 255,
is_unique => 1,
},
);
__PACKAGE__->set_primary_key('id');
__PACKAGE__->has_many('host_to_testgroups' => 'Runner::Model::HostToTestGroup',\
'TestGroupID');
__PACKAGE__->many_to_many('hosts' => 'host_to_testgroups', 'HostID');
__PACKAGE__->has_many('testgroup_to_test' => 'Runner::Model::TestGroupToTest', \
'TestGroupID');
__PACKAGE__->many_to_many('tests' => 'testgroup_to_test', 'TestID');
I can send you the rest of the schema directly if you like.
Here's are the link tables HostToTestGroup and TestGroupToTest too:
HostToTestGroup:
package Runner::Model::HostToTestGroup;
use base qw/DBIx::Class/;
__PACKAGE__->load_components(qw/PK::Auto Core/);
__PACKAGE__->table('host_to_testgroup');
__PACKAGE__->add_columns(
HostID => {
data_type => 'integer',
},
TestGroupID => {
data_type => 'integer',
}
);
#__PACKAGE__->add_columns(qw/HostID TestGroupID/);
__PACKAGE__->set_primary_key(qw/HostID TestGroupID/);
__PACKAGE__->belongs_to('HostID' => 'Runner::Model::Host');
__PACKAGE__->belongs_to('TestGroupID' => 'Runner::Model::TestGroup');
TestGroupToHost:
package Runner::Model::TestGroupToTest;
use base qw/DBIx::Class/;
__PACKAGE__->load_components(qw/PK::Auto Core/);
__PACKAGE__->table('testgroup_to_test');
__PACKAGE__->add_columns(qw/TestGroupID TestID/);
TestGroupID => {
data_type => 'integer',
},
TestID => {
data_type => 'integer',
}
);
__PACKAGE__->set_primary_key(qw/TestGroupID TestID/);
__PACKAGE__->belongs_to('TestID' => 'Runner::Model::Test');
__PACKAGE__->belongs_to('TestGroupID' => 'Runner::Model::TestGroup');
Cheers,
Doug
More information about the DBIx-Class
mailing list