You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@snicoll Hello! I believe the fix in #7473 this may have caused a regression when it comes to schema.sql files and liquibase functionality.
I have a project which has it's own schema defined in a liquibase changeset, and a foreign schema stubbed out in a schema.sql file. There is a cross-schema foreign key constraint on one of the liquibase columns. In order to to write integration tests in the dependent application, I use a schema.sql file to create the stub foreign schema and table.
When booting the application, I can see that the schema.sql file successfully executes, and then the liquibase migration fires off, but fails because it cannot find the foreign schema defined in schema.sql.
When the liquibase plugin begins to perform the migration, it can't see the foodatabase schema and throws an exception:
2017-01-04 15:35:51.207 INFO [my-user-queue,,,] 25204 --- [ main] o.s.j.d.e.EmbeddedDatabaseFactory : Starting embedded database: url='jdbc:h2:mem:33fc0ec2-b352-47d0-a994-495b1648982b;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=false', username='sa'
2017-01-04 15:35:51.288 INFO [my-user-queue,,,] 25204 --- [ main] o.s.jdbc.datasource.init.ScriptUtils : Executing SQL script from URL [file:/my/path/my-user-queue/target/test-classes/schema.sql]
2017-01-04 15:35:51.290 INFO [my-user-queue,,,] 25204 --- [ main] o.s.jdbc.datasource.init.ScriptUtils : Executed SQL script from URL [file:/my/path/my-user-queue/target/test-classes/schema.sql] in 2 ms.
2017-01-04 15:35:51.510 INFO [my-user-queue,,,] 25204 --- [ main] liquibase : /db/changelog/changesets.xml::1::jerome.doby: Successfully acquired change log lock
2017-01-04 15:35:51.510 INFO [my-user-queue,,,] 25204 --- [ main] liquibase : /db/changelog/changesets.xml::1::jerome.doby: Dropping Database Objects in schema: TESTDB.PUBLIC
2017-01-04 15:35:51.545 INFO [my-user-queue,,,] 25204 --- [ main] liquibase : /db/changelog/changesets.xml::1::jerome.doby: Successfully released change log lock
2017-01-04 15:35:51.552 INFO [my-user-queue,,,] 25204 --- [ main] liquibase : /db/changelog/changesets.xml::1::jerome.doby: Successfully acquired change log lock
2017-01-04 15:35:51.592 INFO [my-user-queue,,,] 25204 --- [ main] liquibase : /db/changelog/changesets.xml::1::jerome.doby: Creating database history table with name: PUBLIC.DATABASECHANGELOG
2017-01-04 15:35:51.595 INFO [my-user-queue,,,] 25204 --- [ main] liquibase : /db/changelog/changesets.xml::1::jerome.doby: Reading from PUBLIC.DATABASECHANGELOG
2017-01-04 15:35:51.599 ERROR [my-user-queue,,,] 25204 --- [ main] liquibase : classpath:/db/changelog/master.xml: /db/changelog/changesets.xml::1::jerome.doby: Change Set /db/changelog/changesets.xml::1::jerome.doby failed. Error: org.h2.jdbc.JdbcSQLException: Schema "FOODATABASE" not found; SQL statement:
CREATE TABLE PUBLIC.user_queues (id INT AUTO_INCREMENT NOT NULL, meta__version INT DEFAULT 1, meta__created_at TIMESTAMP, meta__last_updated_at TIMESTAMP, meta__trace_id VARCHAR(36), meta__span_id VARCHAR(36), user_id INT, queue_time INT, queue_status VARCHAR(255), CONSTRAINT PK_USER_QUEUES PRIMARY KEY (id), CONSTRAINT FK_user_queues_user_id FOREIGN KEY (user_id) REFERENCES foodatabase.users(id), CONSTRAINT UNQ_user_queues_user_id UNIQUE (user_id)) [90079-193]
I seem to be able to work-around this new issue by using the replace = AutoConfigureTestDatabase.Replace.NONE attribute in my @AutoConfigureTestDatabase, but this is not ideal since I have several classes in my test suite, and want to ensure they start with a clean slate every time.
The text was updated successfully, but these errors were encountered:
@XaeroDegreaz I don't think (yet) it's broken. #7473 is legit but I expected side effects for sure.
Can you please remove the liquibase settings for the url? You're basically asking liquibase to run on that database while we replace it with something else. The auto-config will automatically find the datasource for you, no need for that stuff.
If that does not work, rather than pasting some code in a comment, can you please share a project that I can run?
Seems that it was working before, but only because of a bug?
Yes and no. Previously we were "replacing" the database with the same settings as the default datasource you get with auto-configuration. This is obviously wrong since in case you let the auto-configuration kicks in, we were not replacing anything. Also, your url is exactly what we do by default. If you replace testdb with foo it would have been broken as well.
@snicoll Hello! I believe the fix in #7473 this may have caused a regression when it comes to
schema.sql
files andliquibase
functionality.I have a project which has it's own schema defined in a
liquibase
changeset, and a foreign schema stubbed out in aschema.sql
file. There is a cross-schema foreign key constraint on one of theliquibase
columns. In order to to write integration tests in the dependent application, I use aschema.sql
file to create the stub foreign schema and table.When booting the application, I can see that the
schema.sql
file successfully executes, and then theliquibase
migration fires off, but fails because it cannot find the foreign schema defined inschema.sql
.This works great in 1.4.2
application.yml
schema.sql
changeset.xml
Test class setup
When the
liquibase
plugin begins to perform the migration, it can't see thefoodatabase
schema and throws an exception:I seem to be able to work-around this new issue by using the
replace = AutoConfigureTestDatabase.Replace.NONE
attribute in my@AutoConfigureTestDatabase
, but this is not ideal since I have several classes in my test suite, and want to ensure they start with a clean slate every time.The text was updated successfully, but these errors were encountered: