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
02fa06ce
Commit
02fa06ce
authored
Dec 21, 2013
by
Benjamin Eberlei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[DBAL-555] Fix Sqlite and SQLAnywhere Platforms, document TableDiff changes.
parent
2815335e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
12 deletions
+20
-12
SQLAnywherePlatform.php
lib/Doctrine/DBAL/Platforms/SQLAnywherePlatform.php
+11
-10
SqlitePlatform.php
lib/Doctrine/DBAL/Platforms/SqlitePlatform.php
+3
-2
TableDiff.php
lib/Doctrine/DBAL/Schema/TableDiff.php
+6
-0
No files found.
lib/Doctrine/DBAL/Platforms/SQLAnywherePlatform.php
View file @
02fa06ce
...
@@ -28,6 +28,7 @@ use Doctrine\DBAL\Schema\ColumnDiff;
...
@@ -28,6 +28,7 @@ use Doctrine\DBAL\Schema\ColumnDiff;
use
Doctrine\DBAL\Schema\Constraint
;
use
Doctrine\DBAL\Schema\Constraint
;
use
Doctrine\DBAL\Schema\ForeignKeyConstraint
;
use
Doctrine\DBAL\Schema\ForeignKeyConstraint
;
use
Doctrine\DBAL\Schema\Index
;
use
Doctrine\DBAL\Schema\Index
;
use
Doctrine\DBAL\Schema\Identifier
;
use
Doctrine\DBAL\Schema\Table
;
use
Doctrine\DBAL\Schema\Table
;
use
Doctrine\DBAL\Schema\TableDiff
;
use
Doctrine\DBAL\Schema\TableDiff
;
...
@@ -189,18 +190,18 @@ class SQLAnywherePlatform extends AbstractPlatform
...
@@ -189,18 +190,18 @@ class SQLAnywherePlatform extends AbstractPlatform
continue
;
continue
;
}
}
$sql
[]
=
$this
->
getAlterTableClause
(
$diff
->
name
)
.
' '
.
$sql
[]
=
$this
->
getAlterTableClause
(
$diff
->
getName
()
)
.
' '
.
$this
->
getAlterTableRenameColumnClause
(
$oldColumnName
,
$column
);
$this
->
getAlterTableRenameColumnClause
(
$oldColumnName
,
$column
);
}
}
if
(
!
$this
->
onSchemaAlterTable
(
$diff
,
$tableSql
))
{
if
(
!
$this
->
onSchemaAlterTable
(
$diff
,
$tableSql
))
{
if
(
!
empty
(
$alterClauses
))
{
if
(
!
empty
(
$alterClauses
))
{
$sql
[]
=
$this
->
getAlterTableClause
(
$diff
->
name
)
.
' '
.
implode
(
", "
,
$alterClauses
);
$sql
[]
=
$this
->
getAlterTableClause
(
$diff
->
getName
()
)
.
' '
.
implode
(
", "
,
$alterClauses
);
}
}
if
(
$diff
->
newName
!==
false
)
{
if
(
$diff
->
newName
!==
false
)
{
$sql
[]
=
$this
->
getAlterTableClause
(
$diff
->
name
)
.
' '
.
$sql
[]
=
$this
->
getAlterTableClause
(
$diff
->
getName
()
)
.
' '
.
$this
->
getAlterTableRenameTableClause
(
$diff
->
newName
);
$this
->
getAlterTableRenameTableClause
(
$diff
->
getNewName
()
);
}
}
$sql
=
array_merge
(
$sql
,
$this
->
_getAlterTableIndexForeignKeySQL
(
$diff
),
$commentsSQL
);
$sql
=
array_merge
(
$sql
,
$this
->
_getAlterTableIndexForeignKeySQL
(
$diff
),
$commentsSQL
);
...
@@ -224,13 +225,13 @@ class SQLAnywherePlatform extends AbstractPlatform
...
@@ -224,13 +225,13 @@ class SQLAnywherePlatform extends AbstractPlatform
/**
/**
* Returns the SQL clause for altering a table.
* Returns the SQL clause for altering a table.
*
*
* @param
string
$tableName The quoted name of the table to alter.
* @param
Identifier
$tableName The quoted name of the table to alter.
*
*
* @return string
* @return string
*/
*/
protected
function
getAlterTableClause
(
$tableName
)
protected
function
getAlterTableClause
(
Identifier
$tableName
)
{
{
return
'ALTER TABLE '
.
$tableName
;
return
'ALTER TABLE '
.
$tableName
->
getQuotedName
(
$this
)
;
}
}
/**
/**
...
@@ -261,13 +262,13 @@ class SQLAnywherePlatform extends AbstractPlatform
...
@@ -261,13 +262,13 @@ class SQLAnywherePlatform extends AbstractPlatform
/**
/**
* Returns the SQL clause for renaming a table in a table alteration.
* Returns the SQL clause for renaming a table in a table alteration.
*
*
* @param
string
$newTableName The quoted name of the table to rename to.
* @param
Identifier
$newTableName The quoted name of the table to rename to.
*
*
* @return string
* @return string
*/
*/
protected
function
getAlterTableRenameTableClause
(
$newTableName
)
protected
function
getAlterTableRenameTableClause
(
Identifier
$newTableName
)
{
{
return
'RENAME '
.
$newTableName
;
return
'RENAME '
.
$newTableName
->
getQuotedName
(
$this
)
;
}
}
/**
/**
...
...
lib/Doctrine/DBAL/Platforms/SqlitePlatform.php
View file @
02fa06ce
...
@@ -24,6 +24,7 @@ use Doctrine\DBAL\Schema\TableDiff;
...
@@ -24,6 +24,7 @@ use Doctrine\DBAL\Schema\TableDiff;
use
Doctrine\DBAL\Schema\Table
;
use
Doctrine\DBAL\Schema\Table
;
use
Doctrine\DBAL\Schema\ForeignKeyConstraint
;
use
Doctrine\DBAL\Schema\ForeignKeyConstraint
;
use
Doctrine\DBAL\Schema\Index
;
use
Doctrine\DBAL\Schema\Index
;
use
Doctrine\DBAL\Schema\Identifier
;
use
Doctrine\DBAL\Schema\Constraint
;
use
Doctrine\DBAL\Schema\Constraint
;
/**
/**
...
@@ -804,7 +805,7 @@ class SqlitePlatform extends AbstractPlatform
...
@@ -804,7 +805,7 @@ class SqlitePlatform extends AbstractPlatform
$sql
[]
=
$this
->
getDropTableSQL
(
$dataTable
);
$sql
[]
=
$this
->
getDropTableSQL
(
$dataTable
);
if
(
$diff
->
newName
&&
$diff
->
newName
!=
$diff
->
name
)
{
if
(
$diff
->
newName
&&
$diff
->
newName
!=
$diff
->
name
)
{
$renamedTable
=
new
Table
(
$diff
->
newName
);
$renamedTable
=
new
Identifier
(
$diff
->
newName
);
$sql
[]
=
'ALTER TABLE '
.
$newTable
->
getQuotedName
(
$this
)
.
' RENAME TO '
.
$renamedTable
->
getQuotedName
(
$this
);
$sql
[]
=
'ALTER TABLE '
.
$newTable
->
getQuotedName
(
$this
)
.
' RENAME TO '
.
$renamedTable
->
getQuotedName
(
$this
);
}
}
...
@@ -859,7 +860,7 @@ class SqlitePlatform extends AbstractPlatform
...
@@ -859,7 +860,7 @@ class SqlitePlatform extends AbstractPlatform
if
(
!
$this
->
onSchemaAlterTable
(
$diff
,
$tableSql
))
{
if
(
!
$this
->
onSchemaAlterTable
(
$diff
,
$tableSql
))
{
if
(
$diff
->
newName
!==
false
)
{
if
(
$diff
->
newName
!==
false
)
{
$newTable
=
new
Table
(
$diff
->
newName
);
$newTable
=
new
Identifier
(
$diff
->
newName
);
$sql
[]
=
'ALTER TABLE '
.
$table
->
getQuotedName
(
$this
)
.
' RENAME TO '
.
$newTable
->
getQuotedName
(
$this
);
$sql
[]
=
'ALTER TABLE '
.
$table
->
getQuotedName
(
$this
)
.
' RENAME TO '
.
$newTable
->
getQuotedName
(
$this
);
}
}
}
}
...
...
lib/Doctrine/DBAL/Schema/TableDiff.php
View file @
02fa06ce
...
@@ -139,11 +139,17 @@ class TableDiff
...
@@ -139,11 +139,17 @@ class TableDiff
$this
->
fromTable
=
$fromTable
;
$this
->
fromTable
=
$fromTable
;
}
}
/**
* @return \Doctrine\DBAL\Schema\Identifier
*/
public
function
getName
()
public
function
getName
()
{
{
return
new
Identifier
(
$this
->
name
);
return
new
Identifier
(
$this
->
name
);
}
}
/**
* @return \Doctrine\DBAL\Schema\Identifier
*/
public
function
getNewName
()
public
function
getNewName
()
{
{
return
new
Identifier
(
$this
->
newName
);
return
new
Identifier
(
$this
->
newName
);
...
...
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