Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tomáš Trávníček
doctrine-dbal
Commits
422890ce
Commit
422890ce
authored
Jun 12, 2007
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
--no commit message
--no commit message
parent
69c8531d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
16 deletions
+36
-16
PgsqlTestCase.php
tests/Export/PgsqlTestCase.php
+15
-3
FooRecord.php
tests/Export/_files/FooRecord.php
+21
-13
No files found.
tests/Export/PgsqlTestCase.php
View file @
422890ce
...
@@ -80,9 +80,21 @@ class Doctrine_Export_Pgsql_TestCase extends Doctrine_UnitTestCase
...
@@ -80,9 +80,21 @@ class Doctrine_Export_Pgsql_TestCase extends Doctrine_UnitTestCase
public
function
testExportSql
()
public
function
testExportSql
()
{
{
$sql
=
$this
->
export
->
exportSql
(
dirname
(
__FILE__
)
.
DIRECTORY_SEPARATOR
.
'_files'
);
$sql
=
$this
->
export
->
exportSql
(
dirname
(
__FILE__
)
.
DIRECTORY_SEPARATOR
.
'_files'
);
$this
->
assertEqual
(
$sql
,
array
(
0
=>
'CREATE TABLE foo (id BIGSERIAL, name VARCHAR(200) NOT NULL, parent_id BIGINT, local_foo BIGINT, PRIMARY KEY(id))'
,
print
"<pre>"
;
1
=>
'CREATE TABLE foo_reference (foo1 BIGINT, foo2 BIGINT, PRIMARY KEY(foo1, foo2))'
,
print_r
(
$sql
);
2
=>
'CREATE TABLE foo_bar_record (fooid BIGINT, barid BIGINT, PRIMARY KEY(fooid, barid))'
,
3
=>
'CREATE TABLE bar (id BIGSERIAL, name VARCHAR(200), PRIMARY KEY(id))'
,
4
=>
'CREATE TABLE foo_locally_owned (id BIGSERIAL, name VARCHAR(200), PRIMARY KEY(id))'
,
5
=>
'CREATE TABLE foo_foreignly_owned (id BIGSERIAL, name VARCHAR(200), fooid BIGINT, PRIMARY KEY(id))'
,
6
=>
'CREATE TABLE foo_foreignly_owned_with_pk (id BIGSERIAL, name VARCHAR(200), PRIMARY KEY(id))'
,
7
=>
'ALTER TABLE foo_reference ADD CONSTRAINT FOREIGN KEY (foo1) REFERENCES foo(id) ON DELETE CASCADE'
,
8
=>
'ALTER TABLE foo_reference ADD CONSTRAINT FOREIGN KEY (foo2) REFERENCES foo(id) ON DELETE CASCADE'
,
9
=>
'ALTER TABLE foo ADD CONSTRAINT FOREIGN KEY (parent_id) REFERENCES foo(id) ON DELETE CASCADE'
,
10
=>
'ALTER TABLE foo_foreignly_owned_with_pk ADD CONSTRAINT FOREIGN KEY (id) REFERENCES foo(id)'
,
11
=>
'ALTER TABLE foo_bar_record ADD CONSTRAINT FOREIGN KEY (fooId) REFERENCES foo(id)'
,
12
=>
'ALTER TABLE foo_bar_record ADD CONSTRAINT FOREIGN KEY (barId) REFERENCES bar(id)'
,
13
=>
'ALTER TABLE foo_bar_record ADD CONSTRAINT FOREIGN KEY (barId) REFERENCES bar(id)'
,
14
=>
'ALTER TABLE foo_bar_record ADD CONSTRAINT FOREIGN KEY (fooId) REFERENCES foo(id)'
,
));
}
}
}
}
?>
?>
tests/Export/_files/FooRecord.php
View file @
422890ce
...
@@ -33,9 +33,21 @@ class FooRecord extends Doctrine_Record
...
@@ -33,9 +33,21 @@ class FooRecord extends Doctrine_Record
$this
->
hasOne
(
'FooRecord as Parent'
,
array
(
'local'
=>
'parent_id'
,
'foreign'
=>
'id'
,
'onDelete'
=>
'CASCADE'
));
$this
->
hasOne
(
'FooRecord as Parent'
,
array
(
'local'
=>
'parent_id'
,
'foreign'
=>
'id'
,
'onDelete'
=>
'CASCADE'
));
$this
->
hasOne
(
'FooForeignlyOwnedWithPk'
,
array
(
'local'
=>
'id'
,
'foreign'
=>
'id'
,
'constraint'
=>
true
));
$this
->
hasOne
(
'FooForeignlyOwnedWithPk'
,
array
(
'local'
=>
'id'
,
'foreign'
=>
'id'
,
'constraint'
=>
true
));
$this
->
hasOne
(
'FooLocallyOwned'
,
array
(
'local'
=>
'local_foo'
,
'onDelete'
=>
'RESTRICT'
));
$this
->
hasOne
(
'FooLocallyOwned'
,
array
(
'local'
=>
'local_foo'
,
'onDelete'
=>
'RESTRICT'
));
$this
->
hasMany
(
'BarRecord as Bar'
,
array
(
'local'
=>
'fooId'
,
'foreign'
=>
'barId'
,
'refClass'
=>
'FooBarRecord'
));
}
}
}
}
class
FooReferenceRecord
extends
Doctrine_Record
{
public
function
setTableDefinition
()
{
$this
->
setTableName
(
'foo_reference'
);
$this
->
hasColumn
(
'foo1'
,
'integer'
,
null
,
array
(
'primary'
=>
true
));
$this
->
hasColumn
(
'foo2'
,
'integer'
,
null
,
array
(
'primary'
=>
true
));
}
}
class
FooBarRecord
extends
Doctrine_Record
class
FooBarRecord
extends
Doctrine_Record
{
{
public
function
setTableDefinition
()
public
function
setTableDefinition
()
...
@@ -48,8 +60,13 @@ class BarRecord extends Doctrine_Record
...
@@ -48,8 +60,13 @@ class BarRecord extends Doctrine_Record
{
{
public
function
setTableDefinition
()
public
function
setTableDefinition
()
{
{
$this
->
setTableName
(
'bar'
);
$this
->
hasColumn
(
'name'
,
'string'
,
200
);
$this
->
hasColumn
(
'name'
,
'string'
,
200
);
}
}
public
function
setUp
()
{
$this
->
hasMany
(
'FooRecord as Foo'
,
array
(
'local'
=>
'barId'
,
'foreign'
=>
'fooId'
,
'refClass'
=>
'FooBarRecord'
));
}
}
}
class
FooLocallyOwned
extends
Doctrine_Record
class
FooLocallyOwned
extends
Doctrine_Record
{
{
...
@@ -77,13 +94,4 @@ class FooForeignlyOwnedWithPk extends Doctrine_Record
...
@@ -77,13 +94,4 @@ class FooForeignlyOwnedWithPk extends Doctrine_Record
$this
->
hasOne
(
'FooRecord'
,
array
(
'local'
=>
'id'
,
'foreign'
=>
'id'
));
$this
->
hasOne
(
'FooRecord'
,
array
(
'local'
=>
'id'
,
'foreign'
=>
'id'
));
}
}
}
}
class
FooReferenceRecord
extends
Doctrine_Record
{
public
function
setTableDefinition
()
{
$this
->
setTableName
(
'foo_reference'
);
$this
->
hasColumn
(
'foo1'
,
'integer'
,
null
,
array
(
'primary'
=>
true
));
$this
->
hasColumn
(
'foo2'
,
'integer'
,
null
,
array
(
'primary'
=>
true
));
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment