001package io.ebeaninternal.dbmigration.ddlgeneration.platform;
002
003import io.ebean.config.dbplatform.DatabasePlatform;
004
005/**
006 * H2 platform specific DDL.
007 */
008public class H2Ddl extends PlatformDdl {
009
010  private static boolean useV1Syntax = Boolean.getBoolean("ebean.h2.useV1Syntax");
011  
012  public H2Ddl(DatabasePlatform platform) {
013    super(platform);
014    this.historyDdl = new H2HistoryDdl();
015  }
016
017  /**
018   * Modify and return the column definition for autoincrement or identity definition.
019   */
020  @Override
021  public String asIdentityColumn(String columnDefn, DdlIdentity identity) {
022    return asIdentityStandardOptions(columnDefn, identity);
023  }
024
025  @Override
026  protected String convertArrayType(String logicalArrayType) {
027    if (useV1Syntax) {
028      return "array";
029    }
030    int pos = logicalArrayType.indexOf('[');
031    if (pos == -1) {
032      return logicalArrayType;
033    } else {
034      // trim of the fallback varchar length
035      return logicalArrayType.substring(0, pos) + " array";
036    }
037  }
038}