001package io.ebeaninternal.dbmigration.ddlgeneration.platform;
002
003public class DdlHelp {
004  public static final String TABLESPACE_DEFAULT = "$TABLESPACE_DEFAULT";
005  
006  public static final String DROP_DEFAULT = "DROP DEFAULT";
007
008  public static final String DROP_COMMENT = "DROP COMMENT";
009
010  public static final String DROP_CONSTRAINT = "DROP CONSTRAINT";
011
012  public static final String DROP_FOREIGN_KEY = "DROP FOREIGN KEY";
013
014  /**
015   * Return true if the default value is the special DROP DEFAULT value.
016   */
017  public static boolean isDropDefault(String value) {
018    return DROP_DEFAULT.equals(value);
019  }
020
021  /**
022   * Return true if the default value is the special DROP COMMENT value.
023   */
024  public static boolean isDropComment(String value) {
025    return DROP_COMMENT.equals(value);
026  }
027  
028  /**
029   * Return true if the default value is the special DROP CONSTRAINT value.
030   */
031  public static boolean isDropConstraint(String value) {
032    return DROP_CONSTRAINT.equals(value);
033  }
034
035  /**
036   * Return true if the default value is the special DROP FOREIGN KEY value.
037   */
038  public static boolean isDropForeignKey(String value) {
039    return DROP_FOREIGN_KEY.equals(value);
040  }
041
042  /**
043   * Returns the tablespace. Returns null, if this is the special '$TABLESPACE_DEFAULT' value.
044   */
045  public static String toTablespace(String tablespace) {
046    if (TABLESPACE_DEFAULT.equals(tablespace)) { 
047      return null;
048    } else {
049      return tablespace;
050    }
051  }
052}