Skip to content

DEFAULT_GENERATED being added to queries. #2138

@ghost

Description

Versions:

phinx: 0.11
mysql: 8+
pho: 7.2

Refering to: dbeaver/dbeaver#10797


when creating a colum which has CURRENT_TIMESTAMP as the default value, mysql adds 'DEFAULT_GENERATED' into the extra column.

This then gets added to any alter statements and causes a syntax issue.


REPRODUCTION:

####Create a table with a datetime field with CURRENT_TIMESTAMP as the default value.

CREATE TABLE `test_table` (
	`id`  INT NOT NULL AUTO_INCREMENT,
	`name` VARCHAR(80) NOT NULL,
	`last_changed` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
	PRIMARY KEY (`id`) USING BTREE
)

####using phinx to rename the column

public function change(){
    $this->table('test_table')
            ->renameColumn('last_changed', 'updated_at')
            ->update();
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions