<?xml version="1.0" encoding="UTF-8"?>

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>com.atlassian.jira.plugins</groupId>
        <artifactId>jira-greenhopper-parent-pom</artifactId>
        <version>8.13.0-m0002</version>
    </parent>

    <artifactId>greenhopper-dbprovide</artifactId>
    <packaging>pom</packaging>

    <name>Jira Agile Database provide</name>
    <description>Database provide configuration for Jira Agile</description>

    <properties>
        <datasource.hostname>localhost</datasource.hostname>
        <datasource.username>jirauser2</datasource.username>
        <datasource.password>jirauser2</datasource.password>

        <db.type>postgres</db.type>
        <db.dump />
        <db.dumpLogsOnError>ALL</db.dumpLogsOnError>
        <jiradb.settingsFile>${project.build.directory}/boxdb.properties</jiradb.settingsFile>
        <jiradb.performChildModuleCheck>false</jiradb.performChildModuleCheck>
    </properties>

    <profiles>
        <profile>
            <id>dbprovide</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.atlassian.maven.plugins</groupId>
                        <artifactId>jiradb-maven-plugin</artifactId>
                        <version>${jiradb.version}</version>
                        <executions>
                            <execution>
                                <id>prepare-db</id>
                                <phase>generate-test-resources</phase>
                                <goals>
                                    <goal>start</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>dbstop</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.atlassian.maven.plugins</groupId>
                        <artifactId>jiradb-maven-plugin</artifactId>
                        <version>${jiradb.version}</version>
                        <executions>
                            <execution>
                                <id>clean-db</id>
                                <phase>post-integration-test</phase>
                                <goals>
                                    <goal>stop</goal>
                                    <goal>clean</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>jira-postgres</id>
            <activation>
                <property>
                    <name>tpm.postgres</name>
                </property>
            </activation>
            <properties>
                <db.type>postgres</db.type>
                <db.version>${tpm.postgres}</db.version>
            </properties>
        </profile>

        <profile>
            <id>jira-mysql</id>
            <activation>
                <property>
                    <name>tpm.mysql</name>
                </property>
            </activation>
            <properties>
                <db.type>mysql</db.type>
                <db.version>${tpm.mysql}</db.version>
            </properties>
        </profile>
    </profiles>

</project>
