com.liquibase.ext.sqlgenerator.MongoshGenerator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of liquibase-commercial-mongodb Show documentation
Show all versions of liquibase-commercial-mongodb Show documentation
Liquibase Commercial Extension for MongoDB
The newest version!
package com.liquibase.ext.sqlgenerator;
import com.liquibase.ext.statement.MongoshStatement;
import liquibase.database.Database;
import liquibase.exception.ValidationErrors;
import liquibase.sql.Sql;
import liquibase.sql.UnparsedSql;
import liquibase.sqlgenerator.SqlGeneratorChain;
import liquibase.sqlgenerator.core.AbstractSqlGenerator;
public class MongoshGenerator extends AbstractSqlGenerator {
@Override
public ValidationErrors validate(MongoshStatement mongoshStatement, Database database, SqlGeneratorChain sqlGeneratorChain) {
ValidationErrors validationErrors = new ValidationErrors();
validationErrors.checkRequiredField("mongo", mongoshStatement.getNoSql());
return validationErrors;
}
@Override
public Sql[] generateSql(MongoshStatement mongoshStatement, Database database, SqlGeneratorChain sqlGeneratorChain) {
return new Sql[] {
new UnparsedSql(mongoshStatement.getNoSql(), mongoshStatement.getEndDelimiter())
};
}
}