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
bc5fe05a
Commit
bc5fe05a
authored
Apr 02, 2015
by
Bill Schaller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test for correct index column ordering on clustered indexes
parent
4da3de55
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
0 deletions
+26
-0
SQLServerSchemaManagerTest.php
...sts/DBAL/Functional/Schema/SQLServerSchemaManagerTest.php
+26
-0
No files found.
tests/Doctrine/Tests/DBAL/Functional/Schema/SQLServerSchemaManagerTest.php
View file @
bc5fe05a
...
...
@@ -329,4 +329,30 @@ class SQLServerSchemaManagerTest extends SchemaManagerFunctionalTestCase
$this
->
assertNull
(
$columns
[
'added_commented_type'
]
->
getComment
());
$this
->
assertEquals
(
'666'
,
$columns
[
'added_commented_type_with_comment'
]
->
getComment
());
}
public
function
testPkOrdering
()
{
// SQL Server stores index column information in a system table with two
// columns that almost always have the same value: index_column_id and key_ordinal.
// The only situation when the two values doesn't match up is when a clustered index
// is declared that references columns in a different order from which they are
// declared in the table. In that case, key_ordinal != index_column_id.
// key_ordinal holds the index ordering. index_column_id is just a unique identifier
// for index columns within the given index.
$table
=
new
Table
(
'sqlsrv_pk_ordering'
);
$table
->
addColumn
(
'colA'
,
'integer'
,
array
(
'notnull'
=>
true
));
$table
->
addColumn
(
'colB'
,
'integer'
,
array
(
'notnull'
=>
true
));
$table
->
setPrimaryKey
([
'colB'
,
'colA'
]);
$this
->
_sm
->
createTable
(
$table
);
$indexes
=
$this
->
_sm
->
listTableIndexes
(
'sqlsrv_pk_ordering'
);
$this
->
assertCount
(
1
,
$indexes
);
$firstIndex
=
current
(
$indexes
);
$columns
=
$firstIndex
->
getColumns
();
$this
->
assertCount
(
2
,
$columns
);
$this
->
assertEquals
(
'colB'
,
$columns
[
0
]);
$this
->
assertEquals
(
'colA'
,
$columns
[
1
]);
}
}
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