-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
30 changed files
with
550 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
...base-integration-tests/src/test/groovy/liquibase/command/core/MssqlIntegrationTest.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package liquibase.command.core | ||
|
||
import liquibase.Scope | ||
import liquibase.command.util.CommandUtil | ||
import liquibase.extension.testing.testsystem.DatabaseTestSystem | ||
import liquibase.extension.testing.testsystem.TestSystemFactory | ||
import liquibase.extension.testing.testsystem.spock.LiquibaseIntegrationTest | ||
import liquibase.util.FileUtil | ||
import static org.junit.Assert.fail | ||
import spock.lang.Shared | ||
import spock.lang.Specification | ||
|
||
@LiquibaseIntegrationTest | ||
class MssqlIntegrationTest extends Specification { | ||
@Shared | ||
private DatabaseTestSystem mssql = (DatabaseTestSystem) Scope.getCurrentScope().getSingleton(TestSystemFactory.class).getTestSystem("mssql") | ||
|
||
def "Should not fail with merge statement"() { | ||
given: | ||
CommandUtil.runDropAll(mssql) | ||
when: | ||
CommandUtil.runUpdate(mssql,'src/test/resources/changelogs/mssql/issues/merge.statement.changelog.sql') | ||
then: | ||
noExceptionThrown() | ||
cleanup: | ||
CommandUtil.runDropAll(mssql) | ||
} | ||
|
||
def "verify store procedure does not get default endDelimiter added when a given delimiter is specified"() { | ||
given: | ||
CommandUtil.runUpdate(mssql,'src/test/resources/changelogs/mssql/issues/create.procedure.changelog.sql') | ||
|
||
def sProcedureName = "TestProcedure" | ||
def getStoreProcedureContentQuery = String.format(""" | ||
SELECT ISNULL(smsp.definition, ssmsp.definition) AS [SPBody] | ||
FROM sys.all_objects AS sp LEFT OUTER JOIN sys.sql_modules AS smsp ON smsp.object_id = sp.object_id | ||
LEFT OUTER JOIN sys.system_sql_modules AS ssmsp ON ssmsp.object_id = sp.object_id | ||
WHERE (sp.type = N'P' OR sp.type = N'RF' OR sp.type='PC')and(sp.name=N'%s' and SCHEMA_NAME(sp.schema_id)=N'dbo') | ||
""", sProcedureName) | ||
|
||
when: | ||
def resultSet = mssql.getConnection().prepareStatement(getStoreProcedureContentQuery).executeQuery() | ||
|
||
then: | ||
def changelogContent = FileUtil.getContents(new File('src/test/resources/changelogs/mssql/issues/create.procedure.changelog.sql')) | ||
if(resultSet.next()) { | ||
def deployedSPContent = resultSet.getString("SPBody") | ||
changelogContent.contains(deployedSPContent.split(String.format("procedure dbo.%s", sProcedureName))[1]) | ||
} else { | ||
fail(String.format("There is not procedure stored in the DB with name %s", sProcedureName)) | ||
} | ||
} | ||
|
||
def "Should not fail with execution of create procedures with begin-end blocks"() { | ||
when: | ||
CommandUtil.runUpdate(mssql,'src/test/resources/changelogs/mssql/issues/begin.examples.changelog.xml') | ||
then: | ||
noExceptionThrown() | ||
} | ||
} |
26 changes: 0 additions & 26 deletions
26
...integration-tests/src/test/groovy/liquibase/command/core/MssqlMergeIntegrationTest.groovy
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
...ibase-integration-tests/src/test/resources/changelogs/common/depthboundincludeall/a/a.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<databaseChangeLog | ||
xmlns="http://www.liquibase.org/xml/ns/dbchangelog" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd" | ||
> | ||
<changeSet | ||
id="invalid_a" | ||
author="jlyle" | ||
> | ||
<output>Changeset A</output> | ||
<sql>select foo from dual</sql> | ||
</changeSet> | ||
</databaseChangeLog> |
14 changes: 14 additions & 0 deletions
14
...ase-integration-tests/src/test/resources/changelogs/common/depthboundincludeall/a/b/b.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<databaseChangeLog | ||
xmlns="http://www.liquibase.org/xml/ns/dbchangelog" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd" | ||
> | ||
<changeSet | ||
id="invalid_b" | ||
author="jlyle" | ||
> | ||
<output>Changeset B</output> | ||
<sql>select foo from dual</sql> | ||
</changeSet> | ||
</databaseChangeLog> |
14 changes: 14 additions & 0 deletions
14
...e-integration-tests/src/test/resources/changelogs/common/depthboundincludeall/a/b/c/c.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<databaseChangeLog | ||
xmlns="http://www.liquibase.org/xml/ns/dbchangelog" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd" | ||
> | ||
<changeSet | ||
id="invalid_c" | ||
author="jlyle" | ||
> | ||
<output>Changeset C</output> | ||
<sql>select foo from dual</sql> | ||
</changeSet> | ||
</databaseChangeLog> |
14 changes: 14 additions & 0 deletions
14
...integration-tests/src/test/resources/changelogs/common/depthboundincludeall/a/b/c/d/d.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<databaseChangeLog | ||
xmlns="http://www.liquibase.org/xml/ns/dbchangelog" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd" | ||
> | ||
<changeSet | ||
id="invalid_d" | ||
author="jlyle" | ||
> | ||
<output>Changeset D</output> | ||
<sql>select foo from dual</sql> | ||
</changeSet> | ||
</databaseChangeLog> |
13 changes: 13 additions & 0 deletions
13
...tegration-tests/src/test/resources/changelogs/common/depthboundincludeall/a/b/c/d/e/e.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<databaseChangeLog | ||
xmlns="http://www.liquibase.org/xml/ns/dbchangelog" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd" | ||
> | ||
<changeSet | ||
id="valid_e" | ||
author="jlyle" | ||
> | ||
<output>Changeset E</output> | ||
</changeSet> | ||
</databaseChangeLog> |
13 changes: 13 additions & 0 deletions
13
...gration-tests/src/test/resources/changelogs/common/depthboundincludeall/a/b/c/d/e/f/f.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<databaseChangeLog | ||
xmlns="http://www.liquibase.org/xml/ns/dbchangelog" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd" | ||
> | ||
<changeSet | ||
id="valid_f" | ||
author="jlyle" | ||
> | ||
<output>Changeset F</output> | ||
</changeSet> | ||
</databaseChangeLog> |
14 changes: 14 additions & 0 deletions
14
...ation-tests/src/test/resources/changelogs/common/depthboundincludeall/a/b/c/d/e/f/g/g.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<databaseChangeLog | ||
xmlns="http://www.liquibase.org/xml/ns/dbchangelog" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd" | ||
> | ||
<changeSet | ||
id="invalid_g" | ||
author="jlyle" | ||
> | ||
<output>Changeset G</output> | ||
<sql>select foo from dual</sql> | ||
</changeSet> | ||
</databaseChangeLog> |
17 changes: 17 additions & 0 deletions
17
...integration-tests/src/test/resources/changelogs/common/depthboundincludeall/changelog.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<databaseChangeLog | ||
xmlns="http://www.liquibase.org/xml/ns/dbchangelog" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd" | ||
> | ||
<changeSet | ||
id="root_include" | ||
author="jlyle" | ||
> | ||
<output>Root</output> | ||
</changeSet> | ||
|
||
<!-- <include relativeToChangelogFile="true" file="a/b/c/d/e/e.xml" /> | ||
<include relativeToChangelogFile="true" file="a/b/c/d/e/f/f.xml" /> --> | ||
<includeAll relativeToChangelogFile="true" path="a/b/c" minDepth="3" maxDepth="4" /> | ||
</databaseChangeLog> |
21 changes: 21 additions & 0 deletions
21
...integration-tests/src/test/resources/changelogs/mssql/issues/begin.examples.changelog.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<databaseChangeLog | ||
xmlns="http://www.liquibase.org/xml/ns/dbchangelog" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd"> | ||
<changeSet id="1" author="mallod"> | ||
<sqlFile endDelimiter="\nGO" encoding="cp1250" path="src/test/resources/changelogs/mssql/issues/create.procedure.examples.with.begin.end.block.sql" splitStatements="true"/> | ||
</changeSet> | ||
|
||
<changeSet id="2" author="mallod"> | ||
<sql> | ||
CREATE TABLE TestCommitTable(id int, name varchar(255)); | ||
|
||
BEGIN TRANSACTION; | ||
DELETE FROM TestCommitTable | ||
COMMIT; | ||
</sql> | ||
</changeSet> | ||
|
||
</databaseChangeLog> |
11 changes: 11 additions & 0 deletions
11
...tegration-tests/src/test/resources/changelogs/mssql/issues/create.procedure.changelog.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
-- liquibase formatted sql | ||
--changeset mallod:endDelimiterTest runOnChange:true stripComments:false splitStatements:true endDelimiter:;;;;; | ||
create or alter procedure dbo.TestProcedure | ||
as | ||
select top 5 * | ||
from | ||
dbo.CustomerMaster | ||
where | ||
TerritoryID = 2 | ||
and IsActive = 1 | ||
;;;;; |
45 changes: 45 additions & 0 deletions
45
...test/resources/changelogs/mssql/issues/create.procedure.examples.with.begin.end.block.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
CREATE PROCEDURE dbo.A | ||
AS | ||
BEGIN | ||
SET NOCOUNT ON; | ||
|
||
DECLARE @handle UNIQUEIDENTIFIER; | ||
|
||
BEGIN DIALOG @handle | ||
FROM SERVICE [//aa/BB/Service] | ||
TO SERVICE '//aa/BB/Service' | ||
ON CONTRACT [//aa/BB/Contract] | ||
WITH ENCRYPTION = OFF; | ||
|
||
SEND ON CONVERSATION @handle MESSAGE TYPE [//aa/BB/Type]; | ||
|
||
END; | ||
GO | ||
CREATE PROCEDURE dbo.B | ||
AS | ||
BEGIN | ||
SET NOCOUNT ON; | ||
|
||
DECLARE @queue TABLE (message_type_name VARCHAR(256)); | ||
|
||
WAITFOR ( | ||
RECEIVE message_type_name FROM dbo.que_bindata | ||
INTO @queue | ||
); | ||
|
||
DELETE | ||
FROM dbo.data_tmp | ||
WHERE start_date< DATEADD(DAY, - 1, GETDATE()); | ||
END; | ||
GO | ||
CREATE PROCEDURE dbo.C | ||
AS | ||
BEGIN | ||
SET NOCOUNT ON; | ||
|
||
BEGIN DISTRIBUTED TRANSACTION; | ||
-- Delete candidate from local instance. | ||
DELETE dbo.HumanResources.JobCandidate | ||
COMMIT TRANSACTION; | ||
END; | ||
GO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.