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
33555d36
Commit
33555d36
authored
Oct 20, 2012
by
Martin Hasoň
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added detection of autoincrement column to Sqlite schema
parent
38bd0693
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
5 deletions
+30
-5
SqliteSchemaManager.php
lib/Doctrine/DBAL/Schema/SqliteSchemaManager.php
+25
-0
SqliteSchemaManagerTest.php
.../Tests/DBAL/Functional/Schema/SqliteSchemaManagerTest.php
+5
-5
No files found.
lib/Doctrine/DBAL/Schema/SqliteSchemaManager.php
View file @
33555d36
...
@@ -197,6 +197,31 @@ class SqliteSchemaManager extends AbstractSchemaManager
...
@@ -197,6 +197,31 @@ class SqliteSchemaManager extends AbstractSchemaManager
);
);
}
}
protected
function
_getPortableTableColumnList
(
$table
,
$database
,
$tableColumns
)
{
$list
=
parent
::
_getPortableTableColumnList
(
$table
,
$database
,
$tableColumns
);
$autoincrementColumn
=
null
;
$autoincrementCount
=
0
;
foreach
(
$tableColumns
as
$tableColumn
)
{
if
(
'1'
==
$tableColumn
[
'pk'
])
{
$autoincrementCount
++
;
if
(
null
===
$autoincrementColumn
&&
'integer'
==
strtolower
(
$tableColumn
[
'type'
]))
{
$autoincrementColumn
=
$tableColumn
[
'name'
];
}
}
}
if
(
1
==
$autoincrementCount
&&
null
!==
$autoincrementColumn
)
{
foreach
(
$list
as
$column
)
{
if
(
$autoincrementColumn
==
$column
->
getName
())
{
$column
->
setAutoincrement
(
true
);
}
}
}
return
$list
;
}
protected
function
_getPortableTableColumnDefinition
(
$tableColumn
)
protected
function
_getPortableTableColumnDefinition
(
$tableColumn
)
{
{
$e
=
explode
(
'('
,
$tableColumn
[
'type'
]);
$e
=
explode
(
'('
,
$tableColumn
[
'type'
]);
...
...
tests/Doctrine/Tests/DBAL/Functional/Schema/SqliteSchemaManagerTest.php
View file @
33555d36
...
@@ -38,11 +38,11 @@ class SqliteSchemaManagerTest extends SchemaManagerFunctionalTestCase
...
@@ -38,11 +38,11 @@ class SqliteSchemaManagerTest extends SchemaManagerFunctionalTestCase
$this
->
assertNotContains
(
'oldname'
,
$tables
);
$this
->
assertNotContains
(
'oldname'
,
$tables
);
}
}
public
function
testAutoincrementDetection
()
public
function
createListTableColumns
()
{
{
$this
->
markTestSkipped
(
$table
=
parent
::
createListTableColumns
();
'There is currently no reliable way to determine whether an SQLite column is marked as '
$table
->
getColumn
(
'id'
)
->
setAutoincrement
(
true
);
.
'auto-increment. So, while it does support a single identity column, we cannot with '
.
'certainty determine which it is.'
)
;
return
$table
;
}
}
}
}
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