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
5565342b
Commit
5565342b
authored
Oct 14, 2014
by
Steve Müller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix NULL / NOT NULL clause for column alterations in Oracle
parent
7175964c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
3 deletions
+16
-3
OraclePlatform.php
lib/Doctrine/DBAL/Platforms/OraclePlatform.php
+6
-2
OracleSchemaManagerTest.php
.../Tests/DBAL/Functional/Schema/OracleSchemaManagerTest.php
+5
-0
OraclePlatformTest.php
tests/Doctrine/Tests/DBAL/Platforms/OraclePlatformTest.php
+5
-1
No files found.
lib/Doctrine/DBAL/Platforms/OraclePlatform.php
View file @
5565342b
...
...
@@ -685,7 +685,7 @@ LEFT JOIN user_cons_columns r_cols
$columnInfo
=
$column
->
toArray
();
if
(
!
$columnDiff
->
hasChanged
(
'notnull'
))
{
$columnInfo
[
'notnull'
]
=
false
;
unset
(
$columnInfo
[
'notnull'
])
;
}
$fields
[]
=
$column
->
getQuotedName
(
$this
)
.
$this
->
getColumnDeclarationSQL
(
''
,
$columnInfo
);
...
...
@@ -751,7 +751,11 @@ LEFT JOIN user_cons_columns r_cols
}
else
{
$default
=
$this
->
getDefaultValueDeclarationSQL
(
$field
);
$notnull
=
empty
(
$field
[
'notnull'
])
?
' NULL'
:
' NOT NULL'
;
$notnull
=
''
;
if
(
isset
(
$field
[
'notnull'
]))
{
$notnull
=
$field
[
'notnull'
]
?
' NOT NULL'
:
' NULL'
;
}
$unique
=
(
isset
(
$field
[
'unique'
])
&&
$field
[
'unique'
])
?
' '
.
$this
->
getUniqueFieldDeclarationSQL
()
:
''
;
...
...
tests/Doctrine/Tests/DBAL/Functional/Schema/OracleSchemaManagerTest.php
View file @
5565342b
...
...
@@ -61,6 +61,7 @@ class OracleSchemaManagerTest extends SchemaManagerFunctionalTestCase
/**
* @group DBAL-472
* @group DBAL-1001
*/
public
function
testAlterTableColumnNotNull
()
{
...
...
@@ -70,6 +71,7 @@ class OracleSchemaManagerTest extends SchemaManagerFunctionalTestCase
$table
->
addColumn
(
'id'
,
'integer'
);
$table
->
addColumn
(
'foo'
,
'integer'
);
$table
->
addColumn
(
'bar'
,
'string'
);
$table
->
setPrimaryKey
(
array
(
'id'
));
$this
->
_sm
->
dropAndCreateTable
(
$table
);
...
...
@@ -78,9 +80,11 @@ class OracleSchemaManagerTest extends SchemaManagerFunctionalTestCase
$this
->
assertTrue
(
$columns
[
'id'
]
->
getNotnull
());
$this
->
assertTrue
(
$columns
[
'foo'
]
->
getNotnull
());
$this
->
assertTrue
(
$columns
[
'bar'
]
->
getNotnull
());
$diffTable
=
clone
$table
;
$diffTable
->
changeColumn
(
'foo'
,
array
(
'notnull'
=>
false
));
$diffTable
->
changeColumn
(
'bar'
,
array
(
'length'
=>
1024
));
$this
->
_sm
->
alterTable
(
$comparator
->
diffTable
(
$table
,
$diffTable
));
...
...
@@ -88,6 +92,7 @@ class OracleSchemaManagerTest extends SchemaManagerFunctionalTestCase
$this
->
assertTrue
(
$columns
[
'id'
]
->
getNotnull
());
$this
->
assertFalse
(
$columns
[
'foo'
]
->
getNotnull
());
$this
->
assertTrue
(
$columns
[
'bar'
]
->
getNotnull
());
}
public
function
testListDatabases
()
...
...
tests/Doctrine/Tests/DBAL/Platforms/OraclePlatformTest.php
View file @
5565342b
...
...
@@ -310,6 +310,10 @@ class OraclePlatformTest extends AbstractPlatformTestCase
);
}
/**
* @group DBAL-472
* @group DBAL-1001
*/
public
function
testAlterTableNotNULL
()
{
$tableDiff
=
new
\Doctrine\DBAL\Schema\TableDiff
(
'mytable'
);
...
...
@@ -333,7 +337,7 @@ class OraclePlatformTest extends AbstractPlatformTestCase
);
$expectedSql
=
array
(
"ALTER TABLE mytable MODIFY (foo VARCHAR2(255) DEFAULT 'bla'
NULL
, baz VARCHAR2(255) DEFAULT 'bla' NOT NULL, metar VARCHAR2(2000) DEFAULT NULL NULL)"
,
"ALTER TABLE mytable MODIFY (foo VARCHAR2(255) DEFAULT 'bla', baz VARCHAR2(255) DEFAULT 'bla' NOT NULL, metar VARCHAR2(2000) DEFAULT NULL NULL)"
,
);
$this
->
assertEquals
(
$expectedSql
,
$this
->
_platform
->
getAlterTableSQL
(
$tableDiff
));
}
...
...
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