/*
                 * TODO: we generate this query as in ingres db documentation,
                 * but unfortunately ingres don't support it
                 */
@Override
    public MergerToken createSetNotNullToDb(DbEntity entity, DbAttribute column) {
        return new SetNotNullToDb(entity, column) {
            @Override
            public List<String> createSql(DbAdapter adapter) {
                /*
                 * TODO: we generate this query as in ingres db documentation,
                 * but unfortunately ingres don't support it
                 */
                StringBuilder sqlBuffer = new StringBuilder();
                QuotingStrategy context = adapter.getQuotingStrategy();
                sqlBuffer.append("ALTER TABLE ");
                sqlBuffer.append(getEntity().getFullyQualifiedName());
                sqlBuffer.append(" ALTER COLUMN ");
                sqlBuffer.append(context.quotedName(getColumn()));
                sqlBuffer.append(" ");
                sqlBuffer.append(adapter.externalTypesForJdbcType(getColumn().getType())[0]);
                if (adapter.typeSupportsLength(getColumn().getType()) && getColumn().getMaxLength() > 0) {
                    sqlBuffer.append("(");
                    sqlBuffer.append(getColumn().getMaxLength());
                    sqlBuffer.append(")");
                }
                sqlBuffer.append(" NOT NULL");
                return Collections.singletonList(sqlBuffer.toString());
            }
        };
    }
@Override
public List<String> createSql(DbAdapter adapter) {
/*
* TODO: we generate this query as in ingres db documentation,
* but unfortunately ingres don't support it
*/
StringBuilder sqlBuffer = new StringBuilder();
QuotingStrategy context = adapter.getQuotingStrategy();
@Override
public MergerToken createSetNotNullToDb(DbEntity entity, DbAttribute column) {
return new SetNotNullToDb(entity, column) {
@Override
public List<String> createSql(DbAdapter adapter) {
/*
* TODO: we generate this query as in ingres db documentation,
* but unfortunately ingres don't support it
*/
StringBuilder sqlBuffer = new StringBuilder();
QuotingStrategy context = adapter.getQuotingStrategy();
sqlBuffer.append("ALTER TABLE ");
sqlBuffer.append(getEntity().getFullyQualifiedName());
sqlBuffer.append(" ALTER COLUMN ");
sqlBuffer.append(context.quotedName(getColumn()));
sqlBuffer.append(" ");
sqlBuffer.append(adapter.externalTypesForJdbcType(getColumn().getType())[0]);
if (adapter.typeSupportsLength(getColumn().getType()) && getColumn().getMaxLength() > 0) {
sqlBuffer.append("(");
@Override
public MergerToken createSetNotNullToDb(DbEntity entity, DbAttribute column) {
return new SetNotNullToDb(entity, column) {
@Override
public List<String> createSql(DbAdapter adapter) {
/*
* TODO: we generate this query as in ingres db documentation,
* but unfortunately ingres don't support it
*/
StringBuilder sqlBuffer = new StringBuilder();
QuotingStrategy context = adapter.getQuotingStrategy();
sqlBuffer.append("ALTER TABLE ");
sqlBuffer.append(getEntity().getFullyQualifiedName());
sqlBuffer.append(" ALTER COLUMN ");
sqlBuffer.append(context.quotedName(getColumn()));
sqlBuffer.append(" ");
sqlBuffer.append(adapter.externalTypesForJdbcType(getColumn().getType())[0]);
if (adapter.typeSupportsLength(getColumn().getType()) && getColumn().getMaxLength() > 0) {
sqlBuffer.append("(");
sqlBuffer.append(getColumn().getMaxLength());
sqlBuffer.append(")");
}
sqlBuffer.append(" NOT NULL");
return Collections.singletonList(sqlBuffer.toString());
}
};
}