I can reproduce the problem without upgrading. Attached is a log of me running an empty changelog to create a database, then rerunning the same (empty) changelog to upgrade the database, which fails with the invalid ALTER TABLE syntax.
I hope this can be resolved sometime relatively soon… it’s quite a showstopper for sqlite, and I don’t have a better way of accomplishing what I need (to use sqlite to bootstrap my application, and hold various master configuration options including database credentials for other database servers).
Thanks,
Michael.
Script started on Mon 18 Apr 2011 04:43:35 PM CST
michael@michael:~$ cat core.xml
<databaseChangeLog
xmlns=“http://www.liquibase.org/xml/ns/dbchangelog”
xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance”
xmlns:ext=“http://www.liquibase.org/xml/ns/dbchangelog-ext”
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-2.0.xsd
http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
michael@michael:~$ ls -l test.db
ls: cannot access test.db: No such file or directory
michael@michael:~$ lai/lib/liquibase/liquibase --driver=org.sqlite.JDBC --url=jdbc:sqlite:test.db --changeLogFile=core.xml --logLevel=debug update
Liquibase Home is not set.
Liquibase Home: /home/michael/lai/lib/liquibase
DEBUG 18/04/11 4:43 PM:liquibase: Unable to load/access Apache Derby driver class org.apache.derby.tools.sysinfo to check version: org.apache.derby.tools.sysinfo
DEBUG 18/04/11 4:43 PM:liquibase: Connected to null@jdbc:sqlite:test.db
DEBUG 18/04/11 4:43 PM:liquibase: Create Database Lock Table
DEBUG 18/04/11 4:43 PM:liquibase: Executing EXECUTE database command: CREATE TABLE DATABASECHANGELOGLOCK (ID INTEGER NOT NULL, LOCKED BOOLEAN NOT NULL, LOCKGRANTED TEXT, LOCKEDBY TEXT, CONSTRAINT PK_DATABASECHANGELOGLOCK PRIMARY KEY (ID))
DEBUG 18/04/11 4:43 PM:liquibase: Executing EXECUTE database command: INSERT INTO DATABASECHANGELOGLOCK (ID, LOCKED) VALUES (1, 0)
DEBUG 18/04/11 4:43 PM:liquibase: Created database lock table with name: DATABASECHANGELOGLOCK
DEBUG 18/04/11 4:43 PM:liquibase: Executing QUERY database command: SELECT LOCKED FROM DATABASECHANGELOGLOCK WHERE ID=1
DEBUG 18/04/11 4:43 PM:liquibase: Lock Database
DEBUG 18/04/11 4:43 PM:liquibase: Executing UPDATE database command: UPDATE DATABASECHANGELOGLOCK SET LOCKED = 1, LOCKEDBY = ‘fe80:0:0:0:21f:29ff:fe3a:256f%2 (fe80:0:0:0:21f:29ff:fe3a:256f%2)’, LOCKGRANTED = ‘2011-04-18 16:43:47.396’ WHERE ID = 1 AND LOCKED = 0
INFO 18/04/11 4:43 PM:liquibase: Successfully acquired change log lock
DEBUG 18/04/11 4:43 PM:liquibase: Create Database Change Log Table
INFO 18/04/11 4:43 PM:liquibase: Creating database history table with name: DATABASECHANGELOG
DEBUG 18/04/11 4:43 PM:liquibase: Executing EXECUTE database command: CREATE TABLE DATABASECHANGELOG (ID TEXT NOT NULL, AUTHOR TEXT NOT NULL, FILENAME TEXT NOT NULL, DATEEXECUTED TEXT NOT NULL, ORDEREXECUTED INTEGER NOT NULL, EXECTYPE TEXT NOT NULL, MD5SUM TEXT, DESCRIPTION TEXT, COMMENTS TEXT, TAG TEXT, LIQUIBASE TEXT, CONSTRAINT PK_DATABASECHANGELOG PRIMARY KEY (ID, AUTHOR, FILENAME))
INFO 18/04/11 4:43 PM:liquibase: Reading from DATABASECHANGELOG
DEBUG 18/04/11 4:43 PM:liquibase: Executing QUERY database command: SELECT FILENAME,AUTHOR,ID,MD5SUM,DATEEXECUTED,ORDEREXECUTED,TAG,EXECTYPE FROM DATABASECHANGELOG ORDER BY DATEEXECUTED ASC, ORDEREXECUTED ASC
INFO 18/04/11 4:43 PM:liquibase: Reading from DATABASECHANGELOG
DEBUG 18/04/11 4:43 PM:liquibase: Executing QUERY database command: SELECT FILENAME,AUTHOR,ID,MD5SUM,DATEEXECUTED,ORDEREXECUTED,TAG,EXECTYPE FROM DATABASECHANGELOG ORDER BY DATEEXECUTED ASC, ORDEREXECUTED ASC
DEBUG 18/04/11 4:43 PM:liquibase: Release Database Lock
DEBUG 18/04/11 4:43 PM:liquibase: Executing UPDATE database command: UPDATE DATABASECHANGELOGLOCK SET LOCKED = 0, LOCKEDBY = NULL, LOCKGRANTED = NULL WHERE ID = 1
INFO 18/04/11 4:43 PM:liquibase: Successfully released change log lock
Liquibase Update Successful
michael@michael:~$ ls -l test.db
-rw-r–r-- 1 michael michael 4096 2011-04-18 16:43 test.db
michael@michael:~$ lai/lib/liquibase/liquibase --driver=org.sqlite.JDBC --url=jdbc:sqlite:test.db --changeLogFile=core.xml --logLevel=debug update
Liquibase Home is not set.
Liquibase Home: /home/michael/lai/lib/liquibase
DEBUG 18/04/11 4:43 PM:liquibase: Unable to load/access Apache Derby driver class org.apache.derby.tools.sysinfo to check version: org.apache.derby.tools.sysinfo
DEBUG 18/04/11 4:43 PM:liquibase: Connected to null@jdbc:sqlite:test.db
DEBUG 18/04/11 4:43 PM:liquibase: Executing QUERY database command: SELECT LOCKED FROM DATABASECHANGELOGLOCK WHERE ID=1
DEBUG 18/04/11 4:43 PM:liquibase: Lock Database
DEBUG 18/04/11 4:43 PM:liquibase: Executing UPDATE database command: UPDATE DATABASECHANGELOGLOCK SET LOCKED = 1, LOCKEDBY = ‘fe80:0:0:0:21f:29ff:fe3a:256f%2 (fe80:0:0:0:21f:29ff:fe3a:256f%2)’, LOCKGRANTED = ‘2011-04-18 16:43:53.125’ WHERE ID = 1 AND LOCKED = 0
INFO 18/04/11 4:43 PM:liquibase: Successfully acquired change log lock
DEBUG 18/04/11 4:43 PM:liquibase: Modifying size of databasechangelog.md5sum column
DEBUG 18/04/11 4:43 PM:liquibase: Modifying size of databasechangelog.liquibase column
DEBUG 18/04/11 4:43 PM:liquibase: Executing QUERY database command: SELECT MD5SUM FROM DATABASECHANGELOG WHERE MD5SUM IS NOT NULL
DEBUG 18/04/11 4:43 PM:liquibase: Executing EXECUTE database command: ALTER TABLE DATABASECHANGELOG ALTER COLUMN MD5SUM TYPE TEXT
SEVERE 18/04/11 4:43 PM:liquibase: Error executing SQL ALTER TABLE DATABASECHANGELOG ALTER COLUMN MD5SUM TYPE TEXT
java.sql.SQLException: near “ALTER”: syntax error
… 7 more
michael@michael:~$ exit
Script done on Mon 18 Apr 2011 04:43:55 PM CST