Class TableImpl

    • Field Detail

      • dialect

        protected final Dialect dialect
      • key

        protected final String key
      • name

        protected final String name
    • Constructor Detail

      • TableImpl

        public TableImpl​(Dialect dialect,
                         String name,
                         String key)
        Creates a new empty table.
    • Method Detail

      • isAlias

        public boolean isAlias()
        Specified by:
        isAlias in interface Table
      • addColumn

        public Column addColumn​(String name,
                                Column column)
        Adds a column without dialect physical name canonicalization (for directories).
      • addIndex

        public void addIndex​(String... columnNames)
        Adds an index on one or several columns.
        Specified by:
        addIndex in interface Table
        Parameters:
        columnNames - the column names
      • addIndex

        public void addIndex​(String indexName,
                             Table.IndexType indexType,
                             String... columnNames)
        Description copied from interface: Table
        Adds an index of the given name and type on one or several columns.
        Specified by:
        addIndex in interface Table
        Parameters:
        indexName - the index name
        indexType - the index type
        columnNames - the column names
      • hasFulltextIndex

        public boolean hasFulltextIndex()
        Description copied from interface: Table
        Checks if the table has some fulltext indexes.
        Specified by:
        hasFulltextIndex in interface Table
        Returns:
        true if the table has some fulltext indexes
      • getCreateSql

        public String getCreateSql()
        Computes the SQL statement to create the table.
        Specified by:
        getCreateSql in interface Table
        Returns:
        the SQL create string.
      • getAddColumnSql

        public String getAddColumnSql​(Column column)
        Computes the SQL statement to alter a table and add a column to it.
        Specified by:
        getAddColumnSql in interface Table
        Parameters:
        column - the column to add
        Returns:
        the SQL alter table string
      • addOneColumn

        protected void addOneColumn​(StringBuilder sb,
                                    Column column)
        Adds to buf the column name and its type and constraints for create / alter.
      • getPostCreateSqls

        public List<String> getPostCreateSqls​(Model model)
        Description copied from interface: Table
        Computes the SQL statements to finish creating the table, usually some ALTER TABLE statements to add constraints or indexes.
        Specified by:
        getPostCreateSqls in interface Table
        Returns:
        the SQL strings
      • getPostAddSqls

        public List<String> getPostAddSqls​(Column column,
                                           Model model)
        Description copied from interface: Table
        Computes the SQL statements to finish adding a column, usually some ALTER TABLE statements to add constraints or indexes.
        Specified by:
        getPostAddSqls in interface Table
        Returns:
        the SQL strings
      • getDropSql

        public String getDropSql()
        Computes the SQL statement to drop the table.

        TODO drop constraints and indexes

        Specified by:
        getDropSql in interface Table
        Returns:
        the SQL drop string.