BEGIN { plan
tests
=> 4 };
ok(1);
DBIx::ORM::Declarative->
import
(
{
schema
=>
'Schema1'
,
tables
=>
[
{
table
=>
'Table1'
,
primary
=> [
'Column1T1'
, ],
unique
=> [ [
qw(Column2T1 Column3T1)
], ],
select_null_primary
=>
'SELECT LAST_INSERT_ID()'
,
columns
=>
[
{
name
=>
'Column1T1'
, },
{
name
=>
'Column2T1'
, },
{
name
=>
'Column3T1'
, },
{
name
=>
'Column4T1'
, },
{
name
=>
'Column5T1'
, },
],
},
{
table
=>
'Table2'
,
primary
=> [
'Column1T2'
, ],
select_null_primary
=>
'SELECT LAST_INSERT_ID()'
,
columns
=>
[
{
name
=>
'Column1T2'
, },
{
name
=>
'Column2T2'
, },
{
name
=>
'Column3T2'
, },
{
name
=>
'Column4T2'
, },
{
name
=>
'Column5T2'
, },
],
},
],
joins
=>
[
{
name
=>
'Join1'
,
primary
=>
'Table1'
,
tables
=>
[
{
table
=>
'Table2'
,
columns
=>
{
Column2T1
=> Column2T2,
},
},
],
},
],
},
) ;
my
$db
= DBIx::ORM::Declarative->new->Schema1->Table1;
ok(
$db
->_class eq
'DBIx::ORM::Declarative::Schema::Schema1::Table1'
);
$db
=
$db
->Join1;
$db
->table(
table
=>
'Table3'
,
columns
=> [ {
name
=>
'Column1T3'
} ]);
$db
=
$db
->Table3;
ok(
$db
->_class eq
'DBIx::ORM::Declarative::Schema::Schema1::Table3'
);
ok(
$db
->Join1->_class eq
'DBIx::ORM::Declarative::Schema::Schema1::Join1'
);