A new topic, 'preconditions failure (<not><tableExists>)', has been made on a
board you are watching.
You can see it at
http://liquibase.org/forum/index.php?topic=93.new#new
The text of the topic is shown below:
hi
i am new to liquibase.
in the process of starting with liquibase, i created a baseline of our legacy
db schema. updates are then made relative to this baseline.
i ran into errors when running the baseline + updates for the first time
against an existing database consisting of just the baseline schema.
the baseline itself failed. this was due to tables already present.
i then updated the baseline to include preConditions, e.g.:
<preConditions>
<not>
<tableExists tableName="alarm" schemaName="public"/>
</not>
</preConditions>
psql also confirms that the table exists:
dt alarm
List of relations
Schema | Name | Type | Owner
--------+-------+-------+------------
public | alarm | table | myUser
(1 row)
when running this new update it failed again:
SEVERE: Preconditions Failed
liquibase.exception.MigrationFailedException: Migration failed for change set
changelogs/r6.10/baseline.xml::1248689548526-1::naude_r (generated):
Reason:
Not precondition failed
:
Caused By: Preconditions Failed
this was unexpected.....but maybe i just do not understand how preConditions
are supposed to work.
i did take a look at the code, both NotPrecondition and TableExistsPrecondition.
if a table exists then TableExistsPrecondition will not raise an exception.
NotPrecondition will then error out because it expects an exception!
i was hoping that the preConditions would follow some form of boolean
evaluation, i.e. not(tableExists) = not(true) = false, thus the createTable
would not execute.
does anyone have any idea on how to overcome the issue?
it may make things easier if all preConditions are evaluated using booleans,
e.g.
public boolean check(Database database, DatabaseChangeLog changeLog) throws
PreconditionFailedException, PreconditionErrorException;
NotPrecondition would then return !precondition.check(database, changeLog); Or
and And would work in similar vain.
regards
roelof.
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.------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Liquibase-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/liquibase-user