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
aedfbf26
Commit
aedfbf26
authored
Dec 20, 2013
by
Benjamin Eberlei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[DBAL-586] Fix failures introduced by PR and adjust code.
parent
fd288786
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
10 deletions
+23
-10
MySqlPlatform.php
lib/Doctrine/DBAL/Platforms/MySqlPlatform.php
+0
-9
MySqlPlatformTest.php
tests/Doctrine/Tests/DBAL/Platforms/MySqlPlatformTest.php
+23
-1
No files found.
lib/Doctrine/DBAL/Platforms/MySqlPlatform.php
View file @
aedfbf26
...
...
@@ -623,15 +623,6 @@ class MySqlPlatform extends AbstractPlatform
}
}
}
foreach
(
$diff
->
changedIndexes
as
$changedKey
=>
$changedIndex
)
{
if
(
$changedIndex
->
isPrimary
()
&&
$changedKey
!=
'PRIMARY'
)
{
$index
=
$diff
->
changedIndexes
[
$changedKey
];
$index
=
new
Index
(
$changedKey
,
$index
->
getColumns
(),
$index
->
isUnique
(),
false
);
$diff
->
removedIndexes
[
$changedKey
]
=
$index
;
$diff
->
addedIndexes
[
'PRIMARY'
]
=
$diff
->
changedIndexes
[
$changedKey
];
unset
(
$diff
->
changedIndexes
[
$changedKey
]);
}
}
$sql
=
array_merge
(
$sql
,
parent
::
getPreAlterTableIndexForeignKeySQL
(
$diff
));
...
...
tests/Doctrine/Tests/DBAL/Platforms/MySqlPlatformTest.php
View file @
aedfbf26
...
...
@@ -296,6 +296,28 @@ class MySqlPlatformTest extends AbstractPlatformTestCase
$this
->
assertEquals
(
'LONGBLOB'
,
$this
->
_platform
->
getBlobTypeDeclarationSQL
(
array
()));
}
/**
* @group DBAL-400
*/
public
function
testAlterTableAddPrimaryKey
()
{
$table
=
new
Table
(
'alter_table_add_pk'
);
$table
->
addColumn
(
'id'
,
'integer'
);
$table
->
addColumn
(
'foo'
,
'integer'
);
$table
->
addIndex
(
array
(
'id'
),
'idx_id'
);
$comparator
=
new
Comparator
();
$diffTable
=
clone
$table
;
$diffTable
->
dropIndex
(
'idx_id'
);
$diffTable
->
setPrimaryKey
(
array
(
'id'
));
$this
->
assertEquals
(
array
(
'DROP INDEX idx_id ON alter_table_add_pk'
,
'ALTER TABLE alter_table_add_pk ADD PRIMARY KEY (id)'
),
$this
->
_platform
->
getAlterTableSQL
(
$comparator
->
diffTable
(
$table
,
$diffTable
))
);
}
/**
* @group DBAL-464
*/
...
...
@@ -352,7 +374,7 @@ class MySqlPlatformTest extends AbstractPlatformTestCase
$sql
=
$this
->
_platform
->
getAlterTableSQL
(
$diff
);
$this
->
assertEquals
(
array
(
"DROP INDEX foo_index ON mytable
"
,
"ALTER TABLE mytable DROP PRIMARY KEY
"
,
"ALTER TABLE mytable ADD PRIMARY KEY (foo)"
,
),
$sql
);
}
...
...
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