Package org.apache.ddlutils.alteration

Examples of org.apache.ddlutils.alteration.AddColumnChange


        {
            TableChange change = (TableChange)changeIt.next();

            if (change instanceof AddColumnChange)
            {
                AddColumnChange addColumnChange = (AddColumnChange)change;

                // TODO: we cannot add columns to the primary key this way
                //       because we would have to drop the pk first and then
                //       add a new one afterwards which is not supported yet
                if (addColumnChange.getNewColumn().isPrimaryKey())
                {
                    pkColumnAdded = true;  
                }
                else
                {
View Full Code Here


        {
            TableChange change = (TableChange)changeIt.next();

            if (change instanceof AddColumnChange)
            {
                AddColumnChange addColumnChange = (AddColumnChange)change;

                // DB2 can only add not insert columns
                // Also, DB2 does not allow the GENERATED BY DEFAULT AS IDENTITY clause in
                // the ALTER TABLE ADD COLUMN statement, so we have to rebuild the table instead
                if ((addColumnChange.getNextColumn() == null) && !addColumnChange.getNewColumn().isAutoIncrement())
                {
                    processChange(currentModel, desiredModel, addColumnChange);
                    changeIt.remove();
                }
            }
View Full Code Here

        {
            TableChange change = (TableChange)changeIt.next();

            if (change instanceof AddColumnChange)
            {
                AddColumnChange addColumnChange = (AddColumnChange)change;

                // We can only use PostgreSQL-specific SQL if
                // * the column is not set to NOT NULL (the constraint would be applied immediately
                //   which will not work if there is already data in the table)
                // * the column has no default value (it would be applied after the change which
                //   means that PostgreSQL would behave differently from other databases where the
                //   default is applied to every column)
                // * the column is added at the end of the table (PostgreSQL does not support
                //   insertion of a column)
                if (!addColumnChange.getNewColumn().isRequired() &&
                    (addColumnChange.getNewColumn().getDefaultValue() == null) &&
                    (addColumnChange.getNextColumn() == null))
                {
                    processChange(currentModel, desiredModel, addColumnChange);
                    changeIt.remove();
                }
            }
View Full Code Here

TOP

Related Classes of org.apache.ddlutils.alteration.AddColumnChange

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.