Skip to content

Incorrect conversion of ENUM types #152

@Yogurt4

Description

@Yogurt4

WP Version: 6.8.3
PG4WP Version: 3.4.1

Error:

WordPress database error ERROR:  type "enum" does not exist
LINE 7:  feed_type ENUM('xml','csv','zip','gz','') NOT NULL DEFAULT ...
                   ^ for query 

RAW SQL

CREATE TABLE wp_pmxi_imports (
        id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
        parent_import_id BIGINT(20) NOT NULL DEFAULT 0,
        name TEXT,
        friendly_name VARCHAR(255) NOT NULL DEFAULT '',
        type VARCHAR(32) NOT NULL DEFAULT '',
        feed_type ENUM('xml','csv','zip','gz','') NOT NULL DEFAULT '',
        path TEXT,
        xpath TEXT,
        options LONGTEXT,
        registered_on DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
        root_element VARCHAR(255) DEFAULT '',
        processing BOOL NOT NULL DEFAULT 0,
        executing BOOL NOT NULL DEFAULT 0,
        triggered BOOL NOT NULL DEFAULT 0,
        queue_chunk_number BIGINT(20) NOT NULL DEFAULT 0,  
        first_import TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
        count BIGINT(20) NOT NULL DEFAULT 0,
        imported BIGINT(20) NOT NULL DEFAULT 0,
        created BIGINT(20) NOT NULL DEFAULT 0,
        updated BIGINT(20) NOT NULL DEFAULT 0,
        skipped BIGINT(20) NOT NULL DEFAULT 0,
        deleted BIGINT(20) NOT NULL DEFAULT 0,
        changed_missing BIGINT(20) NOT NULL DEFAULT 0,
        canceled BOOL NOT NULL DEFAULT 0,  
        canceled_on DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
        failed BOOL NOT NULL DEFAULT 0,  
        failed_on DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
        settings_update_on DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
        last_activity DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
        iteration BIGINT(20) NOT NULL DEFAULT 0,
        PRIMARY KEY  (id)
)

Expected Rewritten SQL

CREATE TYPE FEED_TYPE AS ENUM('xml','csv','zip','gz','');

CREATE TABLE wp_pmxi_imports (
...
        feed_type FEED_TYPE NOT NULL DEFAULT '',
...
)

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