Liquibase should add create table commands for the databasechangelog and
databasechangeloglock tables in your script if they don't exist.  We
have made some changes around how we output the updateSQL text, however,
and it may have gotten lost, or it may be fixed in a later version.
Which version of liquibase are you running?

 

The liquibase tables are very straightforward and I would say just add
the create table statements to the beginning of the script manually
until we figure out why they aren't being put in there.

 

You're actual sql will depend on your database, but the java code that
is generating the columns looks like this:

return new CreateTableStatement("databasechangelog)

                .addPrimaryKeyColumn("ID", "VARCHAR(63)", null, null,
new NotNullConstraint())

                .addPrimaryKeyColumn("AUTHOR", "VARCHAR(63)", null,
null, new NotNullConstraint())

                .addPrimaryKeyColumn("FILENAME", "VARCHAR(200)", null,
null, new NotNullConstraint())

                .addColumn("DATEEXECUTED", getDateTimeType(), new
NotNullConstraint())

                .addColumn("MD5SUM", "VARCHAR(32)")

                .addColumn("DESCRIPTION", "VARCHAR(255)")

                .addColumn("COMMENTS", "VARCHAR(255)")

                .addColumn("TAG", "VARCHAR(255)")

                .addColumn("LIQUIBASE", "VARCHAR(10)");

 

And

 

  return new CreateTableStatement("databasechangeloglock")

                .addPrimaryKeyColumn("ID", "INT", null, null, new
NotNullConstraint())

                .addColumn("LOCKED", getBooleanType(), new
NotNullConstraint())

                .addColumn("LOCKGRANTED", getDateTimeType())

                .addColumn("LOCKEDBY", "VARCHAR(255)");

 

You should be able to figure out the exact sql from that even if you
don't know java.

 

Nathan

 

From: Sven Haiges [mailto:hansam...@yahoo.de] 
Sent: Friday, April 03, 2009 5:12 PM
To: liquibase-user@lists.sourceforge.net
Subject: [Liquibase-user] SQL for liquibase tables

 

Hi, 

I am brand new to liquibase and like what I exerienced so far. We would
like to use liquibase for an existing project and the way we choose to
migrate to using liquibase is have liquibase generate the SQL for us
(updateSQL command).

This works fine, but here is one little thing we don't understand:

- the generated SQL does not contain a CREATE TABLE for the liquibase
tables themselves. The insert for the changeset would fail as that table
does not yet exist.

I understand that the update command would create the table, but then we
would have to run liquibase update at least once. All we want to do at
this point is get the SQL from liquibase and then run everything
manually from there. 

One way I would solve it could be to create an empty changeset or so...
but it is a hack. What is the officical way?

Cheers
Sven

-- 
Sven Haiges
sven.hai...@googlemail.com

Yahoo Messenger / Skype: hansamann
Personal Homepage, Wiki & Blog: http://www.svenhaiges.de

Subscribe to the Grails Podcast:
http://feeds.grailspodcast.com/grailspodcast
http://www.grailspodcast.com

------------------------------------------------------------------------------
_______________________________________________
Liquibase-user mailing list
Liquibase-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/liquibase-user

Reply via email to