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
1e8270a3
Unverified
Commit
1e8270a3
authored
Mar 23, 2017
by
Marius Meißner
Committed by
Marco Pivetta
May 20, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DBAL-#1234: Fixed bug that primary key is missing + added tests
parent
6cc34f14
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
1 deletion
+24
-1
OraclePlatform.php
lib/Doctrine/DBAL/Platforms/OraclePlatform.php
+1
-1
OracleSchemaManagerTest.php
.../Tests/DBAL/Functional/Schema/OracleSchemaManagerTest.php
+23
-0
No files found.
lib/Doctrine/DBAL/Platforms/OraclePlatform.php
View file @
1e8270a3
...
@@ -443,7 +443,7 @@ class OraclePlatform extends AbstractPlatform
...
@@ -443,7 +443,7 @@ class OraclePlatform extends AbstractPlatform
(
(
SELECT ucon.constraint_type
SELECT ucon.constraint_type
FROM user_constraints ucon
FROM user_constraints ucon
WHERE ucon.
constraint
_name = uind_col.index_name
WHERE ucon.
index
_name = uind_col.index_name
) AS is_primary
) AS is_primary
FROM user_ind_columns uind_col
FROM user_ind_columns uind_col
WHERE uind_col.table_name = "
.
$table
.
"
WHERE uind_col.table_name = "
.
$table
.
"
...
...
tests/Doctrine/Tests/DBAL/Functional/Schema/OracleSchemaManagerTest.php
View file @
1e8270a3
...
@@ -234,6 +234,29 @@ class OracleSchemaManagerTest extends SchemaManagerFunctionalTestCase
...
@@ -234,6 +234,29 @@ class OracleSchemaManagerTest extends SchemaManagerFunctionalTestCase
$this
->
assertCount
(
7
,
$columns
);
$this
->
assertCount
(
7
,
$columns
);
}
}
/**
* @group DBAL-1234
*/
public
function
testListTableIndexesPrimaryKeyConstraintNameDiffersFromIndexName
()
{
$table
=
new
Table
(
'list_table_indexes_pk_id_test'
);
$table
->
setSchemaConfig
(
$this
->
_sm
->
createSchemaConfig
());
$table
->
addColumn
(
'id'
,
'integer'
,
[
'notnull'
=>
true
]);
$table
->
addUniqueIndex
([
'id'
],
'id_unique_index'
);
$this
->
_sm
->
dropAndCreateTable
(
$table
);
// Adding a primary key on already indexed columns
// Oracle will reuse the unique index, which cause a constraint name differing from the index name
$this
->
_sm
->
createConstraint
(
new
Schema\Index
(
'id_pk_id_index'
,
[
'id'
],
true
,
true
),
'list_table_indexes_pk_id_test'
);
$tableIndexes
=
$this
->
_sm
->
listTableIndexes
(
'list_table_indexes_pk_id_test'
);
$this
->
assertArrayHasKey
(
'primary'
,
$tableIndexes
,
'listTableIndexes() has to return a "primary" array key.'
);
$this
->
assertEquals
([
'id'
],
array_map
(
'strtolower'
,
$tableIndexes
[
'primary'
]
->
getColumns
()));
$this
->
assertTrue
(
$tableIndexes
[
'primary'
]
->
isUnique
());
$this
->
assertTrue
(
$tableIndexes
[
'primary'
]
->
isPrimary
());
}
/**
/**
* @group DBAL-2555
* @group DBAL-2555
*/
*/
...
...
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