Skip to content

Commit a8844dd

Browse files
author
Jason Lyle
committed
Add tests for defaults file working relative to script calling liquibase update
1 parent 57d0267 commit a8844dd

File tree

8 files changed

+74
-0
lines changed

8 files changed

+74
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@ "&2/sqlcl-liquibase-default-file-relative-to-script-absolute/script.sql"
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<databaseChangeLog
3+
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xmlns:ora="http://www.oracle.com/xml/ns/dbchangelog-ext"
6+
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.17.xsd"
7+
>
8+
<changeSet
9+
id="something"
10+
author="jlyle"
11+
runOnChange="true"
12+
runAlways="true"
13+
>
14+
<output>Run successfully!</output>
15+
</changeSet>
16+
</databaseChangeLog>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
liquibase.command.contexts=runme
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
-- Make sure the liquibase changelog table exists
2+
liquibase validate -database-changelog-table-name &1._changelog -changelog-file changelog.xml
3+
4+
-- Call to see if functionality works
5+
liquibase update -database-changelog-table-name &1._changelog -changelog-file changelog.xml -defaults-file liquibase.properties
6+
7+
-- See if any changesets were run
8+
declare
9+
c_table_name constant varchar2(255 char) := '&1._changelog';
10+
l_count number;
11+
begin
12+
execute immediate 'select count(1) from ' || c_table_name
13+
into l_count;
14+
15+
if l_count = 0 then
16+
raise_application_error(-20001, 'Liquibase update did not run');
17+
end if;
18+
end;
19+
/
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@ "sqlcl-liquibase-default-file-relative-to-script-relative/script.sql"
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<databaseChangeLog
3+
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xmlns:ora="http://www.oracle.com/xml/ns/dbchangelog-ext"
6+
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.17.xsd"
7+
>
8+
<changeSet
9+
id="something"
10+
author="jlyle"
11+
runOnChange="true"
12+
runAlways="true"
13+
>
14+
<output>Run successfully!</output>
15+
</changeSet>
16+
</databaseChangeLog>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
liquibase.command.contexts=runme
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
-- Make sure the liquibase changelog table exists
2+
liquibase validate -database-changelog-table-name &1._changelog -changelog-file changelog.xml
3+
4+
-- Call to see if functionality works
5+
liquibase update -database-changelog-table-name &1._changelog -changelog-file changelog.xml -defaults-file liquibase.properties
6+
7+
-- See if any changesets were run
8+
declare
9+
c_table_name constant varchar2(255 char) := '&1._changelog';
10+
l_count number;
11+
begin
12+
execute immediate 'select count(1) from ' || c_table_name
13+
into l_count;
14+
15+
if l_count = 0 then
16+
raise_application_error(-20001, 'Liquibase update did not run');
17+
end if;
18+
end;
19+
/

0 commit comments

Comments
 (0)