lundi 8 avril 2019

Error generating migrations with postgres type fields

In my laravel 5.5.18 version I use https://github.com/Xethron/migrations-generator (version "^2.0")

and running migration generator from postgres (PostgreSQL 10.6 (Ubuntu 10.6-0ubuntu0.18.04.1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 7.3.0-16ubuntu3) 7.3.0, 64-bit) I got error :

Setting up Tables and Index Migrations
Created: /mnt/_work_sdb8/wwwroot/lar/lprods/database/migrations/2019_04_08_145315_create_pd_category_table.php                                                                                                         


  [Doctrine\DBAL\DBALException]                                                                                                                                                                                        
  Unknown database type type_attributelabel requested, Doctrine\DBAL\Platforms\PostgreSQL92Platform may not support it.                                                                                                

I have table defined :

CREATE TABLE public.pd_attribute (
    id smallserial NOT NULL,
    "name" varchar(50) NOT NULL,
    label varchar(50) NOT NULL,
    "type" type_attributelabel NOT NULL,
    "ordering" int2 NOT NULL,
    created_at timestamp NOT NULL DEFAULT now(),
    CONSTRAINT ind_pd_attribute_label_unique UNIQUE (label),
    CONSTRAINT ind_pd_attribute_name_unique UNIQUE (name),
    CONSTRAINT pd_attribute_pkey PRIMARY KEY (id)
)
WITH (
    OIDS=FALSE
) ;

and definition with :

CREATE TYPE type_attributelabel AS ENUM (
    'S',
    'I'
);

If there is a way to generate mysql compatible files, with enums for such cases, or just string field ?

Thanks!



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire