A new topic, 'updateSQL on a fresh database', has been made on a board you are 
watching.

You can see it at
http://liquibase.org/forum/index.php?topic=716.new#new

The text of the topic is shown below:

I have an issue when using liquibase:updateSQL goal in maven.
I have a fresh database and this is the first time liquibase accesses the 
database.

When using mvn install liquibase creates the two tables DATABASECHANGELOG and 
DATABASECHANGELOGLOCK into the database,
and it also adds the creation of these tables to the migration script that is 
generated alongwith other changes that need to be applied to the database.

Code:

-- Create Database Lock Table
CREATE TABLE `my_db`.`DATABASECHANGELOGLOCK` (`ID` INT NOT NULL, `LOCKED` 
TINYINT(1) NOT NULL, `LOCKGRANTED` DATETIME, `LOCKEDBY` VARCHAR(255), 
CONSTRAINT `PK_DATABASECHANGELOGLOCK` PRIMARY KEY (`ID`));

INSERT INTO `my_db`.`DATABASECHANGELOGLOCK` (`ID`, `LOCKED`) VALUES (1, 0);

SELECT LOCKED FROM `my_db`.`DATABASECHANGELOGLOCK` WHERE `ID`=1;

-- Lock Database
UPDATE `my_db`.`DATABASECHANGELOGLOCK` SET `LOCKEDBY` = 'SRI (192.168.1.110)', 
`LOCKGRANTED` = '2010-10-01 11:50:14.140', `LOCKED` = 1 WHERE ID  = 1;

-- Create Database Change Log Table
CREATE TABLE `my_db`.`DATABASECHANGELOG` (`ID` VARCHAR(63) NOT NULL, `AUTHOR` 
VARCHAR(63) NOT NULL, `FILENAME` VARCHAR(200) NOT NULL, `DATEEXECUTED` DATETIME 
NOT NULL, `MD5SUM` VARCHAR(32), `DESCRIPTION` VARCHAR(255), `COMMENTS` 
VARCHAR(255), `TAG` VARCHAR(255), `LIQUIBASE` VARCHAR(10), CONSTRAINT 
`PK_DATABASECHANGELOG` PRIMARY KEY (`ID`, `AUTHOR`, `FILENAME`));


Obviously either 1 of the two should happen.
Thus when I use the migration script IT WILL throw an error as the two tables 
DATABASECHANGELOG and DATABASECHANGELOGLOCK already exist.

I know I can manually remove the above sql from the migration.sql file that has 
been generated. But I don't want to do that inorder to keep the build automated.

Maybe I have missed something. Any help or solution would be greatly 
appreciated.

Unsubscribe to new topics from this board by clicking here: 
http://liquibase.org/forum/index.php?action=notifyboard;board=1.0

Regards,
The Liquibase Community Forum Team.
------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Liquibase-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/liquibase-user

Reply via email to