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
abfc3fb8
Commit
abfc3fb8
authored
Sep 18, 2010
by
Juozas Kaziukenas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed alterTable and dropIndex
parent
ad35640d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
10 deletions
+25
-10
MsSqlPlatform.php
lib/Doctrine/DBAL/Platforms/MsSqlPlatform.php
+25
-10
No files found.
lib/Doctrine/DBAL/Platforms/MsSqlPlatform.php
View file @
abfc3fb8
...
...
@@ -122,14 +122,27 @@ DROP DATABASE ' . $name . ';';
return
'ALTER TABLE '
.
$table
.
' DROP CONSTRAINT '
.
$foreignKey
;
}
/**
* @override
*/
public
function
getDropIndexSQL
(
$index
,
$table
=
null
)
{
if
(
$index
instanceof
\Doctrine\DBAL\Schema\Index
)
{
$index
=
$index
->
getName
();
}
else
if
(
!
is_string
(
$index
))
{
throw
new
\InvalidArgumentException
(
'AbstractPlatform::getDropIndexSQL() expects $index parameter to be string or \Doctrine\DBAL\Schema\Index.'
);
}
if
(
!
isset
(
$table
))
{
return
'DROP INDEX '
.
$index
;
}
else
{
return
'DROP INDEX '
.
$index
.
' ON '
.
$table
;
}
}
/**
* Gets the sql statements for altering an existing table.
*
* The method returns an array of sql statements, since some platforms need several statements.
*
* @param TableDiff $diff
* @return array
* @override
*/
public
function
getAlterTableSQL
(
TableDiff
$diff
)
{
...
...
@@ -143,7 +156,7 @@ DROP DATABASE ' . $name . ';';
}
foreach
(
$diff
->
removedColumns
AS
$column
)
{
$queryParts
[]
=
'DROP '
.
$column
->
getName
();
$queryParts
[]
=
'DROP
COLUMN
'
.
$column
->
getName
();
}
foreach
(
$diff
->
changedColumns
AS
$columnDiff
)
{
...
...
@@ -159,9 +172,11 @@ DROP DATABASE ' . $name . ';';
}
$sql
=
array
();
if
(
count
(
$queryParts
)
>
0
)
{
$sql
[]
=
'ALTER TABLE '
.
$diff
->
name
.
' '
.
implode
(
", "
,
$queryParts
);
}
foreach
(
$queryParts
as
$query
)
{
$sql
[]
=
'ALTER TABLE '
.
$diff
->
name
.
' '
.
$query
;
}
$sql
=
array_merge
(
$sql
,
$this
->
_getAlterTableIndexForeignKeySQL
(
$diff
));
return
$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