使用postgres类型字段生成迁移时出错

时间:2019-04-08 15:06:30

标签: postgresql laravel-5 database-migration

在laravel 5.5.18版本中,我使用https://github.com/Xethron/migrations-generator(版本“ ^ 2.0”)

并在xcc_64-pc-linux-gnu上从Postgres(PostgreSQL 10.6(Ubuntu 10.6-0ubuntu0.18.04.1))运行迁移生成器,由gcc(Ubuntu 7.3.0-16ubuntu3)7.3.0,64位编译我收到错误消息:

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.                                                                                                

我已定义表:

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
) ;

和定义:

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

是否有一种生成mysql兼容文件的方法,例如用于这种情况的枚举,还是仅用于字符串字段?

谢谢!

0 个答案:

没有答案