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
fc376f7a
Commit
fc376f7a
authored
Jan 24, 2017
by
Marco Pivetta
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'fix/#2611-#2508-pass-through-index-options-when-renaming-indexes' into 2.5
Backport #2611 to 2.5 Backport #2508 to 2.5
parents
8a13144a
2437390c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
2 deletions
+30
-2
Table.php
lib/Doctrine/DBAL/Schema/Table.php
+2
-2
TableTest.php
tests/Doctrine/Tests/DBAL/Schema/TableTest.php
+28
-0
No files found.
lib/Doctrine/DBAL/Schema/Table.php
View file @
fc376f7a
...
@@ -253,10 +253,10 @@ class Table extends AbstractAsset
...
@@ -253,10 +253,10 @@ class Table extends AbstractAsset
unset
(
$this
->
_indexes
[
$oldIndexName
]);
unset
(
$this
->
_indexes
[
$oldIndexName
]);
if
(
$oldIndex
->
isUnique
())
{
if
(
$oldIndex
->
isUnique
())
{
return
$this
->
addUniqueIndex
(
$oldIndex
->
getColumns
(),
$newIndexName
);
return
$this
->
addUniqueIndex
(
$oldIndex
->
getColumns
(),
$newIndexName
,
$oldIndex
->
getOptions
()
);
}
}
return
$this
->
addIndex
(
$oldIndex
->
getColumns
(),
$newIndexName
,
$oldIndex
->
getFlags
());
return
$this
->
addIndex
(
$oldIndex
->
getColumns
(),
$newIndexName
,
$oldIndex
->
getFlags
()
,
$oldIndex
->
getOptions
()
);
}
}
/**
/**
...
...
tests/Doctrine/Tests/DBAL/Schema/TableTest.php
View file @
fc376f7a
...
@@ -741,6 +741,34 @@ class TableTest extends \Doctrine\Tests\DbalTestCase
...
@@ -741,6 +741,34 @@ class TableTest extends \Doctrine\Tests\DbalTestCase
$this
->
assertTrue
(
$table
->
hasIndex
(
'UNIQ_D87F7E0C76FF8CAA78240498'
));
$this
->
assertTrue
(
$table
->
hasIndex
(
'UNIQ_D87F7E0C76FF8CAA78240498'
));
}
}
/**
* @group DBAL-2508
*/
public
function
testKeepsIndexOptionsOnRenamingRegularIndex
()
{
$table
=
new
Table
(
'foo'
);
$table
->
addColumn
(
'id'
,
'integer'
);
$table
->
addIndex
(
array
(
'id'
),
'idx_bar'
,
array
(),
array
(
'where'
=>
'1 = 1'
));
$table
->
renameIndex
(
'idx_bar'
,
'idx_baz'
);
$this
->
assertSame
(
array
(
'where'
=>
'1 = 1'
),
$table
->
getIndex
(
'idx_baz'
)
->
getOptions
());
}
/**
* @group DBAL-2508
*/
public
function
testKeepsIndexOptionsOnRenamingUniqueIndex
()
{
$table
=
new
Table
(
'foo'
);
$table
->
addColumn
(
'id'
,
'integer'
);
$table
->
addUniqueIndex
(
array
(
'id'
),
'idx_bar'
,
array
(
'where'
=>
'1 = 1'
));
$table
->
renameIndex
(
'idx_bar'
,
'idx_baz'
);
$this
->
assertSame
(
array
(
'where'
=>
'1 = 1'
),
$table
->
getIndex
(
'idx_baz'
)
->
getOptions
());
}
/**
/**
* @group DBAL-234
* @group DBAL-234
* @expectedException \Doctrine\DBAL\Schema\SchemaException
* @expectedException \Doctrine\DBAL\Schema\SchemaException
...
...
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