package liquibase.ext;

import liquibase.database.structure.type.BlobType;
import liquibase.database.structure.type.ClobType;
import liquibase.database.typeconversion.core.H2TypeConverter;

/**
 * Revises Liquibase's H2 mappings to use "clob" and "blob" for CLOBs and BLOBs, respectively. This matches
 * Hibernate's {@code H2Dialect} and is required in order for the schema to validate successfully.
 *
 * @since 4.0
 */
@SuppressWarnings("unused")
public class CustomH2TypeConverter extends H2TypeConverter {

    @Override
    public int getPriority() {
        return Priority.PRIORITY_OVERRIDE;
    }

    @Override
    public ClobType getClobType() {
        return new ClobType("CLOB");
    }

    @Override
    public BlobType getBlobType() {
        return new BlobType("BLOB");
    }
}