[DDC-1232] getAlterTableSQL is not supported by platform SQLite Created: 27/Jun/11  Updated: 01/Feb/13  Resolved: 27/Jun/11

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: Tools
Affects Version/s: 2.0.6
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Christian Schaefer Assignee: Marco Pivetta
Resolution: Invalid Votes: 0
Labels: None
Environment:

macosx, sqlite



 Description   

updating leads to the following error

$ php app/console doctrine:schema:update

[Doctrine\DBAL\DBALException]
Operation 'Doctrine\DBAL\Platforms\AbstractPlatform::getAlterTableSQL' is not supported by platform.



 Comments   
Comment by Benjamin Eberlei [ 27/Jun/11 ]

Which is correct, because ALTER TABLE is not supported by SQLite.

Comment by Christian Schaefer [ 27/Jun/11 ]

so a schema update can not be performed?
if so then there should be a more descriptive error message telling the user not to perform this task on sqlite databases.

Comment by Benjamin Eberlei [ 27/Jun/11 ]

In Sqlite you need to drop-database + create-database to get it working.

Comment by Dan Osipov [ 19/Aug/11 ]

I get the same error while executing migrations:diff. Now, I use SQLite locally, but MySQL on production. Shouldn't migrations:diff create database agnostic migration, that I wouldn't be able to execute locally, but would work on production?

Comment by Yitzchak Schaffer [ 13/Dec/11 ]

+1 for making this abstract enough to handle a standard dev environment: getAlterTableSQL() should create and store an abstraction, and once that's done, either fail on attempted migration of actual SQLite database, or preferably issue warning & require --force or the like to do DROP + CREATE

Comment by Martin HasoĊˆ [ 22/Oct/12 ]

Proposed solution http://www.doctrine-project.org/jira/browse/DBAL-370

Comment by Benjamin Eberlei [ 02/Jan/13 ]

A related Github Pull-Request [GH-242] was opened
https://github.com/doctrine/dbal/pull/242

Comment by Benjamin Eberlei [ 07/Jan/13 ]

A related Github Pull-Request [GH-242] was closed
https://github.com/doctrine/dbal/pull/242

Comment by Galou [ 01/Feb/13 ]

SQLite supports a limited subset of ALTER TABLE. The ALTER TABLE command in SQLite allows the user to rename a table or to add a new column to an existing table. It is not possible to rename a column, remove a column, or add or remove constraints from a table.
http://www.sqlite.org/lang_altertable.html

Generated at Fri Apr 25 04:40:38 UTC 2014 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.