Class PrimaryKey


  • public class PrimaryKey
    extends Key
    Representation of the primary key of a table. TODO MariaDB apparently allows "ALTER TABLE ADD CONSTRAINT PRIMARY KEY (col1 ASC, col2 DESC)" not that many others do but we don't allow that here, would need to extend ColumnOrderedKey for that, plus update to MySQL Adapter
    • Constructor Detail

      • PrimaryKey

        public PrimaryKey​(Table table)
        Creates a primary key. A default name of the primary key is created by the constructor. This name can be overwritten.
        Parameters:
        table - Table that this is the PK for
    • Method Detail

      • equals

        public boolean equals​(java.lang.Object obj)
        Description copied from class: Key
        Equality operator.
        Overrides:
        equals in class Key
        Parameters:
        obj - Object to compare against
        Returns:
        Whether they are equal.
      • hashCode

        public int hashCode()
        Description copied from class: Key
        Hashcode operator.
        Overrides:
        hashCode in class Key
        Returns:
        The hashcode
      • toString

        public java.lang.String toString()
        Stringifier method. Generates a form of the PK ready to be used in a DDL statement. e.g
        PRIMARY KEY (col1,col2)
        Overrides:
        toString in class java.lang.Object
        Returns:
        The string form of this object. Ready to be used in a DDL statement.