We are using the databasemigration plugin, our DB ...
# questions
u
We are using the databasemigration plugin, our DB runs in AWS via Aurora MySQL. Our application should access the DB via a read only URL except when we do the migration. I'm setting "grails.plugin.databasemigration.url" to the read write endpoint and "dataSource.url" to the read only endpoint. Now I would like to log the migration connection information like I do for the dataSource
Copy code
private void printDataSourceConfiguration(String stage) {
        <http://log.info|log.info>("Stage: ${stage}")

        try {
            // Unwrap if it's a TransactionAwareDataSourceProxy
            DataSource actualDataSource = dataSource
            actualDataSource = ((TransactionAwareDataSourceProxy) dataSource).getTargetDataSource()
            def connection = actualDataSource.getConnection()
            def metaData = connection.getMetaData()
            <http://log.info|log.info>("     Database URL: ${metaData.getURL()}")
            <http://log.info|log.info>("     Database Product: ${metaData.getDatabaseProductName()} ${metaData.getDatabaseProductVersion()}")
            <http://log.info|log.info>("     Driver: ${metaData.getDriverName()} ${metaData.getDriverVersion()}")
            connection.close()
        } catch (Exception e) {
            log.warn("  -> Could not extract connection metadata: ${e.message}")
        }
    }
what is the object I have to get data from?
u
Replying to myself, as strange as it looks I do so if someone ends in the same situation. I wrote a LiquibaseConfig that gets configuration from closures in application.groovy named migrationDataSource and liquibase and then logs in debug the current configuration.