How to addColumn character varying(3)[] for Phinx

216 Views Asked by At

How do I add a column using Phinx of type character varying(3)[] using their addColumn api?

Digging into the source code seems like it might not be a supported feature?

1

There are 1 best solutions below

0
Dan On

Phinx support custom types and you can forgo type check and write your own custom types:

addColumn(
    'MY_COLUMN_NAME',
    Literal::from('CHARACTER VARYING(3)[]'),
    [
        'null' => true,
        'comment' => 'SOME COMMENT ABOUT MY COLUMN'
    ])